Skip to content

refactor: example Analysis reduces chi-squared with xp.sum - #1775

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/example-analysis-xp-sum
Nov 15, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/example-analysis-xp-sum

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

af.ex.Analysis.log_likelihood_function summed the chi-squared map with the Python builtin sum(), which under JAX iterates the traced array element by element. It now uses self._xp.sum(chi_squared_map), matching the self._xp pattern already used in model_data_1d_from, so the example analysis that tutorials and workspace scripts copy from shows the right pattern.

Closes #1774

API Changes

None — internal implementation change only; return value is numerically identical under NumPy and JAX.
See full details below.

Test Plan

  • Witness: log_likelihood_function contains self._xp.sum( and no bare sum( call
  • Targeted NumPy + JAX users of af.ex.Analysis (test_fitness_assertions_jax.py, test_bfgs_jax_gradient.py, graphical/test_shared_state.py, test_fitness_objective.py): 58 passed
  • Full pytest test_autofit (Python 3.13, jax 0.12, .[optional] installed): 4288 passed, 2 skipped, 1 xfailed

Heart (published board, dev gate): YELLOW — only blocker "PyAutoArray: open PR 12d old"; no red main CI on PyAutoFit or dependants.

Full API Changes (for automation & release notes)

Changed

  • autofit.example.analysis.Analysis.log_likelihood_function — reduces with self._xp.sum instead of builtin sum (no signature or behaviour change).

Generated by the PyAutoLabs agent workflow.


Generated by Claude Code

af.ex.Analysis.log_likelihood_function summed the chi-squared map with
the Python builtin sum(), which under JAX iterates the traced array
element by element. Use self._xp.sum() so the example tutorials copy
from shows the array-API pattern.

Closes #1774

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016nhQ8M5qwndUL85fDcyjxG
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Nov 15, 2026 — with Claude
@Jammy2211
Jammy2211 merged commit 5f580d5 into main Nov 15, 2026
6 checks passed
@Jammy2211
Jammy2211 deleted the feature/example-analysis-xp-sum branch November 15, 2026 20:48
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: example Analysis reduces chi-squared with xp.sum

2 participants