Skip to content

Feature/mesh refactor#388

Merged
Jammy2211 merged 2 commits intomainfrom
feature/mesh_refactor
Feb 20, 2026
Merged

Feature/mesh refactor#388
Jammy2211 merged 2 commits intomainfrom
feature/mesh_refactor

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

This pull request updates the handling of inversion settings across the codebase, standardizing the use of a unified Settings object in place of the previous SettingsInversion. 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:

Import path updates for mesh classes:

  • Updated import paths for mesh-related classes to use the new autoarray.inversion.pixelization.mesh_grid module, replacing old references to autoarray.structures.mesh.

General import and naming consistency:

  • Changed imports and references from SettingsInversion to Settings in autolens/__init__.py and related files for consistency.

These changes ensure a unified approach to inversion settings and reflect recent structural updates in the codebase.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / SettingsInversion usage with settings / Settings across 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 new Settings import 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.

Comment on lines 69 to 71
AbstractFitInversion.__init__(
self=self, model_obj=tracer, settings_inversion=settings_inversion,xp=xp
self=self, model_obj=tracer, settings=settings, xp=xp
)
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 77 to 79
AbstractFitInversion.__init__(
self=self, model_obj=tracer, settings_inversion=settings_inversion, xp=xp
self=self, model_obj=tracer, settings=settings, xp=xp
)
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 59 to +62
super().__init__(
dataset=dataset,
adapt_images=adapt_images,
settings_inversion=settings_inversion,
settings=settings,
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
from autoarray.inversion.pixelization.mappers.abstract import AbstractMapper
from autoarray.inversion.pixelization.mappers.abstract import AbstractMapper
from autoarray.inversion.pixelization.mappers.mapper import Mapper

Copilot uses AI. Check for mistakes.
@Jammy2211 Jammy2211 merged commit 554250c into main Feb 20, 2026
10 of 14 checks passed
@Jammy2211 Jammy2211 deleted the feature/mesh_refactor branch April 2, 2026 11:44
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.

2 participants