Skip to content

Commit 5247b7b

Browse files
Jammy2211Jammy2211
authored andcommitted
add mapper_pixels_zeroed_indices
1 parent 051b8ed commit 5247b7b

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

autoarray/preloads.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(
2424
source_pixel_zeroed_indices: np.ndarray = None,
2525
image_plane_mesh_grid_list: np.ndarray = None,
2626
linear_light_profile_blurred_mapping_matrix=None,
27+
mapper_pixels_zeroed_indices: np.ndarray = None,
2728
):
2829
"""
2930
Stores preloaded arrays and matrices used during pixelized linear inversions, improving both performance
@@ -113,6 +114,12 @@ def __init__(
113114
else:
114115
self.image_plane_mesh_grid_list.append(None)
115116

117+
if mapper_pixels_zeroed_indices is not None:
118+
119+
self.mapper_pixels_zeroed_indices = np.array(
120+
mapper_pixels_zeroed_indices
121+
)
122+
116123
if linear_light_profile_blurred_mapping_matrix is not None:
117124

118125
self.linear_light_profile_blurred_mapping_matrix = np.array(

autoarray/structures/mesh/delaunay_2d.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from autoarray.inversion.pixelization.mesh import mesh_numba_util
1515

1616

17-
def scipy_delaunay(points_np, query_points_np, source_pixel_zeroed_indices):
17+
def scipy_delaunay(points_np, query_points_np, mapper_pixel_zeroed_indices):
1818
"""Compute Delaunay simplices (simplices_padded) and Voronoi areas in one call."""
1919

2020
max_simplices = 2 * points_np.shape[0]
@@ -57,7 +57,7 @@ def scipy_delaunay(points_np, query_points_np, source_pixel_zeroed_indices):
5757
areas[areas > max_area] = max_area
5858

5959
# ---------- Set zeroed source pixels to max area ----------
60-
areas[source_pixel_zeroed_indices] = max_area
60+
areas[mapper_pixel_zeroed_indices] = max_area
6161

6262
split_point_areas = 0.5 * np.sqrt(areas)
6363

@@ -80,7 +80,7 @@ def scipy_delaunay(points_np, query_points_np, source_pixel_zeroed_indices):
8080
return points, simplices_padded, mappings, split_points, splitted_mappings
8181

8282

83-
def jax_delaunay(points, query_points, source_pixel_zeroed_indices):
83+
def jax_delaunay(points, query_points, mapper_pixel_zeroed_indices):
8484
import jax
8585
import jax.numpy as jnp
8686

@@ -107,7 +107,7 @@ def jax_delaunay(points, query_points, source_pixel_zeroed_indices):
107107
),
108108
points,
109109
query_points,
110-
source_pixel_zeroed_indices
110+
mapper_pixel_zeroed_indices
111111
)
112112

113113

@@ -457,15 +457,15 @@ def delaunay(self) -> "scipy.spatial.Delaunay":
457457
points, simplices, mappings, split_points, splitted_mappings = jax_delaunay(
458458
points=self.mesh_grid_xy,
459459
query_points=self._source_plane_data_grid_over_sampled,
460-
source_pixel_zeroed_indices=self.preloads.source_pixel_zeroed_indices
460+
mapper_pixel_zeroed_indices=self.preloads.mapper_pixel_zeroed_indices
461461
)
462462

463463
else:
464464

465465
points, simplices, mappings, split_points, splitted_mappings = scipy_delaunay(
466466
points_np=self.mesh_grid_xy,
467467
query_points_np=self._source_plane_data_grid_over_sampled,
468-
source_pixel_zeroed_indices=self.preloads.source_pixel_zeroed_indices,
468+
mapper_pixel_zeroed_indices=self.preloads.mapper_pixel_zeroed_indices,
469469
)
470470

471471
return DelaunayInterface(

0 commit comments

Comments
 (0)