Skip to content

feature/mask 2d util to numpy#163

Merged
Jammy2211 merged 18 commits intofeature/jax_wrapperfrom
feature/mask_2d_util_to_numpy
Apr 2, 2025
Merged

feature/mask 2d util to numpy#163
Jammy2211 merged 18 commits intofeature/jax_wrapperfrom
feature/mask_2d_util_to_numpy

Conversation

@Jammy2211
Copy link
Owner

First refactoring of numba-based for loops to numpy functions, on my quest to remove all numba to ease JAX implementation.

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 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()

Copy link

Copilot AI Mar 31, 2025

Choose a reason for hiding this comment

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

[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()

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Jammy2211 Jammy2211 merged commit 1da50f4 into feature/jax_wrapper Apr 2, 2025
0 of 8 checks passed
@Jammy2211 Jammy2211 deleted the feature/mask_2d_util_to_numpy branch April 30, 2025 18:13
@Jammy2211 Jammy2211 restored the feature/mask_2d_util_to_numpy branch April 30, 2025 18:14
@Jammy2211 Jammy2211 deleted the feature/mask_2d_util_to_numpy branch June 24, 2025 13:46
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.

3 participants