Skip to content

Commit b93f511

Browse files
authored
Merge pull request #172 from Jammy2211/feature/zoom_array
Feature/zoom array
2 parents 23fc632 + c4bca0e commit b93f511

File tree

26 files changed

+594
-639
lines changed

26 files changed

+594
-639
lines changed

autoarray/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
from .mask.derive.mask_2d import DeriveMask2D
5454
from .mask.derive.grid_1d import DeriveGrid1D
5555
from .mask.derive.grid_2d import DeriveGrid2D
56+
from .mask.derive.zoom_2d import Zoom2D
5657
from .mask.mask_1d import Mask1D
5758
from .mask.mask_2d import Mask2D
5859
from .operators.convolver import Convolver

autoarray/config/visualize/general.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ general:
44
log10_min_value: 1.0e-4 # If negative values are being plotted on a log10 scale, values below this value are rounded up to it (e.g. to remove negative values).
55
log10_max_value: 1.0e99 # If positive values are being plotted on a log10 scale, values above this value are rounded down to it (e.g. to prevent white blobs).
66
zoom_around_mask: true # If True, plots of data structures with a mask automatically zoom in the masked region.
7-
disable_zoom_for_fits: true # If True, the zoom-in around the masked region is disabled when outputting .fits files, which is useful to retain the same dimensions as the input data.
87
inversion:
98
reconstruction_vmax_factor: 0.5
109
total_mappings_pixels : 8 # The number of source pixels used when plotting the subplot_mappings of a pixelization.

autoarray/config/visualize/plots.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# For example, if `plots: fit: subplot_fit=True``, the ``fit_dataset.png`` subplot file will
44
# be plotted every time visualization is performed.
55

6+
subplot_format: [png] # Output format of all subplots, can be png, pdf or both (e.g. [png, pdf])
7+
fits_are_zoomed: true # If true, output .fits files are zoomed in on the center of the unmasked region image, saving hard-disk space.
8+
69
dataset: # Settings for plots of all datasets (e.g. ImagingPlotter, InterferometerPlotter).
710
subplot_dataset: true # Plot subplot containing all dataset quantities (e.g. the data, noise-map, etc.)?
811
imaging: # Settings for plots of imaging datasets (e.g. ImagingPlotter)

autoarray/geometry/geometry_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def convert_pixel_scales_2d(pixel_scales: ty.PixelScales) -> Tuple[float, float]
182182

183183
@numba_util.jit()
184184
def central_pixel_coordinates_2d_from(
185-
shape_native: Tuple[int, int]
185+
shape_native: Tuple[int, int],
186186
) -> Tuple[float, float]:
187187
"""
188188
Returns the central pixel coordinates of a 2D geometry (and therefore a 2D data structure like an ``Array2D``)
@@ -737,7 +737,7 @@ def grid_pixel_centres_2d_from(
737737

738738

739739
def extent_symmetric_from(
740-
extent: Tuple[float, float, float, float]
740+
extent: Tuple[float, float, float, float],
741741
) -> Tuple[float, float, float, float]:
742742
"""
743743
Given an input extent of the form (x_min, x_max, y_min, y_max), this function returns an extent which is

autoarray/inversion/inversion/abstract.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,12 @@ def reconstruction(self) -> np.ndarray:
509509

510510
solutions = np.zeros(np.shape(self.curvature_reg_matrix)[0])
511511

512-
solutions[
513-
values_to_solve
514-
] = inversion_util.reconstruction_positive_only_from(
515-
data_vector=data_vector_input,
516-
curvature_reg_matrix=curvature_reg_matrix_input,
517-
settings=self.settings,
512+
solutions[values_to_solve] = (
513+
inversion_util.reconstruction_positive_only_from(
514+
data_vector=data_vector_input,
515+
curvature_reg_matrix=curvature_reg_matrix_input,
516+
settings=self.settings,
517+
)
518518
)
519519
return solutions
520520
else:

autoarray/inversion/inversion/imaging/abstract.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ def operated_mapping_matrix_list(self) -> List[np.ndarray]:
104104
"""
105105

106106
return [
107-
self.convolver.convolve_mapping_matrix(
108-
mapping_matrix=linear_obj.mapping_matrix
107+
(
108+
self.convolver.convolve_mapping_matrix(
109+
mapping_matrix=linear_obj.mapping_matrix
110+
)
111+
if linear_obj.operated_mapping_matrix_override is None
112+
else self.linear_func_operated_mapping_matrix_dict[linear_obj]
109113
)
110-
if linear_obj.operated_mapping_matrix_override is None
111-
else self.linear_func_operated_mapping_matrix_dict[linear_obj]
112114
for linear_obj in self.linear_obj_list
113115
]
114116

@@ -156,9 +158,9 @@ def linear_func_operated_mapping_matrix_dict(self) -> Dict:
156158
mapping_matrix=linear_func.mapping_matrix
157159
)
158160

159-
linear_func_operated_mapping_matrix_dict[
160-
linear_func
161-
] = operated_mapping_matrix
161+
linear_func_operated_mapping_matrix_dict[linear_func] = (
162+
operated_mapping_matrix
163+
)
162164

163165
return linear_func_operated_mapping_matrix_dict
164166

autoarray/inversion/pixelization/border_relocator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ def sub_border_pixel_slim_indexes_from(
117117
int(border_pixel)
118118
]
119119

120-
sub_border_pixels[
121-
border_1d_index
122-
] = grid_2d_util.furthest_grid_2d_slim_index_from(
123-
grid_2d_slim=sub_grid_2d_slim,
124-
slim_indexes=sub_border_pixels_of_border_pixel,
125-
coordinate=mask_centre,
120+
sub_border_pixels[border_1d_index] = (
121+
grid_2d_util.furthest_grid_2d_slim_index_from(
122+
grid_2d_slim=sub_grid_2d_slim,
123+
slim_indexes=sub_border_pixels_of_border_pixel,
124+
coordinate=mask_centre,
125+
)
126126
)
127127

128128
return sub_border_pixels

autoarray/inversion/pixelization/mesh/mesh_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
@numba_util.jit()
99
def rectangular_neighbors_from(
10-
shape_native: Tuple[int, int]
10+
shape_native: Tuple[int, int],
1111
) -> Tuple[np.ndarray, np.ndarray]:
1212
"""
1313
Returns the 4 (or less) adjacent neighbors of every pixel on a rectangular pixelization as an ndarray of shape

autoarray/inversion/plot/inversion_plotters.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,9 @@ def figures_2d_of_pixelization(
215215
"inversion"
216216
]["reconstruction_vmax_factor"]
217217

218-
self.mat_plot_2d.cmap.kwargs[
219-
"vmax"
220-
] = reconstruction_vmax_factor * np.max(
221-
self.inversion.reconstruction
218+
self.mat_plot_2d.cmap.kwargs["vmax"] = (
219+
reconstruction_vmax_factor
220+
* np.max(self.inversion.reconstruction)
222221
)
223222
vmax_custom = True
224223

0 commit comments

Comments
 (0)