Conversation
There was a problem hiding this comment.
Pull request overview
This pull request introduces a new edge pixel zeroing feature for pixelizations during inversion and removes the Preloads dependency, streamlining the inversion API. The edge zeroing feature prevents unphysical values in reconstructed solutions at pixelization boundaries by excluding edge pixels from the linear solve.
Changes:
- Introduced
use_edge_zeroed_pixelsconfiguration option and implemented the edge pixel zeroing logic in the inversion reconstruction process - Completely removed the
Preloadsclass and all its references throughout the codebase, simplifying the inversion API - Updated test fixtures to explicitly specify pixel counts for mesh instantiations, improving test clarity
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
autoarray/config/general.yaml |
Added use_edge_zeroed_pixels configuration option (default: true) |
test_autoarray/config/general.yaml |
Added use_edge_zeroed_pixels configuration option (default: false for tests) |
autoarray/settings.py |
Added use_edge_zeroed_pixels property to Settings class |
autoarray/preloads.py |
Deleted entire file containing Preloads class |
autoarray/__init__.py |
Removed Preloads import |
autoarray/inversion/inversion/abstract.py |
Removed preloads parameter, added zeroed_ids_to_keep cached property, updated reconstruction logic |
autoarray/inversion/inversion/imaging/*.py |
Removed preloads parameter from all imaging inversion classes |
autoarray/inversion/inversion/factory.py |
Removed preloads parameter from factory functions |
autoarray/inversion/mappers/abstract.py |
Removed preloads parameter, added mesh property |
autoarray/inversion/mesh/mesh/delaunay.py |
Added mandatory pixels parameter, zeroed_pixels parameter, and zeroed_pixels property |
autoarray/inversion/mesh/mesh/knn.py |
Added mandatory pixels and zeroed_pixels parameters |
autoarray/inversion/mesh/mesh/rectangular_adapt_density.py |
Added zeroed_pixels property implementation |
autoarray/inversion/mesh/mesh/abstract.py |
Removed preloads parameter from interpolator_from |
autoarray/inversion/mesh/interpolator/*.py |
Removed preloads parameter from all interpolator classes |
autoarray/inversion/mesh/mesh_geometry/rectangular.py |
Removed total_linear_light_profiles parameter from rectangular_edge_pixel_list_from |
test_autoarray/inversion/inversion/test_factory.py |
Updated test to use new settings-based approach instead of preloads |
test_autoarray/inversion/inversion/test_abstract.py |
Updated mesh instantiations to include explicit pixel counts |
test_autoarray/inversion/pixelization/*/test_*.py |
Updated mesh instantiations to include explicit pixel counts |
autoarray/fixtures.py |
Updated fixture mesh instantiations to include explicit pixel counts |
Comments suppressed due to low confidence (5)
autoarray/config/general.yaml:7
- Spelling error: "solutuion" should be "solution".
use_positive_only_solver: true # If True, inversion's use a positive-only linear algebra solver by default, which is slower but prevents unphysical negative values in the reconstructed solutuion.
test_autoarray/config/general.yaml:13
- Spelling error: "solutuion" should be "solution".
use_positive_only_solver: false # If True, inversion's use a positive-only linear algebra solver by default, which is slower but prevents unphysical negative values in the reconstructed solutuion.
autoarray/inversion/inversion/abstract.py:476
- Trailing whitespace on this line should be removed.
autoarray/config/general.yaml:8 - There is inconsistent spacing in the YAML key. The key
use_edge_zeroed_pixels :has a space before the colon, while all other keys in this file do not. For consistency with the rest of the file, it should beuse_edge_zeroed_pixels:(without the space before the colon).
use_edge_zeroed_pixels : true # If True, the edge pixels of a pixelization are set to zero, which prevents unphysical values in the reconstructed solution at the edge of the pixelization.
test_autoarray/config/general.yaml:14
- There is inconsistent spacing in the YAML key. The key
use_edge_zeroed_pixels :has a space before the colon, while all other keys in this file do not. For consistency with the rest of the file, it should beuse_edge_zeroed_pixels:(without the space before the colon).
use_edge_zeroed_pixels : false # If True, the edge pixels of a pixelization are set to zero, which prevents unphysical values in the reconstructed solution at the edge of the pixelization.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def __init__( | ||
| self, | ||
| pixels: int, | ||
| k_neighbors=10, | ||
| radius_scale=1.5, | ||
| areas_factor=0.5, | ||
| split_neighbor_division=2, | ||
| zeroed_pixels: Optional[int] = 0, | ||
| ): | ||
|
|
||
| self.k_neighbors = k_neighbors | ||
| self.radius_scale = radius_scale | ||
| self.areas_factor = areas_factor | ||
| self.split_neighbor_division = split_neighbor_division | ||
|
|
||
| super().__init__() | ||
| super().__init__(pixels=pixels, zeroed_pixels=zeroed_pixels) |
There was a problem hiding this comment.
The __init__ method lacks a docstring. Given that this class now requires a mandatory pixels parameter and has several other configuration parameters (k_neighbors, radius_scale, areas_factor, split_neighbor_division, zeroed_pixels), documentation is essential for users to understand how to properly instantiate and use this class.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces a new feature for zeroing edge pixels in pixelizations during inversion, improving the physical plausibility of reconstructed solutions. It also removes the
Preloadsdependency from the inversion and mapper classes, streamlining the codebase. Additionally, test fixtures are updated to explicitly specify pixel counts for meshes, ensuring consistency and clarity.The most important changes are:
Edge Pixel Zeroing Feature:
use_edge_zeroed_pixelsingeneral.yamlto enable zeroing of edge pixels in pixelizations, preventing unphysical values in reconstructed solutions at the pixelization boundaries.AbstractInversion(abstract.py) to compute and use global indices of zeroed pixels, ensuring only non-edge pixels are solved for in the inversion. This includes the newzeroed_ids_to_keepproperty and updates to the reconstruction logic. [1] [2] [3]Preloads Removal and Refactoring:
Preloadsargument and related code from inversion, mapper, and factory classes, simplifying initialization and parameter 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]Test Fixture Updates: