Skip to content

feature/remove mapper valued#203

Merged
Jammy2211 merged 9 commits intomainfrom
feature/remove_mapper_valued
Jan 28, 2026
Merged

feature/remove mapper valued#203
Jammy2211 merged 9 commits intomainfrom
feature/remove_mapper_valued

Conversation

@Jammy2211
Copy link
Owner

@Jammy2211 Jammy2211 commented Jan 28, 2026

This pull request removes the MapperValued class and its related logic, consolidating its most important functionality directly into the AbstractInversion class. 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:

  • Removed the MapperValued class and moved its core methods (max_pixel_list_from and max_pixel_centre) into AbstractInversion, making these utilities directly available on inversion objects. [1] [2]
  • Removed the now-unused import and reference to MapperValued from autoarray/__init__.py.
  • Removed the interpolated_array_from method from the mock mapper and abstract mapper classes, as it is no longer needed with the removal of MapperValued. [1] [2] [3] [4]

Code cleanup and minor improvements:

  • Added a new property areas_for_magnification to MapperRectangular for clarity and consistency in accessing pixel areas.
  • Removed unused imports from mapper_numba_util.py to tidy up the codebase.
  • Added missing import of Grid2DIrregular to AbstractInversion to support new methods.

Copy link
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 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 MapperValued class and migrated its two key methods (max_pixel_list_from and max_pixel_centre) to AbstractInversion
  • Removed interpolated_array_from method from mapper classes and mesh classes, along with the InterpolatedReconstruction plotting utility
  • Removed mesh_numba_util.py module and cleaned up unused imports across the codebase
  • Added areas_for_magnification property to MapperRectangular for consistency with Mesh2DDelaunay

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.

Comment on lines +783 to +786
of its neighbors.

Returns
-------
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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.

Copilot uses AI. Check for mistakes.
Comment on lines +820 to +827
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.
"""
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@Jammy2211 Jammy2211 merged commit a5df8c6 into main Jan 28, 2026
8 checks passed
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