Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors inversion configuration and mesh-related imports by standardizing on a unified Settings object (replacing SettingsInversion) and updating references accordingly across runtime code, tests, and documentation.
Changes:
- Replaced
settings_inversion/SettingsInversionusage withsettings/Settingsacross fit, analysis, and aggregator entry points. - Updated regularization naming in tests/config/docs (e.g.
AdaptiveBrightness*→Adapt*) and adjusted tutorial/doc references. - Adjusted public imports in
autolens/__init__.py, including the newSettingsimport path and mesh class import paths.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test_autolens/imaging/test_simulate_and_fit_imaging.py | Updates FitImaging calls to use settings=al.Settings(...) and renames a regularization class used in tests. |
| test_autolens/config/priors/regularization.yaml | Updates prior config key to the renamed regularization class (Adapt). |
| test_autolens/analysis/test_analysis.py | Updates analysis construction to use unified settings. |
| docs/howtolens/chapter_4_pixelizations.rst | Updates tutorial link to renamed notebook path. |
| docs/api/pixelization.rst | Updates API docs to list Adapt* regularizations and Settings instead of SettingsInversion. |
| autolens/util/init.py | Removes an outdated mesh utility import consistent with module re-organization. |
| autolens/lens/to_inversion.py | Renames inversion settings plumbing to settings throughout tracer→inversion interface. |
| autolens/interferometer/model/analysis.py | Passes unified settings into FitInterferometer creation. |
| autolens/interferometer/fit_interferometer.py | Renames constructor parameter/attribute to settings and forwards it to inversion plumbing. |
| autolens/imaging/model/analysis.py | Passes unified settings into FitImaging creation. |
| autolens/imaging/fit_imaging.py | Renames constructor parameter/attribute to settings and forwards it to inversion plumbing. |
| autolens/analysis/analysis/dataset.py | Renames analysis dataset-level inversion settings to unified settings. |
| autolens/aggregator/subhalo.py | Renames aggregator wrapper field to unified settings. |
| autolens/aggregator/fit_interferometer.py | Loads/overrides unified settings from aggregator DB values and forwards to fit construction. |
| autolens/aggregator/fit_imaging.py | Loads/overrides unified settings from aggregator DB values and forwards to fit construction. |
| autolens/init.py | Updates public exports/import paths for Settings and mesh classes; removes some mapper re-exports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| AbstractFitInversion.__init__( | ||
| self=self, model_obj=tracer, settings_inversion=settings_inversion,xp=xp | ||
| self=self, model_obj=tracer, settings=settings, xp=xp | ||
| ) |
There was a problem hiding this comment.
settings may be None here (many tests and callers construct FitImaging(...) without passing it), but it is passed into AbstractFitInversion.__init__ before being defaulted. This changes behavior vs the previous SettingsInversion() default and can break initialization if AbstractFitInversion expects a Settings instance. Create a default aa.Settings() (or equivalent) before calling AbstractFitInversion.__init__, and then pass that non-None object through consistently.
| AbstractFitInversion.__init__( | ||
| self=self, model_obj=tracer, settings_inversion=settings_inversion, xp=xp | ||
| self=self, model_obj=tracer, settings=settings, xp=xp | ||
| ) |
There was a problem hiding this comment.
settings defaults to None and is passed into AbstractFitInversion.__init__. Many call sites construct FitInterferometer(...) without providing settings, so this can be None at runtime and diverges from the old SettingsInversion() default. Default settings to a concrete aa.Settings() (or equivalent) before it’s used/forwarded, and store that on self.settings.
| super().__init__( | ||
| dataset=dataset, | ||
| adapt_images=adapt_images, | ||
| settings_inversion=settings_inversion, | ||
| settings=settings, |
There was a problem hiding this comment.
settings can be None by default and is forwarded to the parent AbstractToInversion via super().__init__(..., settings=settings, ...). Previously a concrete settings object was always provided (via SettingsInversion()), so this may now propagate None into downstream inversion setup. Consider defaulting settings to aa.Settings() before calling super().__init__ to preserve prior behavior and avoid None-handling throughout the inversion pipeline.
| from autoarray.inversion.inversion.settings import SettingsInversion | ||
| from autoarray.settings import Settings | ||
| from autoarray.inversion.inversion.factory import inversion_from as Inversion | ||
| from autoarray.inversion.pixelization.mappers.abstract import AbstractMapper |
There was a problem hiding this comment.
autolens.__init__ no longer re-exports a Mapper symbol, but docs/api/pixelization.rst still lists Mapper under .. currentmodule:: autolens autosummary. This will break docs/autosummary generation (and is also a public API change). Either re-export the appropriate Mapper factory/type from autoarray again, or update the docs to point at the new import location / remove the Mapper entry.
| from autoarray.inversion.pixelization.mappers.abstract import AbstractMapper | |
| from autoarray.inversion.pixelization.mappers.abstract import AbstractMapper | |
| from autoarray.inversion.pixelization.mappers.mapper import Mapper |
This pull request updates the handling of inversion settings across the codebase, standardizing the use of a unified
Settingsobject in place of the previousSettingsInversion. It also updates import paths for mesh-related classes to reflect a new module organization. These changes improve code consistency and simplify configuration management for inversion-related operations.Standardization of inversion settings:
SettingsInversionwith the new unifiedSettingsobject across the codebase, including function signatures, class attributes, and documentation in files such asfit_imaging.py,fit_interferometer.py,subhalo.py,dataset.py,fit_imaging.py, andanalysis.py. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27]Import path updates for mesh classes:
autoarray.inversion.pixelization.mesh_gridmodule, replacing old references toautoarray.structures.mesh.General import and naming consistency:
SettingsInversiontoSettingsinautolens/__init__.pyand related files for consistency.These changes ensure a unified approach to inversion settings and reflect recent structural updates in the codebase.