Conversation
There was a problem hiding this comment.
Pull request overview
This pull request removes the MapperValued class and consolidates its core functionality directly into the AbstractInversion class. The changes simplify the mapper API by removing interpolation-related methods and streamlining the codebase.
Changes:
- Removed
MapperValuedclass and migrated its two key methods (max_pixel_list_fromandmax_pixel_centre) toAbstractInversion - Removed
interpolated_array_frommethod from mapper classes and mesh classes, along with theInterpolatedReconstructionplotting utility - Removed
mesh_numba_util.pymodule and cleaned up unused imports across the codebase - Added
areas_for_magnificationproperty toMapperRectangularfor consistency withMesh2DDelaunay
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
autoarray/inversion/inversion/mapper_valued.py |
Deleted entire class; core methods migrated to AbstractInversion |
autoarray/inversion/inversion/abstract.py |
Added max_pixel_list_from and max_pixel_centre methods with Grid2DIrregular import |
autoarray/inversion/pixelization/mesh/mesh_numba_util.py |
Deleted entire module containing Delaunay interpolation utilities |
autoarray/inversion/pixelization/mappers/abstract.py |
Removed interpolated_array_from method |
autoarray/inversion/pixelization/mappers/rectangular.py |
Added areas_for_magnification property |
autoarray/inversion/pixelization/mappers/mapper_numba_util.py |
Removed unused imports (conf, mesh_numba_util, exc) |
autoarray/structures/mesh/delaunay_2d.py |
Removed interpolated_array_from method and mesh_numba_util import |
autoarray/structures/mesh/rectangular_2d.py |
Removed interpolated_array_from method |
autoarray/plot/wrap/two_d/interpolated_reconstruction.py |
Deleted plotting utility for interpolated reconstructions |
autoarray/plot/mat_plot/two_d.py |
Removed interpolated_reconstruction parameter and related logic |
autoarray/plot/__init__.py |
Removed InterpolatedReconstruction export |
autoarray/plot/wrap/__init__.py |
Removed InterpolatedReconstruction export |
autoarray/plot/wrap/two_d/__init__.py |
Removed InterpolatedReconstruction export |
autoarray/inversion/plot/mapper_plotters.py |
Removed interpolate_to_uniform parameter from plotting methods |
autoarray/inversion/plot/inversion_plotters.py |
Updated to call new inversion methods instead of MapperValued |
autoarray/util/__init__.py |
Removed mesh_numba import |
autoarray/__init__.py |
Removed MapperValued export |
autoarray/inversion/mock/mock_mapper.py |
Removed interpolated_array_from method and interpolated_array parameter |
test_autoarray/inversion/inversion/test_mapper_valued.py |
Deleted; tests for max_pixel_list_from and max_pixel_centre migrated to test_abstract.py |
test_autoarray/inversion/inversion/test_abstract.py |
Added migrated tests for max_pixel_list_from and max_pixel_centre |
test_autoarray/structures/mesh/test_rectangular.py |
Removed tests for interpolated_array_from |
test_autoarray/structures/mesh/test_delaunay.py |
Removed tests for interpolated_array_from |
test_autoarray/inversion/pixelization/mappers/test_abstract.py |
Removed tests for interpolated_array_from |
test_autoarray/inversion/pixelization/mesh/test_mesh_util.py |
Removed tests for delaunay_interpolated_grid_from |
test_autoarray/inversion/plot/test_mapper_plotters.py |
Removed tests using interpolate_to_uniform parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| of its neighbors. | ||
|
|
||
| Returns | ||
| ------- |
There was a problem hiding this comment.
The docstring is missing documentation for the mapper_index parameter and the Returns section is empty. Add mapper_index to the Parameters section (it specifies which mapper in the linear_obj_list to use when there are multiple mappers) and complete the Returns section to describe that the method returns a list of lists containing pixel indices.
| of its neighbors. | |
| Returns | |
| ------- | |
| of its neighbors. | |
| mapper_index | |
| The index specifying which mapper in the ``linear_obj_list`` to use when there are multiple mappers. | |
| Returns | |
| ------- | |
| list of list of int | |
| A list of lists containing the indices of the peak pixels in the mapper. |
| def max_pixel_centre(self, mapper_index: int = 0) -> Grid2DIrregular: | ||
| """ | ||
| Returns the centre of the brightest pixel in the mapper values. | ||
|
|
||
| Returns | ||
| ------- | ||
| The centre of the brightest pixel in the mapper values. | ||
| """ |
There was a problem hiding this comment.
The docstring is missing documentation for the mapper_index parameter. Add it to the Parameters section to document that it specifies which mapper in the linear_obj_list to use when there are multiple mappers.
This pull request removes the
MapperValuedclass and its related logic, consolidating its most important functionality directly into theAbstractInversionclass. It also cleans up unused code and simplifies the mapper API. The changes improve maintainability by reducing indirection and making key operations more discoverable.Source Science Examples:
Specific examples showing how to perform the source science calculations which previously used
MapperValued, but now just use scipy directly, are available on the autolens workspace:https://github.com/Jammy2211/autolens_workspace/blob/main/notebooks/imaging/source_science.ipynb
https://github.com/Jammy2211/autolens_workspace/blob/main/notebooks/imaging/features/pixelization/source_science.ipynb
Refactoring and API simplification:
MapperValuedclass and moved its core methods (max_pixel_list_fromandmax_pixel_centre) intoAbstractInversion, making these utilities directly available on inversion objects. [1] [2]MapperValuedfromautoarray/__init__.py.interpolated_array_frommethod from the mock mapper and abstract mapper classes, as it is no longer needed with the removal ofMapperValued. [1] [2] [3] [4]Code cleanup and minor improvements:
areas_for_magnificationtoMapperRectangularfor clarity and consistency in accessing pixel areas.mapper_numba_util.pyto tidy up the codebase.Grid2DIrregulartoAbstractInversionto support new methods.