feat: add numpy ellipse jax_likelihood reference scripts#42
Merged
Conversation
Adds scripts/jax_likelihood_functions/ellipse/ with simulator.py, fit.py, and multipoles.py — numpy path only. Captures the log_likelihood / chi_squared / noise_normalization / figure_of_merit reference numbers that prompt 7 of the ellipse_fitting_jax feature will assert against once AnalysisEllipse gains the JAX path. Issue #41. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the numpy-baseline reference scripts under
scripts/jax_likelihood_functions/ellipse/that lock in the reference numbers for ellipse fitting before the JAX path lands. Step 2 of 7 in theellipse_fitting_jaxfeature decomposition (PyAutoPrompt/z_features/ellipse_fitting_jax.md).Each script auto-simulates the dataset on first run, builds a fixed-parameter ellipse model (plus multipole for
multipoles.py), and prints every component of everyFitEllipseproduced byAnalysisEllipse.fit_list_from(...). Prompt 7 of the feature will JIT-wrapanalysis.fit_fromand assert against these numbers withnp.testing.assert_allclose(rtol=1e-4).Numpy-only — no
import jaxanywhere in the new scripts. Bothfit.pyandmultipoles.pyare deterministic across runs (verified by diff-comparison of two runs).Reference numbers captured at the prior medians of the model:
Issue #41.
Scripts Changed
scripts/jax_likelihood_functions/ellipse/__init__.py— new empty package marker.scripts/jax_likelihood_functions/ellipse/simulator.py— new; simulates a 50×50 single-Sersic-galaxyImagingdataset (noise_seed=1) intodataset/ellipse/jax_test/. Independent ofimaging/simulator.pyso the ellipse reference numbers don't drift with future imaging-side retuning.scripts/jax_likelihood_functions/ellipse/fit.py— new; single-ellipse numpy reference, prints the four FOM components per fit, ends with a# TODO(7_analysis_ellipse_jax.md)placeholder block.scripts/jax_likelihood_functions/ellipse/multipoles.py— new; same shape but withEllipseMultipole(m=4, multipole_comps=(0.05, 0.0))per ellipse. Uses themultipoles=[[multipole]]list-of-lists composition shape soAnalysisEllipse.fit_list_from'sinstance.multipoles[i]access works correctly.Test Plan
fit.pyandmultipoles.pyre-runs produce byte-identical reference numbers🤖 Generated with Claude Code