Skip to content

Commit 01a3aad

Browse files
committed
errors -> reconstruction noise map
1 parent 3df1838 commit 01a3aad

8 files changed

Lines changed: 34 additions & 34 deletions

File tree

autoarray/config/visualize/plots.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ inversion: # Settings for plots of inversions (e
3535
all_at_end_fits: true # Plot all individual plots listed below as .fits (even if False)?
3636
all_at_end_pdf: false # Plot all individual plots listed below as publication-quality .pdf (even if False)?
3737
data_subtracted: false # Plot individual plots of the data with the other inversion linear objects subtracted?
38-
errors: false # Plot image of the errors of every mesh-pixel reconstructed value?
38+
reconstruction_noise_map: false # Plot image of the errors of every mesh-pixel reconstructed value?
3939
sub_pixels_per_image_pixels: false # Plot the number of sub pixels per masked data pixels?
4040
mesh_pixels_per_image_pixels: false # Plot the number of image-plane mesh pixels per masked data pixels?
4141
image_pixels_per_mesh_pixels: false # Plot the number of image pixels in each pixel of the mesh?

autoarray/inversion/inversion/abstract.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -758,16 +758,16 @@ def log_det_regularization_matrix_term(self) -> float:
758758
raise exc.InversionException() from e
759759

760760
@property
761-
def errors_with_covariance(self) -> np.ndarray:
762-
return np.linalg.inv(self.curvature_reg_matrix)
761+
def reconstruction_noise_map_with_covariance(self) -> np.ndarray:
762+
return np.sqrt(np.linalg.inv(self.curvature_reg_matrix))
763763

764764
@property
765-
def errors(self):
766-
return np.diagonal(self.errors_with_covariance)
765+
def reconstruction_noise_map(self):
766+
return np.diagonal(self.reconstruction_noise_map_with_covariance)
767767

768768
@property
769-
def errors_dict(self) -> Dict[LinearObj, np.ndarray]:
770-
return self.source_quantity_dict_from(source_quantity=self.errors)
769+
def reconstruction_noise_map_dict(self) -> Dict[LinearObj, np.ndarray]:
770+
return self.source_quantity_dict_from(source_quantity=self.reconstruction_noise_map)
771771

772772
def regularization_weights_from(self, index: int) -> np.ndarray:
773773
linear_obj = self.linear_obj_list[index]

autoarray/inversion/inversion/interferometer/lop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ def log_det_curvature_reg_matrix_term(self):
142142
)
143143

144144
@property
145-
def errors(self):
145+
def reconstruction_noise_map(self):
146146
return None

autoarray/inversion/inversion/mapper_valued.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self, mapper, values, mesh_pixel_mask: Optional[np.ndarray] = None)
2929
The `Mapper` object which pairs with the values, for example a `MapperVoronoi` object.
3030
values
3131
The values of each pixel of the mapper, which could be the `reconstruction` values of an `Inversion`,
32-
but alternatively could be other quantities such as the errors on these values.
32+
but alternatively could be other quantities such as the noise-map of these values.
3333
mesh_pixel_mask
3434
The mask of pixels that are omitted from the reconstruction when computing the image, for example to
3535
remove pixels with low signal-to-noise so they do not impact the magnification calculation.

autoarray/inversion/mock/mock_inversion.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def __init__(
2525
reconstruction_dict: List[np.ndarray] = None,
2626
mapped_reconstructed_data_dict=None,
2727
mapped_reconstructed_image_dict=None,
28-
errors: np.ndarray = None,
29-
errors_dict: List[np.ndarray] = None,
28+
reconstruction_noise_map: np.ndarray = None,
29+
reconstruction_noise_map_dict: List[np.ndarray] = None,
3030
regularization_term=None,
3131
log_det_curvature_reg_matrix_term=None,
3232
log_det_regularization_matrix_term=None,
@@ -59,8 +59,8 @@ def __init__(
5959
self._mapped_reconstructed_data_dict = mapped_reconstructed_data_dict
6060
self._mapped_reconstructed_image_dict = mapped_reconstructed_image_dict
6161

62-
self._errors = errors
63-
self._errors_dict = errors_dict
62+
self._errors = reconstruction_noise_map
63+
self._errors_dict = reconstruction_noise_map_dict
6464

6565
self._regularization_term = regularization_term
6666
self._log_det_curvature_reg_matrix_term = log_det_curvature_reg_matrix_term
@@ -171,15 +171,15 @@ def mapped_reconstructed_image_dict(self):
171171
return self._mapped_reconstructed_image_dict
172172

173173
@property
174-
def errors(self):
174+
def reconstruction_noise_map(self):
175175
if self._errors is None:
176-
return super().errors
176+
return super().reconstruction_noise_map
177177
return self._errors
178178

179179
@property
180-
def errors_dict(self):
180+
def reconstruction_noise_map_dict(self):
181181
if self._errors_dict is None:
182-
return super().errors_dict
182+
return super().reconstruction_noise_map_dict
183183
return self._errors_dict
184184

185185
@property

autoarray/inversion/plot/inversion_plotters.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def figures_2d_of_pixelization(
121121
data_subtracted: bool = False,
122122
reconstructed_image: bool = False,
123123
reconstruction: bool = False,
124-
errors: bool = False,
124+
reconstruction_noise_map: bool = False,
125125
signal_to_noise_map: bool = False,
126126
regularization_weights: bool = False,
127127
sub_pixels_per_image_pixels: bool = False,
@@ -145,8 +145,8 @@ def figures_2d_of_pixelization(
145145
Whether to make a 2D plot (via `imshow`) of the mapper's reconstructed image data.
146146
reconstruction
147147
Whether to make a 2D plot (via `imshow` or `fill`) of the mapper's source-plane reconstruction.
148-
errors
149-
Whether to make a 2D plot (via `imshow` or `fill`) of the mapper's source-plane errors.
148+
reconstruction_noise_map
149+
Whether to make a 2D plot (via `imshow` or `fill`) of the mapper's source-plane noise-map.
150150
signal_to_noise_map
151151
Whether to make a 2D plot (via `imshow` or `fill`) of the mapper's source-plane signal-to-noise-map.
152152
sub_pixels_per_image_pixels
@@ -236,11 +236,11 @@ def figures_2d_of_pixelization(
236236
if vmax_custom:
237237
self.mat_plot_2d.cmap.kwargs["vmax"] = None
238238

239-
if errors:
239+
if reconstruction_noise_map:
240240
try:
241241
mapper_plotter.plot_source_from(
242-
pixel_values=self.inversion.errors_dict[mapper_plotter.mapper],
243-
auto_labels=AutoLabels(title="Errors", filename="errors"),
242+
pixel_values=self.inversion.reconstruction_noise_map_dict[mapper_plotter.mapper],
243+
auto_labels=AutoLabels(title="Noise Map", filename="reconstruction_noise_map"),
244244
)
245245

246246
except TypeError:
@@ -250,7 +250,7 @@ def figures_2d_of_pixelization(
250250
try:
251251
signal_to_noise_values = (
252252
self.inversion.reconstruction_dict[mapper_plotter.mapper]
253-
/ self.inversion.errors_dict[mapper_plotter.mapper]
253+
/ self.inversion.reconstruction_noise_map_dict[mapper_plotter.mapper]
254254
)
255255

256256
mapper_plotter.plot_source_from(
@@ -388,9 +388,9 @@ def subplot_of_mapper(
388388
)
389389
self.set_title(label=None)
390390

391-
self.set_title(label="Errors (Unzoomed)")
391+
self.set_title(label="Noise-Map (Unzoomed)")
392392
self.figures_2d_of_pixelization(
393-
pixelization_index=mapper_index, errors=True, zoom_to_brightest=False
393+
pixelization_index=mapper_index, reconstruction_noise_map=True, zoom_to_brightest=False
394394
)
395395

396396
self.set_title(label="Regularization Weights (Unzoomed)")

test_autoarray/inversion/inversion/test_abstract.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,12 @@ def test__determinant_of_positive_definite_matrix_via_cholesky():
631631
)
632632

633633

634-
def test__errors_and_errors_with_covariance():
634+
def test__reconstruction_noise_map():
635635
curvature_reg_matrix = np.array([[1.0, 1.0, 1.0], [1.0, 2.0, 1.0], [1.0, 1.0, 3.0]])
636636

637637
inversion = aa.m.MockInversion(curvature_reg_matrix=curvature_reg_matrix)
638638

639639
assert inversion.errors_with_covariance == pytest.approx(
640640
np.array([[2.5, -1.0, -0.5], [-1.0, 1.0, 0.0], [-0.5, 0.0, 0.5]]), 1.0e-2
641641
)
642-
assert inversion.errors == pytest.approx(np.array([2.5, 1.0, 0.5]), 1.0e-3)
642+
assert inversion.reconstruction_noise_map == pytest.approx(np.array([2.5, 1.0, 0.5]), 1.0e-3)

test_autoarray/inversion/plot/test_inversion_plotters.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ def test__individual_attributes_are_output_for_all_mappers(
3737
pixelization_index=0,
3838
reconstructed_image=True,
3939
reconstruction=True,
40-
errors=True,
40+
reconstruction_noise_map=True,
4141
regularization_weights=True,
4242
)
4343

4444
assert path.join(plot_path, "reconstructed_image.png") in plot_patch.paths
4545
assert path.join(plot_path, "reconstruction.png") in plot_patch.paths
46-
assert path.join(plot_path, "errors.png") in plot_patch.paths
46+
assert path.join(plot_path, "reconstruction_noise_map.png") in plot_patch.paths
4747
assert path.join(plot_path, "regularization_weights.png") in plot_patch.paths
4848

4949
pytest.importorskip(
@@ -66,7 +66,7 @@ def test__individual_attributes_are_output_for_all_mappers(
6666
sub_pixels_per_image_pixels=True,
6767
mesh_pixels_per_image_pixels=True,
6868
image_pixels_per_mesh_pixel=True,
69-
errors=True,
69+
reconstruction_noise_map=True,
7070
signal_to_noise_map=True,
7171
regularization_weights=True,
7272
)
@@ -76,7 +76,7 @@ def test__individual_attributes_are_output_for_all_mappers(
7676
assert path.join(plot_path, "sub_pixels_per_image_pixels.png") in plot_patch.paths
7777
assert path.join(plot_path, "mesh_pixels_per_image_pixels.png") in plot_patch.paths
7878
assert path.join(plot_path, "image_pixels_per_mesh_pixel.png") in plot_patch.paths
79-
assert path.join(plot_path, "errors.png") in plot_patch.paths
79+
assert path.join(plot_path, "reconstruction_noise_map.png") in plot_patch.paths
8080
assert path.join(plot_path, "signal_to_noise_map.png") in plot_patch.paths
8181
assert path.join(plot_path, "regularization_weights.png") in plot_patch.paths
8282

@@ -85,12 +85,12 @@ def test__individual_attributes_are_output_for_all_mappers(
8585
inversion_plotter.figures_2d_of_pixelization(
8686
pixelization_index=0,
8787
reconstructed_image=True,
88-
errors=True,
88+
reconstruction_noise_map=True,
8989
)
9090

9191
assert path.join(plot_path, "reconstructed_image.png") in plot_patch.paths
9292
assert path.join(plot_path, "reconstruction.png") not in plot_patch.paths
93-
assert path.join(plot_path, "errors.png") in plot_patch.paths
93+
assert path.join(plot_path, "reconstruction_noise_map.png") in plot_patch.paths
9494

9595

9696
def test__inversion_subplot_of_mapper__is_output_for_all_inversions(

0 commit comments

Comments
 (0)