From 387bcc1f4efd68933bfe244c6b14f8b235a47231 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Tue, 18 Mar 2025 18:24:18 +0000 Subject: [PATCH 1/5] add subplot enum classes --- autolens/aggregator/subplot.py | 77 ++++++++++++++++++++++++++++++++++ autolens/analysis/positions.py | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 autolens/aggregator/subplot.py diff --git a/autolens/aggregator/subplot.py b/autolens/aggregator/subplot.py new file mode 100644 index 000000000..0ea53d355 --- /dev/null +++ b/autolens/aggregator/subplot.py @@ -0,0 +1,77 @@ +from enum import Enum + + +class SubplotDataset(Enum): + """ + The subplots that can be extracted from the subplot_fit image. + + The values correspond to the position of the subplot in the 4x3 grid. + """ + + data = (0, 0) + data_log_10 = (1, 0) + noise_map = (2, 0) + psf = (0, 1) + psf_log_10 = (1, 1) + signal_to_noise_map = (2, 1) + over_sample_size_lp = (0, 2) + over_sample_size_pixelization = (1, 2) + + +class SubplotTracer(Enum): + """ + The subplots that can be extracted from the subplot_tracer image. + + The values correspond to the position of the subplot in the 3x3 grid. + """ + + image = (0, 0) + source_image = (1, 0) + source_plane_image = (2, 0) + lens_light_image = (1, 0) + convergence = (1, 1) + potential = (1, 2) + magnification = (0, 2) + deflections_y = (1, 2) + deflections_x = (2, 2) + +class SubplotFit(Enum): + """ + The subplots that can be extracted from the subplot_fit image. + + The values correspond to the position of the subplot in the 4x3 grid. + """ + + data = (0, 0) + data_source_scale = (1, 0) + signal_to_noise_map = (2, 0) + model_image = (3, 0) + lens_light_model = (1, 0) + lens_light_subtracted_image = (1, 1) + source_model_image = (1, 2) + source_plane_image_zoom = (1, 3) + normalized_residual_map = (2, 0) + normalized_residual_map_one_sigma = (2, 1) + chi_squared_map = (2, 2) + source_plane_image_zoom = (2, 3) + + +class SubplotFitLog10(Enum): + """ + The subplots that can be extracted from the subplot_fit image. + + The values correspond to the position of the subplot in the 4x3 grid. + """ + + data = (0, 0) + data_source_scale = (1, 0) + signal_to_noise_map = (2, 0) + model_image = (3, 0) + lens_light_model = (1, 0) + lens_light_subtracted_image = (1, 1) + source_model_image = (1, 2) + source_plane_image_zoom = (1, 3) + normalized_residual_map = (2, 0) + normalized_residual_map_one_sigma = (2, 1) + chi_squared_map = (2, 2) + source_plane_image_zoom = (2, 3) \ No newline at end of file diff --git a/autolens/analysis/positions.py b/autolens/analysis/positions.py index 76a791a92..90a7cfe84 100644 --- a/autolens/analysis/positions.py +++ b/autolens/analysis/positions.py @@ -61,7 +61,7 @@ def log_likelihood_function_positions_overwrite( def output_positions_info(self, output_path: str, tracer: Tracer): """ - Outputs a `positions.info` file which summarizes the positions penalty term for a model fit, including: + Outputs a `positions.info` file which summarises the positions penalty term for a model fit, including: - The arc second coordinates of the lensed source multiple images used for the model-fit. - The radial distance of these coordinates from (0.0, 0.0). From 0f0a3f13f23533b0bcfc51272bf0140eb337f8e6 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Tue, 18 Mar 2025 18:31:07 +0000 Subject: [PATCH 2/5] imports --- autolens/aggregator/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autolens/aggregator/__init__.py b/autolens/aggregator/__init__.py index 8ab42a0c8..600f199ac 100644 --- a/autolens/aggregator/__init__.py +++ b/autolens/aggregator/__init__.py @@ -21,3 +21,8 @@ from autogalaxy.aggregator.ellipse.fit_ellipse import FitEllipseAgg from autolens.aggregator.subhalo import SubhaloAgg + +from autolens.aggregator.subplot import SubplotDataset as subplot_dataset +from autolens.aggregator.subplot import SubplotTracer as subplot_tracer +from autolens.aggregator.subplot import SubplotFit as subplot_fit +from autolens.aggregator.subplot import SubplotFitLog10 as subplot_fit_log10 \ No newline at end of file From 75471ec6cbb157f4c207d1645377053b1ac4ca03 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Tue, 18 Mar 2025 18:40:44 +0000 Subject: [PATCH 3/5] fits enums --- autolens/aggregator/__init__.py | 4 +++- autolens/aggregator/subplot.py | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/autolens/aggregator/__init__.py b/autolens/aggregator/__init__.py index 600f199ac..16f7bef96 100644 --- a/autolens/aggregator/__init__.py +++ b/autolens/aggregator/__init__.py @@ -25,4 +25,6 @@ from autolens.aggregator.subplot import SubplotDataset as subplot_dataset from autolens.aggregator.subplot import SubplotTracer as subplot_tracer from autolens.aggregator.subplot import SubplotFit as subplot_fit -from autolens.aggregator.subplot import SubplotFitLog10 as subplot_fit_log10 \ No newline at end of file +from autolens.aggregator.subplot import SubplotFitLog10 as subplot_fit_log10 +from autolens.aggregator.subplot import TracerFITS as fit_tracer +from autolens.aggregator.subplot import FitFITS as fit_fits diff --git a/autolens/aggregator/subplot.py b/autolens/aggregator/subplot.py index 0ea53d355..0e1fed064 100644 --- a/autolens/aggregator/subplot.py +++ b/autolens/aggregator/subplot.py @@ -1,6 +1,30 @@ from enum import Enum +class TracerFITS(Enum): + """ + The HDUs that can be extracted from the fit.fits file. + """ + + convergence = "CONVERGENCE" + potential = "POTENTIAL" + deflections_y = "DEFLECTIONS_Y" + deflections_x = "DEFLECTIONS_X" + + + +class FitFITS(Enum): + """ + The HDUs that can be extracted from the fit.fits file. + """ + + model_image = "MODEL_IMAGE" + residual_map = "RESIDUAL_MAP" + normalized_residual_map = "NORMALIZED_RESIDUAL_MAP" + chi_squared_map = "CHI_SQUARED_MAP" + + + class SubplotDataset(Enum): """ The subplots that can be extracted from the subplot_fit image. From 41b7163c6dd518b1783a5063c5ce953cd42b16f7 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Tue, 18 Mar 2025 18:41:53 +0000 Subject: [PATCH 4/5] fits imports --- autolens/aggregator/__init__.py | 4 ++-- autolens/aggregator/subplot.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autolens/aggregator/__init__.py b/autolens/aggregator/__init__.py index 16f7bef96..b34e80ea5 100644 --- a/autolens/aggregator/__init__.py +++ b/autolens/aggregator/__init__.py @@ -26,5 +26,5 @@ from autolens.aggregator.subplot import SubplotTracer as subplot_tracer from autolens.aggregator.subplot import SubplotFit as subplot_fit from autolens.aggregator.subplot import SubplotFitLog10 as subplot_fit_log10 -from autolens.aggregator.subplot import TracerFITS as fit_tracer -from autolens.aggregator.subplot import FitFITS as fit_fits +from autolens.aggregator.subplot import FITSTracer as fits_tracer +from autolens.aggregator.subplot import FITSFit as fits_fits diff --git a/autolens/aggregator/subplot.py b/autolens/aggregator/subplot.py index 0e1fed064..49c9c423a 100644 --- a/autolens/aggregator/subplot.py +++ b/autolens/aggregator/subplot.py @@ -1,7 +1,7 @@ from enum import Enum -class TracerFITS(Enum): +class FITSTracer(Enum): """ The HDUs that can be extracted from the fit.fits file. """ @@ -13,7 +13,7 @@ class TracerFITS(Enum): -class FitFITS(Enum): +class FITSFit(Enum): """ The HDUs that can be extracted from the fit.fits file. """ From 235717dd1f6054d4248e4a37a8fcf10f35dac7a8 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Tue, 18 Mar 2025 19:45:05 +0000 Subject: [PATCH 5/5] extend eaggregator --- autolens/aggregator/fit_imaging.py | 1 - autolens/aggregator/fit_interferometer.py | 1 - autolens/aggregator/subplot.py | 7 +++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/autolens/aggregator/fit_imaging.py b/autolens/aggregator/fit_imaging.py index b750b12ef..97d98f105 100644 --- a/autolens/aggregator/fit_imaging.py +++ b/autolens/aggregator/fit_imaging.py @@ -67,7 +67,6 @@ def _fit_imaging_from( dataset_model_list, adapt_images_list, ): - fit_dataset_list.append( FitImaging( dataset=dataset, diff --git a/autolens/aggregator/fit_interferometer.py b/autolens/aggregator/fit_interferometer.py index 50c953c42..f0baf2729 100644 --- a/autolens/aggregator/fit_interferometer.py +++ b/autolens/aggregator/fit_interferometer.py @@ -69,7 +69,6 @@ def _fit_interferometer_from( dataset_model_list, adapt_images_list, ): - fit_dataset_list.append( FitInterferometer( dataset=dataset, diff --git a/autolens/aggregator/subplot.py b/autolens/aggregator/subplot.py index 49c9c423a..d8b0d948c 100644 --- a/autolens/aggregator/subplot.py +++ b/autolens/aggregator/subplot.py @@ -12,7 +12,6 @@ class FITSTracer(Enum): deflections_x = "DEFLECTIONS_X" - class FITSFit(Enum): """ The HDUs that can be extracted from the fit.fits file. @@ -24,7 +23,6 @@ class FITSFit(Enum): chi_squared_map = "CHI_SQUARED_MAP" - class SubplotDataset(Enum): """ The subplots that can be extracted from the subplot_fit image. @@ -59,6 +57,7 @@ class SubplotTracer(Enum): deflections_y = (1, 2) deflections_x = (2, 2) + class SubplotFit(Enum): """ The subplots that can be extracted from the subplot_fit image. @@ -77,7 +76,7 @@ class SubplotFit(Enum): normalized_residual_map = (2, 0) normalized_residual_map_one_sigma = (2, 1) chi_squared_map = (2, 2) - source_plane_image_zoom = (2, 3) + source_plane_image = (2, 3) class SubplotFitLog10(Enum): @@ -98,4 +97,4 @@ class SubplotFitLog10(Enum): normalized_residual_map = (2, 0) normalized_residual_map_one_sigma = (2, 1) chi_squared_map = (2, 2) - source_plane_image_zoom = (2, 3) \ No newline at end of file + source_plane_image = (2, 3)