From f62c9581ab78472dc4c559eef3637d57219a9c63 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Tue, 30 Jan 2024 17:33:25 +0000 Subject: [PATCH 1/2] rename subtracted_signal_to_noise_map_of_galaxies --- autolens/imaging/fit_imaging.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/autolens/imaging/fit_imaging.py b/autolens/imaging/fit_imaging.py index 7aacf2aaf..b7f601fda 100644 --- a/autolens/imaging/fit_imaging.py +++ b/autolens/imaging/fit_imaging.py @@ -205,6 +205,25 @@ def subtracted_images_of_galaxies_dict(self) -> Dict[ag.Galaxy, np.ndarray]: return subtracted_images_of_galaxies_dict + @property + def subtracted_signal_to_noise_maps_of_galaxies_dict(self) -> Dict[ag.Galaxy, np.ndarray]: + """ + A dictionary which associates every galaxy in the tracer with its `subtracted image`. + + A subtracted image of a galaxy is the data where all other galaxy images are subtracted from it, therefore + showing how a galaxy appears in the data in the absence of all other galaxies. + + This is used to visualize the contribution of each galaxy in the data. + """ + + subtracted_signal_to_noise_maps_of_galaxies_dict = {} + + for (galaxy, subtracted_image) in self.subtracted_images_of_galaxies_dict.items(): + + subtracted_signal_to_noise_maps_of_galaxies_dict[galaxy] = subtracted_image / self.noise_map + + return subtracted_signal_to_noise_maps_of_galaxies_dict + @property def model_images_of_planes_list(self) -> List[aa.Array2D]: """ From e8ce0b48d6658ab28d9dd80f429b726d88caf22a Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Thu, 1 Feb 2024 18:32:41 +0000 Subject: [PATCH 2/2] fix interferometer adapt_images --- autolens/interferometer/model/result.py | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/autolens/interferometer/model/result.py b/autolens/interferometer/model/result.py index 3edb5dd3a..a4a893671 100644 --- a/autolens/interferometer/model/result.py +++ b/autolens/interferometer/model/result.py @@ -3,6 +3,7 @@ import autoarray as aa import autogalaxy as ag +from autogalaxy.analysis.adapt_images import AdaptImages from autolens.lens.ray_tracing import Tracer from autolens.interferometer.fit_interferometer import FitInterferometer from autolens.analysis.result import ResultDataset @@ -67,3 +68,29 @@ def real_space_mask(self) -> aa.Mask2D: The real space mask used by this model-fit. """ return self.max_log_likelihood_fit.dataset.real_space_mask + + def adapt_images_from(self, use_model_images : bool = False) -> AdaptImages: + """ + Returns the adapt-images which are used to make a pixelization's mesh and regularization adapt to the + reconstructed galaxy's morphology. + + This can use either: + + - The model image of each galaxy in the best-fit model. + - The subtracted image of each galaxy in the best-fit model, where the subtracted image is the dataset + minus the model images of all other galaxies. + + In **PyAutoLens** these adapt images have had lensing calculations performed on them and therefore for source + galaxies are their lensed model images in the image-plane. + + Parameters + ---------- + use_model_images + If True, the model images of the galaxies are used to create the adapt images. If False, the subtracted + images of the galaxies are used. + """ + + return AdaptImages.from_result( + result=self, + use_model_images=True + ) \ No newline at end of file