Skip to content

fix(config): prior yaml drift — stale classes, paths, params + walker test - #619

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/config-priors-drift
Sep 16, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/config-priors-drift

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

autonerves.JSONPriorConfig looks a prior up by testing whether {cls.__module__}.{cls.__name__}.{param} ends with the dotted path of a yaml under config/priors/ plus its key. A yaml at the wrong path, a typo'd class key or a param the class does not take is therefore silently dead — the MRO walk finds a parent's file and nothing errors. The euclid pipeline's config-drift sweep (euclid#43 / PR #44) found rows that reproduce identically in the packaged autogalaxy/config/priors/; one is a live failure (af.Model(ag.mp.NFWTruncatedMCRScatterLudlowSph) raises ConfigException).

This PR fixes every dead row in the packaged config and adds a walker test so the class of bug cannot recur. Refs #618 — the issue stays open until the workspace re-sync PRs merge.

File (rel. config/priors/) Was Fix
light/operated/sersic.yaml key ersic (typo) Sersic
mass/dark/nfw_truncated_mcr.yaml NFWTruncatedMCRScatterLudlowSph block under the wrong module's file → ConfigException moved verbatim to new mass/dark/nfw_truncated_mcr_scatter.yaml
light/linear/chameleon.yaml, light/linear/eff.yaml orphan files, no lp_linear.Chameleon / ElsonFreeFall deleted
point_sources.yaml PointSourceChi block, class removed deleted
mass/stellar/sersic_core.yaml SersicCoreSph.mass_to_light_ratio, not an __init__ arg key deleted
light/linear_operated/gaussian.yaml Gaussian.intensity, linear profiles have no intensity key deleted
ellipse/ellipse_multipole.yaml EllipseMultipoleRelative (class is EllipseMultipoleScaled), gaussian_limits (key is limits) renamed
mesh/delaunay.yaml empty DelaunayNN key under delaunay (module is delaunay_nn) key deleted
mesh/README.md "…or Voronoi mesh" Voronoi removed from the prose

The ellipse_multipole.yaml and delaunay.yaml rows were not in the issue's table — the new walker test found them. cosmology.yaml::model.FlatLambdaCDM was re-verified as not drift (the dotted key is the correct suffix and resolves) and is untouched.

Behaviour change for users: the operated Sersic and EllipseMultipoleScaled priors now actually load from their own yaml files instead of falling back to the parent class's. Diffing light/operated/sersic.yaml against light/standard/sersic.yaml: the operated file carries all seven parameters with the same values, except ell_comps_0/1, which are TruncatedGaussian (mean 0, sigma 0.3, bounds -1..1) rather than Gaussian with limits -1..1 — the type ten other packaged prior files already use. So the only prior that changes for an operated Sersic model is the ellipticity prior type.

API Changes

None — packaged configuration and tests only. No Python source changes.

Test Plan

  • test_autogalaxy/test_priors_config.py — test__every_prior_key_resolves_to_a_class and test__every_prior_parameter_is_an_init_argument walk autogalaxy/config/priors/** against a class census of autogalaxy, autoarray, autofit; test__nfw_truncated_mcr_scatter_ludlow_sph_model_resolves and test__ellipse_multipole_scaled_model_resolves construct the previously unresolvable models. All four fail on the unfixed config (red witness run on this branch with only the yaml stashed) and pass with the fix.
  • Full pytest test_autogalaxy passes in the task worktree.
  • CI (shared lib-tests.yml) green.
  • Workspace follow-up PRs apply the same edits to the config/ copies in autolens_workspace, autogalaxy_workspace, HowToLens and autolens_workspace_test (plus their stale plots_search.yaml / readerless general.yaml::fits.flip_for_ds9) — tracked on fix(config): prior yaml drift — stale classes, paths, params + walker test #618.

Heart at ship time: stale — "release validation incomplete: no rehearsal for current source" (freshness tier, nothing known-bad; organism-scope, not branch-scope).

Full API Changes (for automation & release notes)

Changed Behaviour

  • Packaged default priors for autogalaxy.profiles.light.operated.Sersic now load from config/priors/light/operated/sersic.yaml (previously dead key ersic; the standard Sersic file was used instead).
  • Packaged default priors for autogalaxy.EllipseMultipoleScaled now load from config/priors/ellipse/ellipse_multipole.yaml (previously dead key EllipseMultipoleRelative).
  • af.Model(autogalaxy.mp.NFWTruncatedMCRScatterLudlowSph) now constructs; previously raised ConfigException because its priors lived under nfw_truncated_mcr.yaml.

Removed (dead configuration only, no Python symbols)

  • config/priors/light/linear/chameleon.yaml, config/priors/light/linear/eff.yaml
  • config/priors/point_sources.yaml::PointSourceChi
  • config/priors/mass/stellar/sersic_core.yaml::SersicCoreSph.mass_to_light_ratio
  • config/priors/light/linear_operated/gaussian.yaml::Gaussian.intensity
  • config/priors/mesh/delaunay.yaml::DelaunayNN

Added

  • config/priors/mass/dark/nfw_truncated_mcr_scatter.yaml
  • test_autogalaxy/test_priors_config.py

Migration

  • None required. Workspace config/priors/ copies should apply the same edits (follow-up PRs).

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

… test

`autonerves.JSONPriorConfig` resolves a prior by asking whether
`{cls.__module__}.{cls.__name__}.{param}` ends with the dotted path of a
yaml under `config/priors/` plus its key, so a yaml at the wrong path, a
typo'd class key or a param the class no longer takes is silently dead
rather than an error. Fix every such row in the packaged config:

- light/operated/sersic.yaml: `ersic` -> `Sersic` (operated Sersic priors
  were dead and fell back to the standard Sersic file)
- mass/dark: move `NFWTruncatedMCRScatterLudlowSph` from
  nfw_truncated_mcr.yaml to nfw_truncated_mcr_scatter.yaml, matching its
  module; `af.Model(NFWTruncatedMCRScatterLudlowSph)` raised ConfigException
- light/linear/chameleon.yaml, eff.yaml: delete — no linear Chameleon or
  ElsonFreeFall class exists
- point_sources.yaml: drop `PointSourceChi` (class removed)
- mass/stellar/sersic_core.yaml: drop `SersicCoreSph.mass_to_light_ratio`
  (not an __init__ argument)
- light/linear_operated/gaussian.yaml: drop `Gaussian.intensity` (linear
  profiles have no intensity)
- ellipse/ellipse_multipole.yaml: `EllipseMultipoleRelative` ->
  `EllipseMultipoleScaled`, `gaussian_limits` -> `limits`
- mesh/delaunay.yaml: drop the empty `DelaunayNN` key (module is
  delaunay_nn); mesh/README.md no longer mentions the removed Voronoi mesh

Add test_autogalaxy/test_priors_config.py: walks the packaged priors and
asserts every top-level key suffix-matches a real PyAuto class and every
param is an __init__ argument, plus model-construction regressions for
NFWTruncatedMCRScatterLudlowSph and EllipseMultipoleScaled. All four new
assertions fail on the unfixed config.

Refs #618 (stays open for the workspace follow-up PRs)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 67f6ca6 into main Sep 16, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/config-priors-drift branch September 16, 2026 09:34
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 26, 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.

1 participant