Skip to content

Commit 0ec1493

Browse files
Jammy2211Jammy2211
authored andcommitted
Merge branch 'main' into feature/jax_wrapper
2 parents 7290b93 + cbeca2e commit 0ec1493

9 files changed

Lines changed: 28 additions & 21 deletions

File tree

autolens/aggregator/subplot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class FITSFit(Enum):
1717
The HDUs that can be extracted from the fit.fits file.
1818
"""
1919

20-
model_image = "MODEL_IMAGE"
20+
model_data = "MODEL_DATA"
2121
residual_map = "RESIDUAL_MAP"
2222
normalized_residual_map = "NORMALIZED_RESIDUAL_MAP"
2323
chi_squared_map = "CHI_SQUARED_MAP"
@@ -68,7 +68,7 @@ class SubplotFit(Enum):
6868
data = (0, 0)
6969
data_source_scale = (1, 0)
7070
signal_to_noise_map = (2, 0)
71-
model_image = (3, 0)
71+
model_data = (3, 0)
7272
lens_light_model = (1, 0)
7373
lens_light_subtracted_image = (1, 1)
7474
source_model_image = (1, 2)
@@ -89,7 +89,7 @@ class SubplotFitLog10(Enum):
8989
data = (0, 0)
9090
data_source_scale = (1, 0)
9191
signal_to_noise_map = (2, 0)
92-
model_image = (3, 0)
92+
model_data = (3, 0)
9393
lens_light_model = (1, 0)
9494
lens_light_subtracted_image = (1, 1)
9595
source_model_image = (1, 2)

autolens/analysis/plotter_interface.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,20 @@ def should_plot(name):
6565
tracer_plotter.subplot_galaxies_images()
6666

6767
if should_plot("fits_tracer"):
68+
69+
zoom = aa.Zoom2D(mask=grid.mask)
70+
mask = zoom.mask_2d_from(buffer=1)
71+
grid_zoom = aa.Grid2D.from_mask(mask=mask)
72+
73+
image_list = [
74+
tracer.convergence_2d_from(grid=grid_zoom).native,
75+
tracer.potential_2d_from(grid=grid_zoom).native,
76+
tracer.deflections_yx_2d_from(grid=grid_zoom).native[:, :, 0],
77+
tracer.deflections_yx_2d_from(grid=grid_zoom).native[:, :, 1],
78+
]
79+
6880
hdu_list = hdu_list_for_output_from(
69-
values_list=[
70-
grid.mask.astype("float"),
71-
tracer.convergence_2d_from(grid=grid).native,
72-
tracer.potential_2d_from(grid=grid).native,
73-
tracer.deflections_yx_2d_from(grid=grid).native[:, :, 0],
74-
tracer.deflections_yx_2d_from(grid=grid).native[:, :, 1],
75-
],
81+
values_list=[image_list[0].mask.astype("float")] + image_list,
7682
ext_name_list=[
7783
"mask",
7884
"convergence",

autolens/config/visualize/plots.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tracer: # Settings for plots of tracers (e.g.
3838
inversion: # Settings for plots of inversions (e.g. InversionPlotter).
3939
subplot_inversion: true # Plot subplot of all quantities in each inversion (e.g. reconstrucuted image, reconstruction)?
4040
subplot_mappings: true # Plot subplot of the image-to-source pixels mappings of each pixelization?
41-
fits_reconstruction: false # output reconstruction.fits containing the reconstructed pixelization and noise map on the adaptive mesh?
41+
csv_reconstruction: false # output reconstruction.csv containing the source-plane mesh y, x, reconstruction and noise map values.
4242

4343
adapt: # Settings for plots of adapt images used by adaptive pixelizations.
4444
subplot_adapt_images: true # Plot subplot showing each adapt image used for adaptive pixelization?

autolens/imaging/model/visualizer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ def visualize(
102102

103103
tracer = fit.tracer_linear_light_profiles_to_light_profiles
104104

105-
extent = fit.data.extent_of_zoomed_array(buffer=0)
106-
shape_native = fit.data.zoomed_around_mask(buffer=0).shape_native
105+
zoom = ag.Zoom2D(mask=fit.mask)
106+
107+
extent = zoom.extent_from(buffer=0)
108+
shape_native = zoom.shape_native
107109

108110
grid = ag.Grid2D.from_extent(extent=extent, shape_native=shape_native)
109111

autolens/imaging/plot/fit_imaging_plotters.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,11 @@ def tracer_plotter(self) -> TracerPlotter:
8080
Returns an `TracerPlotter` corresponding to the `Tracer` in the `FitImaging`.
8181
"""
8282

83-
extent = self.fit.data.extent_of_zoomed_array(buffer=0)
84-
shape_native = self.fit.data.zoomed_around_mask(buffer=0).shape_native
83+
zoom = aa.Zoom2D(mask=self.fit.mask)
8584

8685
grid = aa.Grid2D.from_extent(
87-
extent=extent,
88-
shape_native=shape_native
86+
extent=zoom.extent_from(buffer=0),
87+
shape_native=zoom.shape_native
8988
)
9089

9190
return TracerPlotter(

test_autolens/analysis/test_plotter_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test__tracer(
3333
file_path=path.join(plot_path, "tracer.fits"), hdu=0
3434
)
3535

36-
assert image.shape == (7, 7)
36+
assert image.shape == (5, 5)
3737

3838

3939
def test__image_with_positions(

test_autolens/imaging/model/test_plotter_interface_imaging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ def test__fit_imaging(
3434
file_path=path.join(plot_path, "fit.fits"), hdu=0
3535
)
3636

37-
assert image.shape == (7, 7)
37+
assert image.shape == (5, 5)
3838

3939
image = al.ndarray_via_fits_from(
4040
file_path=path.join(plot_path, "model_galaxy_images.fits"), hdu=0
4141
)
4242

43-
assert image.shape == (7, 7)
43+
assert image.shape == (5, 5)
4444

4545
def test__fit_imaging_combined(
4646
fit_imaging_x2_plane_inversion_7x7, plot_path, plot_patch
203 KB
Binary file not shown.

test_autolens/interferometer/model/test_plotter_interface_interferometer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test__fit_interferometer(
3636
file_path=path.join(plot_path, "model_galaxy_images.fits"), hdu=0
3737
)
3838

39-
assert image.shape == (7, 7)
39+
assert image.shape == (5, 5)
4040

4141
image = al.ndarray_via_fits_from(
4242
file_path=path.join(plot_path, "dirty_images.fits"), hdu=0

0 commit comments

Comments
 (0)