-
Notifications
You must be signed in to change notification settings - Fork 14
Feature/mesh refactor #281
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,7 +33,7 @@ def _fit_ellipse_from( | |||||||
| is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of | ||||||||
| `FitEllipse` objects. | ||||||||
|
|
||||||||
| The settings of an inversion can be overwritten by inputting a `settings_inversion` object, for example | ||||||||
| The settings of an inversion can be overwritten by inputting a `settings` object, for example | ||||||||
| if you want to use a grid with a different inversion solver. | ||||||||
|
|
||||||||
|
Comment on lines
+36
to
38
|
||||||||
| The settings of an inversion can be overwritten by inputting a `settings` object, for example | |
| if you want to use a grid with a different inversion solver. | |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |||||||||||||||||||||||||||
| def _fit_imaging_from( | ||||||||||||||||||||||||||||
| fit: af.Fit, | ||||||||||||||||||||||||||||
| instance: Optional[af.ModelInstance] = None, | ||||||||||||||||||||||||||||
| settings_inversion: aa.SettingsInversion = None, | ||||||||||||||||||||||||||||
| settings: aa.Settings = None, | ||||||||||||||||||||||||||||
| ) -> List[FitImaging]: | ||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||
| Returns a list of `FitImaging` objects from a `PyAutoFit` loaded directory `Fit` or sqlite database `Fit` object. | ||||||||||||||||||||||||||||
|
|
@@ -26,7 +26,7 @@ def _fit_imaging_from( | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - The imaging data, noise-map, PSF and settings as .fits files (e.g. `dataset/data.fits`). | ||||||||||||||||||||||||||||
| - The mask used to mask the `Imaging` data structure in the fit (`dataset.fits[hdu=0]`). | ||||||||||||||||||||||||||||
| - The settings of inversions used by the fit (`dataset/settings_inversion.json`). | ||||||||||||||||||||||||||||
| - The settings of inversions used by the fit (`dataset/settings.json`). | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Each individual attribute can be loaded from the database via the `fit.value()` method. | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
@@ -37,7 +37,7 @@ def _fit_imaging_from( | |||||||||||||||||||||||||||
| is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of | ||||||||||||||||||||||||||||
| `FitImaging` objects. | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| The settings of an inversion can be overwritten by inputting a `settings_inversion` object, for example | ||||||||||||||||||||||||||||
| The settings of an inversion can be overwritten by inputting a `settings` object, for example | ||||||||||||||||||||||||||||
| if you want to use a grid with a different inversion solver. | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Parameters | ||||||||||||||||||||||||||||
|
|
@@ -48,8 +48,8 @@ def _fit_imaging_from( | |||||||||||||||||||||||||||
| instance | ||||||||||||||||||||||||||||
| A manual instance that overwrites the max log likelihood instance in fit (e.g. for drawing the instance | ||||||||||||||||||||||||||||
| randomly from the PDF). | ||||||||||||||||||||||||||||
| settings_inversion | ||||||||||||||||||||||||||||
| Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit. | ||||||||||||||||||||||||||||
| settings | ||||||||||||||||||||||||||||
| Optionally overwrite the `Settings` of the `Inversion` object that is created from the fit. | ||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| from autogalaxy.imaging.fit_imaging import FitImaging | ||||||||||||||||||||||||||||
|
|
@@ -62,7 +62,7 @@ def _fit_imaging_from( | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| adapt_images_list = agg_util.adapt_images_from(fit=fit) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| settings_inversion = settings_inversion or fit.value(name="settings_inversion") | ||||||||||||||||||||||||||||
| settings = settings or fit.value(name="settings") | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
Comment on lines
+65
to
66
|
||||||||||||||||||||||||||||
| settings = settings or fit.value(name="settings") | |
| if settings is None: | |
| try: | |
| settings = fit.value(name="settings") | |
| except (KeyError, AttributeError): | |
| settings = None | |
| if settings is None: | |
| try: | |
| settings = fit.value(name="settings_inversion") | |
| except (KeyError, AttributeError): | |
| settings = None |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |||||||||||||||||||||||||||
| def _fit_interferometer_from( | ||||||||||||||||||||||||||||
| fit: af.Fit, | ||||||||||||||||||||||||||||
| instance: Optional[af.ModelInstance] = None, | ||||||||||||||||||||||||||||
| settings_inversion: aa.SettingsInversion = None, | ||||||||||||||||||||||||||||
| settings: aa.Settings = None, | ||||||||||||||||||||||||||||
| ) -> List[FitInterferometer]: | ||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||
| Returns a list of `FitInterferometer` objects from a `PyAutoFit` loaded directory `Fit` or sqlite database `Fit` object. | ||||||||||||||||||||||||||||
|
|
@@ -26,7 +26,7 @@ def _fit_interferometer_from( | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - The interferometer data, noise-map, uv-wavelengths and settings as .fits files (e.g. `dataset/data.fits`). | ||||||||||||||||||||||||||||
| - The real space mask defining the grid of the interferometer for the FFT (`dataset/real_space_mask.fits`). | ||||||||||||||||||||||||||||
| - The settings of inversions used by the fit (`dataset/settings_inversion.json`). | ||||||||||||||||||||||||||||
| - The settings of inversions used by the fit (`dataset/settings.json`). | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Each individual attribute can be loaded from the database via the `fit.value()` method. | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
@@ -38,7 +38,7 @@ def _fit_interferometer_from( | |||||||||||||||||||||||||||
| method is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of | ||||||||||||||||||||||||||||
| `FitInterferometer` objects. | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| The settings of an inversion can be overwritten by inputting a `settings_inversion` object, for | ||||||||||||||||||||||||||||
| The settings of an inversion can be overwritten by inputting a `settings` object, for | ||||||||||||||||||||||||||||
| example if you want to use a grid with a different inversion solver. | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Parameters | ||||||||||||||||||||||||||||
|
|
@@ -49,8 +49,8 @@ def _fit_interferometer_from( | |||||||||||||||||||||||||||
| instance | ||||||||||||||||||||||||||||
| A manual instance that overwrites the max log likelihood instance in fit (e.g. for drawing the instance | ||||||||||||||||||||||||||||
| randomly from the PDF). | ||||||||||||||||||||||||||||
| settings_inversion | ||||||||||||||||||||||||||||
| Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit. | ||||||||||||||||||||||||||||
| settings | ||||||||||||||||||||||||||||
| Optionally overwrite the `Settings` of the `Inversion` object that is created from the fit. | ||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||
| from autogalaxy.interferometer.fit_interferometer import FitInterferometer | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
@@ -64,7 +64,7 @@ def _fit_interferometer_from( | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| adapt_images_list = agg_util.adapt_images_from(fit=fit) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| settings_inversion = settings_inversion or fit.value(name="settings_inversion") | ||||||||||||||||||||||||||||
| settings = settings or fit.value(name="settings") | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
Comment on lines
+67
to
68
|
||||||||||||||||||||||||||||
| settings = settings or fit.value(name="settings") | |
| if settings is None: | |
| try: | |
| settings = fit.value(name="settings") | |
| except (KeyError, AttributeError): | |
| settings = None | |
| if settings is None: | |
| try: | |
| settings = fit.value(name="settings_inversion") | |
| except (KeyError, AttributeError): | |
| settings = None |
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.
AbstractFitInversion.__init__acceptssettingsbut the implementation allowsNone(settings or aa.Settings()). The type annotation should beOptional[aa.Settings](and ideally the signature should defaultsettingstoNone) to match actual usage from callers likeFitImaging/FitInterferometer.