Overview
PyAutoGalaxy's new profile-constructor guards correctly reject unphysical parameters, but raw ValueError now escapes model fitting where invalid candidates must be resampled. The same validation also exposes results tutorials and regression fixtures that construct profile instances from marginal error vectors or deliberately invalid all-ones samples. This task restores release/workspace compatibility without changing prior support.
Heart's exact RED reason is release validation FAILED (stage integrate) in PyAutoHeart Actions run 31354307923. The related workspace validation reports 45 failures.
Plan
- Preserve direct constructor validation while making invalid fit candidates rejectable by PyAutoFit.
- Keep existing priors and scientific parameter support unchanged.
- Avoid constructing physical profiles from marginal/error vectors that are not guaranteed jointly physical.
- Repair deliberately invalid fixtures and move intentional NaN injection downstream of constructor validation.
- Re-run the failed script surface, workspace validation, release integration, and Heart readiness.
Detailed implementation plan
Affected Repositories
- PyAutoGalaxy (primary)
- autogalaxy_workspace
- autolens_workspace
- autogalaxy_workspace_test
- autolens_workspace_test
Branch Survey
| Repository |
Current Branch |
Dirty? |
| PyAutoGalaxy |
main |
clean |
| autogalaxy_workspace |
main |
clean |
| autolens_workspace |
main |
clean |
| autogalaxy_workspace_test |
main |
clean |
| autolens_workspace_test |
main |
clean |
No active task claims these repositories. A clean unregistered autolens workspace worktree exists on feature/point-source-campaign-evidence-tail; it is an acknowledged non-blocking overlap warning.
Suggested branch: feature/profile-validation-resample-recovery
Work Classification: Both — library first, then workspaces.
Worktree root: ~/Code/PyAutoLabs-wt/profile-validation-resample-recovery/
Implementation Steps
- In
PyAutoGalaxy/autogalaxy/exc.py, introduce a narrowly scoped profile-parameter exception inheriting from both ValueError and autofit.exc.FitException.
- In
PyAutoGalaxy/autogalaxy/profiles/validate.py, raise that exception directly for ell_comps and pass it as exc_type to the shared AutoArray scalar validators. Do not change broad ProfileException behavior or catch arbitrary ValueError in PyAutoFit.
- Extend
PyAutoGalaxy/test_autogalaxy/profiles/test_validate.py to prove direct calls remain ValueError, fitting recognizes FitException, valid values/JAX tracers still pass, and error messages remain actionable.
- Update the results guides in
autogalaxy_workspace and autolens_workspace so component-wise marginal/error vectors use list/dictionary output where they are not guaranteed to form a valid physical profile. Regenerate affected notebooks.
- Replace invalid all-ones ellipticity components in the affected aggregator regression fixtures in
autogalaxy_workspace_test and autolens_workspace_test, preserving unrelated sentinel values and assertions.
- Redesign
autolens_workspace_test/scripts/imaging/jax_likelihood/delaunay.py so its deliberate NaN reaches the downstream likelihood without asking profile constructors to accept NaN parameters.
- Run focused PyAutoGalaxy tests and the full library suite; then run all 22 scripts that failed in release integration under their declared environments, verify generated notebook parity, dispatch workspace/release validation, and refresh Heart.
Key Files
PyAutoGalaxy/autogalaxy/exc.py — fit-aware profile parameter exception.
PyAutoGalaxy/autogalaxy/profiles/validate.py — constructor validation exception contract.
PyAutoGalaxy/test_autogalaxy/profiles/test_validate.py — regression tests.
autogalaxy_workspace/scripts/guides/results/ — marginal/error summary examples.
autolens_workspace/scripts/guides/results/ — matching lensing examples.
autogalaxy_workspace_test/scripts/misc/aggregator/ — physical fixture vectors.
autolens_workspace_test/scripts/misc/aggregator/ — physical fixture vectors.
autolens_workspace_test/scripts/imaging/jax_likelihood/delaunay.py — downstream NaN injection.
Out of Scope
- Joint unit-disk priors or axis-ratio/position-angle reparameterization.
- Global catching of
ValueError in PyAutoFit.
- Narrowing component priors to an orientation-dependent square.
- Tenant-firewall drift unrelated to this regression.
Original Prompt
Click to expand starting prompt
Can we target making heart red
Should it not be the priors prevent these unphysical values throughout? That might be a big task but worth assessing
Just do 1 i agree 2 is too much
Overview
PyAutoGalaxy's new profile-constructor guards correctly reject unphysical parameters, but raw
ValueErrornow escapes model fitting where invalid candidates must be resampled. The same validation also exposes results tutorials and regression fixtures that construct profile instances from marginal error vectors or deliberately invalid all-ones samples. This task restores release/workspace compatibility without changing prior support.Heart's exact RED reason is
release validation FAILED (stage integrate)in PyAutoHeart Actions run 31354307923. The related workspace validation reports 45 failures.Plan
Detailed implementation plan
Affected Repositories
Branch Survey
No active task claims these repositories. A clean unregistered autolens workspace worktree exists on
feature/point-source-campaign-evidence-tail; it is an acknowledged non-blocking overlap warning.Suggested branch:
feature/profile-validation-resample-recoveryWork Classification: Both — library first, then workspaces.
Worktree root:
~/Code/PyAutoLabs-wt/profile-validation-resample-recovery/Implementation Steps
PyAutoGalaxy/autogalaxy/exc.py, introduce a narrowly scoped profile-parameter exception inheriting from bothValueErrorandautofit.exc.FitException.PyAutoGalaxy/autogalaxy/profiles/validate.py, raise that exception directly forell_compsand pass it asexc_typeto the shared AutoArray scalar validators. Do not change broadProfileExceptionbehavior or catch arbitraryValueErrorin PyAutoFit.PyAutoGalaxy/test_autogalaxy/profiles/test_validate.pyto prove direct calls remainValueError, fitting recognizesFitException, valid values/JAX tracers still pass, and error messages remain actionable.autogalaxy_workspaceandautolens_workspaceso component-wise marginal/error vectors use list/dictionary output where they are not guaranteed to form a valid physical profile. Regenerate affected notebooks.autogalaxy_workspace_testandautolens_workspace_test, preserving unrelated sentinel values and assertions.autolens_workspace_test/scripts/imaging/jax_likelihood/delaunay.pyso its deliberate NaN reaches the downstream likelihood without asking profile constructors to accept NaN parameters.Key Files
PyAutoGalaxy/autogalaxy/exc.py— fit-aware profile parameter exception.PyAutoGalaxy/autogalaxy/profiles/validate.py— constructor validation exception contract.PyAutoGalaxy/test_autogalaxy/profiles/test_validate.py— regression tests.autogalaxy_workspace/scripts/guides/results/— marginal/error summary examples.autolens_workspace/scripts/guides/results/— matching lensing examples.autogalaxy_workspace_test/scripts/misc/aggregator/— physical fixture vectors.autolens_workspace_test/scripts/misc/aggregator/— physical fixture vectors.autolens_workspace_test/scripts/imaging/jax_likelihood/delaunay.py— downstream NaN injection.Out of Scope
ValueErrorin PyAutoFit.Original Prompt
Click to expand starting prompt