-
Notifications
You must be signed in to change notification settings - Fork 14
Feature/unconvolved images #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |
| # These can be disabled to save on hard-disk space but will lead to certain database functionality being disabled. | ||
|
|
||
| subplot_format: [png] # Output format of all subplots, can be png, pdf or both (e.g. [png, pdf]) | ||
| fits_are_zoomed: true # If true, output .fits files are zoomed in on the center of the unmasked region image, saving hard-disk space. | ||
| fits_are_zoomed: false # If true, output .fits files are zoomed in on the center of the unmasked region image, saving hard-disk space. | ||
|
||
|
|
||
| dataset: # Settings for plots of all datasets (e.g. ImagingPlotter, InterferometerPlotter). | ||
| subplot_dataset: true # Plot subplot containing all dataset quantities (e.g. the data, noise-map, etc.)? | ||
|
|
@@ -23,7 +23,8 @@ fit: # Settings for plots of all fits (e.g | |
| subplot_of_galaxies: false # Plot subplot of the model-image, subtracted image and other quantities of each galaxy? | ||
| subplot_galaxy_images: false # Plot subplot of the image of each galaxy in the model? | ||
| fits_fit: false # Output a .fits file containing the fit model data, residual map, normalized residual map and chi-squared? | ||
| fits_model_galaxy_images : false # Output a .fits file containing the model images of every galaxy? | ||
| fits_galaxy_images : false # Output a .fits file containing the images (e.g. without PSF convolution) of every galaxy? | ||
| fits_model_galaxy_images : false # Output a .fits file containing the model images (e.g. with PSF convolution) of every galaxy? | ||
|
|
||
| fit_imaging: {} # Settings for plots of fits to imaging datasets (e.g. FitImagingPlotter). | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,22 @@ def fits_to_fits( | |
|
|
||
| hdu_list.writeto(image_path / "fit.fits", overwrite=True) | ||
|
|
||
| if should_plot("fits_galaxy_images"): | ||
| number_plots = len(fit.galaxy_image_dict.keys()) + 1 | ||
|
|
||
| image_list = [image.native_for_fits for image in fit.galaxy_image_dict.values()] | ||
|
|
||
| hdu_list = hdu_list_for_output_from( | ||
| values_list=[image_list[0].mask.astype("float")] + image_list, | ||
| ext_name_list=[ | ||
| "mask", | ||
| ] | ||
| + [f"galaxy_{i}" for i in range(number_plots)], | ||
| header_dict=fit.mask.header_dict, | ||
| ) | ||
|
Comment on lines
+63
to
+75
|
||
|
|
||
| hdu_list.writeto(image_path / "galaxy_images.fits", overwrite=True) | ||
|
|
||
| if should_plot("fits_model_galaxy_images"): | ||
| number_plots = len(fit.galaxy_model_image_dict.keys()) + 1 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,12 +139,15 @@ def model_data(self) -> aa.Visibilities: | |
| """ | ||
|
|
||
| if self.perform_inversion: | ||
| return self.profile_visibilities + self.inversion.mapped_reconstructed_data | ||
| return ( | ||
| self.profile_visibilities | ||
| + self.inversion.mapped_reconstructed_operated_data | ||
| ) | ||
|
|
||
| return self.profile_visibilities | ||
|
|
||
| @property | ||
| def galaxy_model_image_dict(self) -> Dict[Galaxy, np.ndarray]: | ||
| def galaxy_image_dict(self) -> Dict[Galaxy, np.ndarray]: | ||
| """ | ||
| A dictionary which associates every galaxy with its `image`. | ||
|
Comment on lines
149
to
152
|
||
|
|
||
|
|
@@ -157,15 +160,13 @@ def galaxy_model_image_dict(self) -> Dict[Galaxy, np.ndarray]: | |
| For modeling, this dictionary is used to set up the `adapt_images` that adapt certain pixelizations to the | ||
| data being fitted. | ||
| """ | ||
| galaxy_model_image_dict = self.galaxies.galaxy_image_2d_dict_from( | ||
| grid=self.grids.lp | ||
| ) | ||
| galaxy_image_dict = self.galaxies.galaxy_image_2d_dict_from(grid=self.grids.lp) | ||
|
|
||
| galaxy_linear_obj_image_dict = self.galaxy_linear_obj_data_dict_from( | ||
| use_image=True | ||
| use_operated=False | ||
| ) | ||
|
|
||
| return {**galaxy_model_image_dict, **galaxy_linear_obj_image_dict} | ||
| return {**galaxy_image_dict, **galaxy_linear_obj_image_dict} | ||
|
|
||
| @property | ||
| def galaxy_model_visibilities_dict(self) -> Dict[Galaxy, np.ndarray]: | ||
|
|
@@ -186,7 +187,7 @@ def galaxy_model_visibilities_dict(self) -> Dict[Galaxy, np.ndarray]: | |
| ) | ||
|
|
||
| galaxy_linear_obj_data_dict = self.galaxy_linear_obj_data_dict_from( | ||
| use_image=False | ||
| use_operated=True | ||
| ) | ||
|
|
||
| return {**galaxy_model_visibilities_dict, **galaxy_linear_obj_data_dict} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring describing
use_operated=Truesays the operated output is a “real-space image for interferometer data”, but in this refactormapped_reconstructed_operated_datacorresponds to the data after applying the operator (e.g. visibilities for interferometer, PSF-convolved image for imaging), as reflected by updated tests. Please update the docstring example for interferometer to avoid inverting the meaning of “operated”.