Refactor priors to use explicit GalaxyConfig with catalog-centered distributions #17
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
This PR replaces the hard-coded
PriorConfigwith an explicit, flexibleGalaxyConfigthat specifies the full probabilistic model (profile type, parameters, and priors) in configuration. It introduces support for catalog-centered priors via a newcenter="catalog"mechanism inDistributionConfig, allowing per-source catalog values to be used as distribution locations at runtime.Key Changes
New
shine/prior_utils.py: Shared prior-parsing utility that convertsDistributionConfigentries (or fixed numeric values) into NumPyro sample sites. Supports catalog-centered priors by accepting optionalcatalog_valuesparameter.Enhanced
DistributionConfig:center: Optional[str]field to supportcenter="catalog"modecenter="catalog", themeanparameter is optional and ignored; per-source catalog values are used as the distribution location insteadmeanwhencenter="catalog"is set, but still requiresigmaNew
PositionConfig"Offset" mode:dxanddyfields to support position offsets (e.g., from catalog positions)DistributionConfigReplaced
PriorConfigwithGalaxyConfig:shine.euclid.config.PriorConfig(which only held sigma values)EuclidInferenceConfig.priors→EuclidInferenceConfig.gal(aGalaxyConfig)_default_euclid_galaxy_config()factory that builds the default Euclid model matching the previously hard-coded priorsUpdated
MultiExposureScene._sample_parameters():self.config.galinstead ofself.config.priorsparse_prior()to handle both fixed values and distributionscatalog_valuesfor flux and half-light radius (catalog-centered LogNormal priors)Updated
shine.scene.Scene._parse_prior(): Now a static method that delegates toparse_prior()fromprior_utils.Configuration file (
configs/euclid_vis.yaml):priors:section with explicitgal:sectionComprehensive test coverage (
tests/test_prior_utils.py):Notable Implementation Details
center="catalog", the median is set to each source's catalog value; internallylog(catalog_value)is used as the log-space location parameter.GalaxyConfigfactory reproduces the exact priors that were previously hard-coded, ensuring existing inference results are reproducible.https://claude.ai/code/session_01Cfk98zXxwLMsDoGuf5L9Gp