feature/mask 2d util to numpy#163
Merged
Jammy2211 merged 18 commits intofeature/jax_wrapperfrom Apr 2, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors several mask and array utility functions to use numpy operations directly, replacing numba-based calls where possible to simplify JAX integration. Key changes include replacing calls to mask utility functions with np.sum(~mask) for pixel counting, removing deprecated test cases and functions, and adding a new output_to_fits method to streamline multi-figure exports.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test_autoarray/mask/test_mask_2d_util.py | Updated tests with new native index functions and removed deprecated tests. |
| test_autoarray/mask/test_mask_2d.py | Removed tests for circular anti-annular functionality. |
| autoarray/structures/vectors/uniform.py | Minor formatting adjustment in magnitudes computation. |
| autoarray/structures/grids/grid_2d_util.py | Replaced total_pixels computation with np.sum(~mask_2d). |
| autoarray/structures/arrays/array_2d_util.py | Updated pixel counting and jax.lax.cond usage to reflect numpy refactoring. |
| autoarray/plot/multi_plotters.py | Added a new output_to_fits method with extended docstrings for fits file output. |
| autoarray/operators/* | Refactored over-sampling and contour methods to utilize numpy operations for better clarity. |
| autoarray/mask/mask_2d.py | Removed the deprecated circular_anti_annular method. |
| autoarray/inversion/* and autoarray/geometry/* | Various formatting and parameter adjustments to support the numpy-based refactoring. |
Comments suppressed due to low confidence (1)
autoarray/plot/multi_plotters.py:295
- Correct 'visualuzation' to 'visualization' in the docstring.
A major visualuzation refactor is required to make this more elegant.
Comment on lines
740
to
745
| edge_pixels = util.mask_2d.edge_1d_indexes_from(mask_2d=mask) | ||
|
|
||
| print(edge_pixels) | ||
|
|
||
| assert (edge_pixels == np.array([0])).all() | ||
|
|
There was a problem hiding this comment.
[nitpick] Remove the debugging print statement unless it's intentionally left for logging purposes.
Suggested change
| edge_pixels = util.mask_2d.edge_1d_indexes_from(mask_2d=mask) | |
| print(edge_pixels) | |
| assert (edge_pixels == np.array([0])).all() | |
| edge_pixels = util.mask_2d.edge_1d_indexes_from(mask_2d=mask) | |
| assert (edge_pixels == np.array([0])).all() |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
rhayes777
approved these changes
Apr 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First refactoring of numba-based for loops to numpy functions, on my quest to remove all
numbato ease JAX implementation.