Skip to content

Commit ee0ccf3

Browse files
Jammy2211Jammy2211
authored andcommitted
fix ploting bug
1 parent 5c38d02 commit ee0ccf3

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

autoarray/inversion/plot/mapper_plotters.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,16 @@ def plot_source_from(
134134
auto_labels
135135
The labels given to the figure.
136136
"""
137-
# try:
138-
self.mat_plot_2d.plot_mapper(
139-
mapper=self.mapper,
140-
visuals_2d=self.visuals_2d,
141-
auto_labels=auto_labels,
142-
pixel_values=pixel_values,
143-
zoom_to_brightest=zoom_to_brightest,
144-
interpolate_to_uniform=interpolate_to_uniform,
145-
)
146-
# except ValueError:
147-
# logger.info(
148-
# "Could not plot the source-plane via the Mapper because of a ValueError."
149-
# )
137+
try:
138+
self.mat_plot_2d.plot_mapper(
139+
mapper=self.mapper,
140+
visuals_2d=self.visuals_2d,
141+
auto_labels=auto_labels,
142+
pixel_values=pixel_values,
143+
zoom_to_brightest=zoom_to_brightest,
144+
interpolate_to_uniform=interpolate_to_uniform,
145+
)
146+
except ValueError:
147+
logger.info(
148+
"Could not plot the source-plane via the Mapper because of a ValueError."
149+
)

autoarray/plot/wrap/two_d/delaunay_drawer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def draw_delaunay_pixels(
7474

7575
simplices = mapper.delaunay.simplices
7676

77+
# Remove padded -1 values required for JAX
78+
simplices = np.asarray(simplices)
79+
valid_mask = np.all(simplices >= 0, axis=1)
80+
simplices = simplices[valid_mask]
81+
7782
facecolors = facecolors_from(values=pixel_values, simplices=simplices)
7883

7984
norm = cmap.norm_from(array=pixel_values, use_log10=use_log10)

0 commit comments

Comments
 (0)