Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors the Settings and mesh/mapper infrastructure in autoarray by consolidating the SettingsInversion class into a unified Settings class, relocating mesh-related modules from structures/mesh to inversion/pixelization/mesh_grid, and modernizing the mapper creation interface from mapper_grids_from to mapper_from.
Changes:
- Unified settings management by replacing
SettingsInversionwithSettingsthroughout the codebase - Relocated mesh grid classes from
structures.meshtoinversion.pixelization.mesh_grid - Refactored mapper creation to use
mapper_frommethod with direct parameter passing instead ofMapperGridswrapper - Removed unused configuration options (
positive_only_uses_p_initial,tolerance,maxiter) - Updated test fixtures and test files to use new interfaces
Reviewed changes
Copilot reviewed 75 out of 78 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
autoarray/settings.py |
Renamed from SettingsInversion to Settings, removed positive_only_uses_p_initial, tolerance, and maxiter parameters |
autoarray/__init__.py |
Updated imports to reference new mesh_grid module locations, removed old mesh and mapper_grids imports |
autoarray/fixtures.py |
Refactored fixtures to use new mapper creation interface; contains critical bugs in make_delaunay_mesh_grid_9 |
autoarray/inversion/pixelization/mesh_grid/*.py |
New location for mesh grid classes (Mesh2DRectangular, Mesh2DDelaunay) with updated constructors |
autoarray/inversion/pixelization/mappers/*.py |
Updated mappers to accept individual parameters instead of MapperGrids object |
autoarray/inversion/inversion/*.py |
Updated all inversion classes to use Settings instead of SettingsInversion |
test_autoarray/inversion/regularizations/*.py |
Updated tests to create mesh geometry objects directly |
test_autoarray/inversion/pixelization/*.py |
Tests reorganized and updated to use new mesh_grid module locations |
autoarray/config/general.yaml |
Removed positive_only_uses_p_initial configuration option |
Comments suppressed due to low confidence (1)
autoarray/init.py:81
- Duplicate imports detected:
Mesh2DRectangularandMesh2DDelaunayare imported twice from the same module (inversion.pixelization.mesh_grid.rectangularandinversion.pixelization.mesh_grid.delaunay). The imports appear on lines 43-44 and again on lines 80-81.
While Python will handle this gracefully (the second import will simply overwrite the first), it's redundant and can cause confusion. Remove one set of these imports.
from .inversion.pixelization.mesh_grid.rectangular import Mesh2DRectangular
from .inversion.pixelization.mesh_grid.delaunay import Mesh2DDelaunay
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request primarily updates mesh and mapper imports to reflect new module locations. It moves modules from
structures/meshtopixelization/mesh_gridand makes mesh geometry a property of a Mapper, whereas before it was set up and passed through the source code.This, in turn, means the
MapperGridsobject is removed and going from amesh(e.g. aRectangularAdaptDensityto amapper(e.g.MapperRectangular) is more streamlined, usingmesh.mapper_from(). This replaces the mapper factory.It also refactors how the
Settingsobject is imported and used throughout the inversion modules, replacing the olderSettingsInversionimport and default construction with a unifiedSettingsclass from the top-levelsettingsmodule. Additionally, itRefactoring and Unification of Settings:
SettingsInversionwith the unifiedSettingsclass fromautoarray.settingsacross all inversion and related modules. This includes constructors, factories, and utility functions, ensuring consistent configuration handling throughout the codebase. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23]Mesh and Mapper Import Updates:
autoarray/__init__.pyto use new module paths underinversion.pixelization.mesh_grid, removing old imports fromstructures.mesh.Fixture and Test Utility Simplification:
autoarray/fixtures.pyto use the new mesh and mapper interfaces, removing outdated or redundant functions, and consolidating the creation of mesh grids and mappers for tests. [1] [2] [3]Configuration Cleanup:
positive_only_uses_p_initialoption from the inversion section of the configuration filegeneral.yaml.These changes modernize and standardize the configuration and mesh handling interfaces, making the codebase easier to maintain and extend.