Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
ba4b4b5
jax wrapper
Jammy2211 Apr 29, 2024
06ed3cb
Merge branch 'main' into feature/jax_wrapper
Jammy2211 Jun 4, 2024
75bbca6
fix test (once conf merged)
rhayes777 Jun 10, 2024
d93a5cc
hack-around to get jax script running
rhayes777 Jun 10, 2024
252ecfd
revert array casting change
rhayes777 Jun 10, 2024
7f0bcec
merge
Jammy2211 Jun 25, 2024
044febb
When using JAX don't import Numpy
CKrawczyk Jun 28, 2024
218d500
gMerge branch 'main' into feature/jax_wrapper
Jammy2211 Jul 19, 2024
ad84a98
merge main
Jammy2211 Jul 19, 2024
2f836de
Merge pull request #180 from Jammy2211/feature/jaxify_geometry_profiles
CKrawczyk Aug 6, 2024
9a477fb
merge
rhayes777 Aug 12, 2024
9444b1e
numpy to jax wrapper conversion
rhayes777 Aug 12, 2024
17ee713
Merge branch 'main' into feature/jax_wrapper
rhayes777 Aug 23, 2024
5e30644
Jax version of MGE Sersic profile
CKrawczyk Sep 18, 2024
3210f4f
Update isothermal and power law profiles to play nice at (0, 0)
CKrawczyk Sep 18, 2024
f8418bd
Merge branch 'main' into feature/jax_wrapper
rhayes777 Sep 30, 2024
32e491c
Small fixes
CKrawczyk Oct 3, 2024
e6540a2
Merge branch 'feature/jax_wrapper' into feature/jaxify_geometry_profiles
CKrawczyk Oct 3, 2024
68d3371
Update mge_numpy.py
CKrawczyk Oct 3, 2024
0e97b8a
Merge pull request #196 from Jammy2211/feature/jaxify_geometry_profiles
CKrawczyk Oct 3, 2024
cec8dee
Merge branch 'main' into feature/jax_wrapper
Jammy2211 Oct 3, 2024
f7600b3
removed preloads
Jammy2211 Oct 3, 2024
9cd4e70
black
Jammy2211 Oct 3, 2024
c322507
restore fit_from
Jammy2211 Oct 3, 2024
033fc09
Update Faddeeva function
CKrawczyk Oct 25, 2024
7da67fe
Merge pull request #197 from Jammy2211/feature/jax_remove_preload
Jammy2211 Oct 25, 2024
ed7c379
Merge branch 'feature/jax_wrapper' into main
Jammy2211 Oct 25, 2024
6c1f19e
Merge pull request #201 from Jammy2211/main
Jammy2211 Oct 25, 2024
b6d157c
Update functions for Tracer to be jax safe
CKrawczyk Oct 25, 2024
686ddad
Revert "Main to JAX"
Jammy2211 Oct 25, 2024
d199bc3
Merge pull request #203 from Jammy2211/revert-201-main
Jammy2211 Oct 25, 2024
860d142
Revert "Revert "Main to JAX""
Jammy2211 Oct 25, 2024
8e4d556
Merge pull request #205 from Jammy2211/revert-203-revert-201-main
Jammy2211 Oct 25, 2024
e591a26
Merge pull request #202 from Jammy2211/feature/jax_tracer
CKrawczyk Oct 25, 2024
8dc5e47
Merge branch 'feature/jax_wrapper' into feature/update_faddeeva_function
CKrawczyk Oct 25, 2024
01b1742
Merge pull request #200 from Jammy2211/feature/update_faddeeva_function
CKrawczyk Oct 25, 2024
8d82399
Use auto diff to get at jacobian of deflection angles
CKrawczyk Oct 25, 2024
758acbb
Merge pull request #206 from Jammy2211/feature/jax_jacobian
CKrawczyk Oct 25, 2024
f5b24a0
Calculate critical curves using JAX
CKrawczyk Nov 4, 2024
da3d13c
Merge pull request #207 from Jammy2211/feature/jax_critical_curves
CKrawczyk Nov 4, 2024
5e8a273
config changes
Jammy2211 Jan 22, 2025
2b5b461
Merge branch 'main' into feature/jax_merge
Jammy2211 Jan 22, 2025
7f16637
merge complete
Jammy2211 Jan 22, 2025
df9f901
merge more changes from main
Jammy2211 Jan 22, 2025
525b7de
more changes
Jammy2211 Jan 22, 2025
a35e209
minor
Jammy2211 Mar 13, 2025
bb79b1e
Merge branch 'main' into feature/jax_merge
Jammy2211 Mar 13, 2025
cb2f01c
Merge pull request #215 from Jammy2211/feature/jax_merge
Jammy2211 Mar 13, 2025
904683b
resolve conflicts
Jammy2211 Mar 13, 2025
9281c4d
updates to fix unit tests
Jammy2211 Apr 2, 2025
58cf1f1
Merge branch 'main' into feature/jax_wrapper
Jammy2211 Apr 2, 2025
dc7f1e1
remove convolver for psf
Jammy2211 Apr 2, 2025
545fc09
black
Jammy2211 Apr 2, 2025
fa34dba
Merge pull request #223 from Jammy2211/feature/remove_convolver
Jammy2211 Apr 3, 2025
82622f7
remove grid relocate radial
Jammy2211 Apr 3, 2025
2ace7ea
pylops docs remove
Jammy2211 Apr 4, 2025
092f7be
fix test_convert with absolution pytest error
Jammy2211 Apr 5, 2025
ae60599
geometry profile tests pass
Jammy2211 Apr 5, 2025
e54fbc6
delete test_radial_minima.py
Jammy2211 Apr 5, 2025
a6cb5b8
fixes to geometry profiles when testing light profiles
Jammy2211 Apr 5, 2025
ac4878e
fix test_sersic_core
Jammy2211 Apr 5, 2025
286f3fc
fix test sersic
Jammy2211 Apr 5, 2025
0a8e295
fix test moffat
Jammy2211 Apr 5, 2025
166eacc
test_gaussian fixed
Jammy2211 Apr 5, 2025
f2661e6
exponential and dev vauc
Jammy2211 Apr 5, 2025
8f15844
eff profile
Jammy2211 Apr 5, 2025
72090ad
chameoleon
Jammy2211 Apr 5, 2025
109c166
fix a standard light profile test by altering autoarray
Jammy2211 Apr 5, 2025
c64fff3
luminsoity caslculation uses ArrayIrregular
Jammy2211 Apr 5, 2025
cc5f307
fix decorator tests
Jammy2211 Apr 5, 2025
f3171fc
fix polar shapelets
Jammy2211 Apr 5, 2025
2e661b3
fix exponmential shjapelet
Jammy2211 Apr 5, 2025
01cef19
shapelet cartesian
Jammy2211 Apr 5, 2025
a563bd0
linear light profile tests
Jammy2211 Apr 5, 2025
b73c3bd
fix some of isothermal;
Jammy2211 Apr 5, 2025
fe9d3ae
fix power law core
Jammy2211 Apr 5, 2025
97761e3
fix test isothermal
Jammy2211 Apr 5, 2025
9959e74
test_isothermal_cored
Jammy2211 Apr 5, 2025
db07da1
test_power_law
Jammy2211 Apr 5, 2025
016647f
test_power_law_broken
Jammy2211 Apr 5, 2025
c786653
power_law_multopole
Jammy2211 Apr 5, 2025
b9afe00
test abstract mass
Jammy2211 Apr 5, 2025
1dfa76c
sorted out some of mass sheets
Jammy2211 Apr 5, 2025
6aba0b2
fixes to operate deflections
Jammy2211 Apr 6, 2025
8468808
more operate tests pass
Jammy2211 Apr 6, 2025
353bf56
removing evluation gris
Jammy2211 Apr 6, 2025
42728fa
all deflections test passes
Jammy2211 Apr 6, 2025
a9f1a26
remove input delections
Jammy2211 Apr 6, 2025
bbe7a97
fix all mass_sheets
Jammy2211 Apr 6, 2025
c2eda8a
point mass
Jammy2211 Apr 6, 2025
8910f94
serisc radial gradient sorted
Jammy2211 Apr 6, 2025
7d0a358
sersic gradient tests pass
Jammy2211 Apr 6, 2025
9d1f0ff
seris ctestd fixed escept one
Jammy2211 Apr 6, 2025
788e57e
gaussian tests mass prass
Jammy2211 Apr 6, 2025
d9989fa
yest chameialeon
Jammy2211 Apr 6, 2025
187a291
stellar tests pass
Jammy2211 Apr 7, 2025
fb082a1
all mass profiles pass except dark
Jammy2211 Apr 7, 2025
a967fbb
NFW tests pass
Jammy2211 Apr 7, 2025
fd8b550
test_light_and_mass_profiles
Jammy2211 Apr 7, 2025
a1b5905
remove annoying stuff
Jammy2211 Apr 7, 2025
7552c5b
test_image operate all pass
Jammy2211 Apr 7, 2025
b25638c
all test_Galaxy passes
Jammy2211 Apr 7, 2025
c0920c7
test_galaxies
Jammy2211 Apr 7, 2025
01df7b7
test_stellar_dark_Decomp
Jammy2211 Apr 7, 2025
8c290aa
galaxy plottes
Jammy2211 Apr 7, 2025
f4855bb
all of test_to_inversion passes
Jammy2211 Apr 7, 2025
5725dd7
fix another test
Jammy2211 Apr 7, 2025
e1aa7bf
fix test_fit_imaging
Jammy2211 Apr 7, 2025
5595d07
test_fit_interferometger
Jammy2211 Apr 7, 2025
a24aa18
test_simulator
Jammy2211 Apr 7, 2025
0ff3798
test_simulate_and_fit_imaging.py
Jammy2211 Apr 8, 2025
3cc37ef
tesyt_result_imaging
Jammy2211 Apr 8, 2025
fe3e9ed
test_simulate_and_fit_interferometer.py
Jammy2211 Apr 8, 2025
d17d1d3
fix unit test in quantity
Jammy2211 Apr 8, 2025
bc9672d
fix geometry profiles
Jammy2211 Apr 8, 2025
0e206f6
fix plot tests
Jammy2211 Apr 8, 2025
e77de0c
black
Jammy2211 Apr 8, 2025
e799670
Merge pull request #225 from Jammy2211/feature/jax_unit_tests
Jammy2211 Apr 8, 2025
e7c59d3
clean up some code to match autolens behaivour
Jammy2211 Apr 9, 2025
7acd1e8
fix multiple image plot
Jammy2211 Apr 9, 2025
b056ae2
minor fixes
Jammy2211 Apr 9, 2025
2b4fdca
deflection thign fixed
Jammy2211 Apr 9, 2025
3e52f6c
fix test_gnfw
Jammy2211 Apr 9, 2025
42eb711
test_nfw_truncated
Jammy2211 Apr 9, 2025
6a5bc6a
fix another test
Jammy2211 Apr 9, 2025
ed5d025
fix more unit tests
Jammy2211 Apr 9, 2025
27e7b8a
Merge pull request #227 from Jammy2211/feature/dark_profiles_unit_fixes
Jammy2211 Apr 9, 2025
da8f7ab
Merge branch 'main' into feature/jax_wrapper
Jammy2211 Apr 9, 2025
ac6a1ee
few updates
Apr 29, 2025
291f55d
merge main updates
Apr 29, 2025
953bde6
add zoom
Apr 29, 2025
501a00b
changes
May 4, 2025
a833ed6
mostly fixed
May 4, 2025
08f104a
merge
May 6, 2025
c8c2838
erm
May 6, 2025
f09d642
merge
May 13, 2025
9600d42
relocate radial
May 13, 2025
b66eb03
merge
May 16, 2025
84c1611
Merge branch 'main' into feature/jax_wrapper
May 21, 2025
df98a0c
Merge branch 'main' into feature/jax_wrapper
May 28, 2025
7ebab73
merge
Jun 1, 2025
83c9cde
fix dual isothermal
Jun 10, 2025
8bc10c6
fix source reconstruction csv
Jun 10, 2025
898c05c
fixed operate image uni test
Jun 10, 2025
0f1514e
operate image uses JAX, fix test
Jun 11, 2025
3d92d6b
black
Jun 11, 2025
451968f
fix all fit imaging
Jun 15, 2025
877a8a1
fix interferometry
Jun 15, 2025
31079d6
fin
Jun 15, 2025
a97e6c5
Merge pull request #237 from Jammy2211/feature/jax_linear_light
Jammy2211 Jun 15, 2025
3d0ee92
operate updated and black
Jun 15, 2025
ef5b63f
Merge pull request #238 from Jammy2211/feature/jax_point_source
Jammy2211 Jun 16, 2025
f2cf47a
operate image now supports JAX
Jun 18, 2025
6575e9a
black
Jun 18, 2025
296d716
fixed some unit tests due to JAX conversion
Jun 18, 2025
98ed1a4
add uses_imaging to linear absract light profile
Jun 18, 2025
1cb5a39
black
Jun 18, 2025
b8ad1ba
Merge pull request #240 from Jammy2211/feature/jax_interferometer_linear
Jammy2211 Jun 18, 2025
cc8cdba
update log likelihood function to not use try / exception
Jun 23, 2025
93d6578
remove run time dict
Jun 23, 2025
6ee3423
remove profile_log_likelihood_function
Jun 23, 2025
ccd65aa
remove profile_Func
Jun 23, 2025
22c6d66
fix aggregator unit test
Jun 23, 2025
52e4c89
black
Jun 24, 2025
dd748d4
Merge pull request #241 from Jammy2211/feature/jax_remove_profiling
Jammy2211 Jun 24, 2025
61f6cd3
all tests updated
Jun 24, 2025
8c5666a
Merge pull request #242 from Jammy2211/feature/jax_rectangular_interp…
Jammy2211 Jun 24, 2025
f99a63e
fix unitt est
Jun 24, 2025
14d6826
speed up by making less imports at beggining
Jun 25, 2025
e511489
fix MockCosmology
Jun 25, 2025
885eea1
remove time consuming deocrator unit tests
Jun 25, 2025
6f86eb1
remove some slow tests which dont do much
Jun 25, 2025
9414645
black
Jun 25, 2025
791f6b2
fix plotter interface test
Jun 25, 2025
8996d73
remove use of numba
Jun 25, 2025
72944ee
remove use of numba
Jun 25, 2025
9916ddb
minor
Jun 25, 2025
5bfc1ec
minor
Jun 25, 2025
c21108f
Merge pull request #243 from Jammy2211/feature/jax_speed_up_general
Jammy2211 Jul 12, 2025
32ae712
fix source reconstruction csv
Jul 13, 2025
5c8cf50
black
Jul 13, 2025
57ff70d
all tests pass after removing Include
Jul 14, 2025
07c2bcd
image refactor progress
Jul 21, 2025
7bddaf2
visual clean up complete
Jul 21, 2025
4ea74b3
2lack
Jul 22, 2025
f775750
Merge pull request #245 from Jammy2211/feature/jax_simplify_visualiza…
Jammy2211 Jul 22, 2025
6432787
remove bbb
Jul 22, 2025
10c5c3a
quirks removed
Jul 24, 2025
8126dc8
import cosmology
Jul 24, 2025
458d3ca
updates to mass profiles
Aug 11, 2025
d7e3031
backup
Aug 18, 2025
5e3ac4c
switch a Rectangular to RectangularUniform
Sep 23, 2025
1d6e4a3
fix unit test by switching to rectangular uniform
Sep 23, 2025
b6bde2b
prior config
Sep 23, 2025
85188ed
Merge pull request #247 from Jammy2211/feature/jax_wrapper_rectangula…
Jammy2211 Sep 23, 2025
f67be9d
kwargs on Analysis
Oct 1, 2025
1196f70
ready to merge
Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ PyAutoGalaxy: Open-Source Multi Wavelength Galaxy Structure & Morphology
.. image:: https://joss.theoj.org/papers/10.21105/joss.04475/status.svg
:target: https://doi.org/10.21105/joss.04475

.. image:: https://www.repostatus.org/badges/latest/active.svg
:target: https://www.repostatus.org/#active
:alt: Project Status: Active

.. image:: https://img.shields.io/pypi/pyversions/autogalaxy
:target: https://pypi.org/project/autogalaxy/
:alt: Python Versions

.. image:: https://img.shields.io/pypi/v/autogalaxy.svg
:target: https://pypi.org/project/autogalaxy/
:alt: PyPI Version

`Installation Guide <https://pyautogalaxy.readthedocs.io/en/latest/installation/overview.html>`_ |
`readthedocs <https://pyautogalaxy.readthedocs.io/en/latest/index.html>`_ |
`Introduction on Binder <https://mybinder.org/v2/gh/Jammy2211/autogalaxy_workspace/release?filepath=start_here.ipynb>`_ |
Expand Down
11 changes: 5 additions & 6 deletions autogalaxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from autoconf.dictable import register_parser
from autofit import conf

conf.instance.register(__file__)

from autoconf.dictable import from_dict, from_json, output_to_json, to_dict
from autoarray.dataset import preprocess # noqa
from autoarray.dataset.imaging.dataset import Imaging # noqa
Expand All @@ -23,8 +28,6 @@
from autoarray.mask.mask_1d import Mask1D # noqa
from autoarray.mask.mask_2d import Mask2D # noqa
from autoarray.mask.derive.zoom_2d import Zoom2D
from autoarray.operators.convolver import Convolver # noqa
from autoarray.operators.convolver import Convolver # noqa
from autoarray.operators.transformer import TransformerDFT # noqa
from autoarray.operators.transformer import TransformerNUFFT # noqa
from autoarray.layout.layout import Layout2D # noqa
Expand All @@ -50,8 +53,6 @@

from .analysis.adapt_images.adapt_images import AdaptImages
from .analysis.adapt_images.adapt_image_maker import AdaptImageMaker
from .analysis.maker import FitMaker
from .analysis.preloads import Preloads
from . import aggregator as agg
from . import exc
from . import plot
Expand Down Expand Up @@ -115,6 +116,4 @@
from autoconf.fitsable import output_to_fits
from autoconf.fitsable import hdu_list_for_output_from

conf.instance.register(__file__)

__version__ = "2025.5.10.1"
4 changes: 1 addition & 3 deletions autogalaxy/abstract_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ def linear_light_profile_intensity_dict(
reconstruction = self.inversion.reconstruction_dict[linear_obj_func]

for i, light_profile in enumerate(linear_obj_func.light_profile_list):
linear_light_profile_intensity_dict[light_profile] = float(
reconstruction[i]
)
linear_light_profile_intensity_dict[light_profile] = reconstruction[i]

return linear_light_profile_intensity_dict

Expand Down
2 changes: 1 addition & 1 deletion autogalaxy/aggregator/agg_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def adapt_images_from(

galaxy_name_image_dict[value.header["EXTNAME"].lower()] = adapt_image

instance = fit.model.instance_from_prior_medians(ignore_prior_limits=True)
instance = fit.model.instance_from_prior_medians(ignore_assertions=True)

adapt_images = AdaptImages(galaxy_name_image_dict=galaxy_name_image_dict)

Expand Down
37 changes: 9 additions & 28 deletions autogalaxy/aggregator/imaging/fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import autofit as af
import autoarray as aa

from autogalaxy.analysis.preloads import Preloads

from autogalaxy.aggregator.imaging.imaging import _imaging_from
from autogalaxy.aggregator.galaxies import _galaxies_from
from autogalaxy.aggregator.dataset_model import _dataset_model_from
Expand All @@ -19,7 +17,6 @@ def _fit_imaging_from(
fit: af.Fit,
instance: Optional[af.ModelInstance] = None,
settings_inversion: aa.SettingsInversion = None,
use_preloaded_grid: bool = True,
) -> List[FitImaging]:
"""
Returns a list of `FitImaging` objects from a `PyAutoFit` loaded directory `Fit` or sqlite database `Fit` object.
Expand Down Expand Up @@ -53,10 +50,6 @@ def _fit_imaging_from(
randomly from the PDF).
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This grid
may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is used
as the fit.
"""

from autogalaxy.imaging.fit_imaging import FitImaging
Expand All @@ -71,25 +64,14 @@ def _fit_imaging_from(

settings_inversion = settings_inversion or fit.value(name="settings_inversion")

mesh_grids_of_planes_list = agg_util.mesh_grids_of_planes_list_from(
fit=fit, total_fits=len(dataset_list), use_preloaded_grid=use_preloaded_grid
)

fit_dataset_list = []

for dataset, galaxies, dataset_model, adapt_images, mesh_grids_of_planes in zip(
for dataset, galaxies, dataset_model, adapt_images in zip(
dataset_list,
galaxies_list,
dataset_model_list,
adapt_images_list,
mesh_grids_of_planes_list,
):
preloads = agg_util.preloads_from(
preloads_cls=Preloads,
use_preloaded_grid=use_preloaded_grid,
mesh_grids_of_planes=mesh_grids_of_planes,
use_w_tilde=False,
)

fit_dataset_list.append(
FitImaging(
Expand All @@ -98,7 +80,6 @@ def _fit_imaging_from(
dataset_model=dataset_model,
adapt_images=adapt_images,
settings_inversion=settings_inversion,
preloads=preloads,
)
)

Expand All @@ -110,7 +91,6 @@ def __init__(
self,
aggregator: af.Aggregator,
settings_inversion: Optional[aa.SettingsInversion] = None,
use_preloaded_grid: bool = True,
):
"""
Interfaces with an `PyAutoFit` aggregator object to create instances of `FitImaging` objects from the results
Expand Down Expand Up @@ -145,15 +125,17 @@ def __init__(
A `PyAutoFit` aggregator object which can load the results of model-fits.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This
grid may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is
used as the fit.

Parameters
----------
aggregator
A `PyAutoFit` aggregator object which can load the results of model-fits.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
"""
super().__init__(aggregator=aggregator)

self.settings_inversion = settings_inversion
self.use_preloaded_grid = use_preloaded_grid

def object_via_gen_from(
self, fit, instance: Optional[af.ModelInstance] = None
Expand All @@ -167,7 +149,7 @@ def object_via_gen_from(
----------
fit
A `PyAutoFit` `Fit` object which contains the results of a model-fit as an entry which has been loaded from
an output directory or from an sqlite database..
an output directory or from an sqlite database..
instance
A manual instance that overwrites the max log likelihood instance in fit (e.g. for drawing the instance
randomly from the PDF).
Expand All @@ -176,5 +158,4 @@ def object_via_gen_from(
fit=fit,
instance=instance,
settings_inversion=self.settings_inversion,
use_preloaded_grid=self.use_preloaded_grid,
)
83 changes: 32 additions & 51 deletions autogalaxy/aggregator/interferometer/fit_interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import autofit as af
import autoarray as aa

from autogalaxy.analysis.preloads import Preloads

from autogalaxy.aggregator import agg_util
from autogalaxy.aggregator.interferometer.interferometer import _interferometer_from
from autogalaxy.aggregator.dataset_model import _dataset_model_from
Expand All @@ -19,7 +17,6 @@ def _fit_interferometer_from(
fit: af.Fit,
instance: Optional[af.ModelInstance] = None,
settings_inversion: aa.SettingsInversion = None,
use_preloaded_grid: bool = True,
) -> List[FitInterferometer]:
"""
Returns a list of `FitInterferometer` objects from a `PyAutoFit` loaded directory `Fit` or sqlite database `Fit` object.
Expand Down Expand Up @@ -54,10 +51,6 @@ def _fit_interferometer_from(
randomly from the PDF).
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This grid
may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is used
as the fit.
"""
from autogalaxy.interferometer.fit_interferometer import FitInterferometer

Expand All @@ -73,25 +66,14 @@ def _fit_interferometer_from(

settings_inversion = settings_inversion or fit.value(name="settings_inversion")

mesh_grids_of_planes_list = agg_util.mesh_grids_of_planes_list_from(
fit=fit, total_fits=len(dataset_list), use_preloaded_grid=use_preloaded_grid
)

fit_dataset_list = []

for dataset, galaxies, dataset_model, adapt_images, mesh_grids_of_planes in zip(
for dataset, galaxies, dataset_model, adapt_images in zip(
dataset_list,
galaxies_list,
dataset_model_list,
adapt_images_list,
mesh_grids_of_planes_list,
):
preloads = agg_util.preloads_from(
preloads_cls=Preloads,
use_preloaded_grid=use_preloaded_grid,
mesh_grids_of_planes=mesh_grids_of_planes,
use_w_tilde=False,
)

fit_dataset_list.append(
FitInterferometer(
Expand All @@ -100,7 +82,6 @@ def _fit_interferometer_from(
dataset_model=dataset_model,
adapt_images=adapt_images,
settings_inversion=settings_inversion,
preloads=preloads,
)
)

Expand All @@ -112,50 +93,51 @@ def __init__(
self,
aggregator: af.Aggregator,
settings_inversion: Optional[aa.SettingsInversion] = None,
use_preloaded_grid: bool = True,
):
"""
Interfaces with an `PyAutoFit` aggregator object to create instances of `FitInterferometer` objects from the
results of a model-fit.
Interfaces with an `PyAutoFit` aggregator object to create instances of `FitInterferometer` objects from the
results of a model-fit.

The results of a model-fit can be loaded from hard-disk or stored in a sqlite database, including the following
The results of a model-fit can be loaded from hard-disk or stored in a sqlite database, including the following
attributes of the fit:

- 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 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 `aggregator` contains the path to each of these files, and they can be loaded individually. This class
can load them all at once and create an `FitInterferometer` object via the `_fit_interferometer_from` method.

The `aggregator` contains the path to each of these files, and they can be loaded individually. This class
can load them all at once and create an `FitInterferometer` object via the `_fit_interferometer_from` method.
This class's methods returns generators which create the instances of the `FitInterferometer` objects. This ensures
that large sets of results can be efficiently loaded from the hard-disk and do not require storing all
`FitInterferometer` instances in the memory at once.

This class's methods returns generators which create the instances of the `FitInterferometer` objects. This ensures
that large sets of results can be efficiently loaded from the hard-disk and do not require storing all
`FitInterferometer` instances in the memory at once.
For example, if the `aggregator` contains 3 model-fits, this class can be used to create a generator which
creates instances of the corresponding 3 `FitInterferometer` objects.

For example, if the `aggregator` contains 3 model-fits, this class can be used to create a generator which
creates instances of the corresponding 3 `FitInterferometer` objects.
If multiple `Imaging` objects were fitted simultaneously via analysis summing, the `fit.child_values()` method
is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of
`FitImaging` objects.

If multiple `Imaging` objects were fitted simultaneously via analysis summing, the `fit.child_values()` method
is instead used to load lists of the data, noise-map, PSF and mask and combine them into a list of
`FitImaging` objects.
This can be done manually, but this object provides a more concise API.

This can be done manually, but this object provides a more concise API.
Parameters
----------
aggregator
A `PyAutoFit` aggregator object which can load the results of model-fits.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.

Parameters
----------
aggregator
A `PyAutoFit` aggregator object which can load the results of model-fits.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Certain pixelization's construct their mesh in the source-plane from a stochastic KMeans algorithm. This
grid may be output to hard-disk after the model-fit and loaded via the database to ensure the same grid is
used as the fit.
Parameters
----------
aggregator
A `PyAutoFit` aggregator object which can load the results of model-fits.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
"""
super().__init__(aggregator=aggregator)

self.settings_inversion = settings_inversion
self.use_preloaded_grid = use_preloaded_grid

def object_via_gen_from(
self, fit, instance: Optional[af.ModelInstance] = None
Expand All @@ -169,7 +151,7 @@ def object_via_gen_from(
----------
fit
A `PyAutoFit` `Fit` object which contains the results of a model-fit as an entry which has been loaded from
an output directory or from an sqlite database..
an output directory or from an sqlite database..
instance
A manual instance that overwrites the max log likelihood instance in fit (e.g. for drawing the instance
randomly from the PDF).
Expand All @@ -178,5 +160,4 @@ def object_via_gen_from(
fit=fit,
instance=instance,
settings_inversion=self.settings_inversion,
use_preloaded_grid=self.use_preloaded_grid,
)
Loading
Loading