Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b0ce5ce
JAX fix for point source
Jammy2211 Mar 20, 2024
6e5f3d9
update make result
Jammy2211 Mar 22, 2024
c3329b8
results updated
Jammy2211 Mar 22, 2024
8fe123e
analysis split into two packages
Jammy2211 Mar 24, 2024
6e6c46e
positions calc uses manual tracer for speed up
Jammy2211 Mar 24, 2024
e68d2f9
fix unit tests
Jammy2211 Mar 24, 2024
91710cf
fix preloading bug
Jammy2211 Mar 24, 2024
09ede48
likelihood check moved to autofit
Jammy2211 Mar 24, 2024
f80888b
removed HilbertBalanced
Jammy2211 Mar 24, 2024
8a97365
unitt rest issues
Jammy2211 Mar 25, 2024
34cb77a
fix bug which also removes noise
Jammy2211 Mar 25, 2024
284a672
conftest
Jammy2211 Mar 26, 2024
1241928
fix analysis image
Jammy2211 Mar 26, 2024
7bd631b
fix analysis interferometer
Jammy2211 Mar 26, 2024
d9630b3
refactor analysis quantity
Jammy2211 Mar 26, 2024
c7dbdaf
fix most of test_result
Jammy2211 Mar 26, 2024
9706a9c
fix rest of test_Result
Jammy2211 Mar 26, 2024
8fcaae0
refacot complete
Jammy2211 Mar 26, 2024
448434b
disable check likelihood
Jammy2211 Mar 26, 2024
2f7c135
merge
Jammy2211 Mar 26, 2024
e7e5732
merge
Jammy2211 Mar 26, 2024
fed47e8
silence!
Jammy2211 Mar 26, 2024
2922427
remove modify after fit overwrite
Jammy2211 Mar 26, 2024
10b6a33
except uses triple quotes
Jammy2211 Mar 26, 2024
c636e9b
Merge branch 'feature/adapt_loading' into feature/keep_the_noise_down
Jammy2211 Mar 26, 2024
e04a962
black
Jammy2211 Mar 26, 2024
91594d4
docs
Jammy2211 Mar 29, 2024
ac43458
remove SettingsImaging / SettingsInterferometer
Jammy2211 Mar 29, 2024
491dddc
remove settings_dataset
Jammy2211 Mar 29, 2024
539838c
fix test_tracer
Jammy2211 Mar 29, 2024
92c0e15
aggregator fixes
Jammy2211 Mar 29, 2024
3220778
remove make_result
Jammy2211 Mar 29, 2024
62c20d1
merge with result_cast
Jammy2211 Mar 29, 2024
af5c561
all tests pass
Jammy2211 Mar 29, 2024
a43b7a2
fin
Jammy2211 Mar 29, 2024
937f339
Merge branch 'feature/result_cast' into feature/iterate_refactor
Jammy2211 Mar 29, 2024
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
9 changes: 4 additions & 5 deletions autolens/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from autoconf.dictable import from_dict, from_json, output_to_json, to_dict
from autoarray import preprocess
from autoarray.dataset.imaging.w_tilde import WTildeImaging
from autoarray.dataset.imaging.dataset import Imaging, SettingsImaging
from autoarray.dataset.imaging.dataset import Imaging
from autoarray.dataset.interferometer.dataset import (
Interferometer,
SettingsInterferometer,
)
from autoarray.mask.mask_1d import Mask1D
from autoarray.mask.mask_2d import Mask2D
Expand Down Expand Up @@ -34,9 +33,9 @@
from autoarray.structures.arrays.irregular import ArrayIrregular
from autoarray.structures.grids.uniform_1d import Grid1D
from autoarray.structures.grids.uniform_2d import Grid2D
from autoarray.structures.grids.iterate_2d import Grid2DIterate
from autoarray.structures.grids.irregular_2d import Grid2DIrregular
from autoarray.structures.grids.irregular_2d import Grid2DIrregularUniform
from autoarray.structures.grids.over_sample.iterate import OverSampleIterate
from autoarray.structures.mesh.rectangular_2d import Mesh2DRectangular
from autoarray.structures.mesh.voronoi_2d import Mesh2DVoronoi
from autoarray.structures.mesh.delaunay_2d import Mesh2DDelaunay
Expand All @@ -47,7 +46,8 @@
from autoarray.structures.visibilities import VisibilitiesNoiseMap

from autogalaxy import cosmology as cosmo
from autogalaxy.analysis.adapt_images import AdaptImages
from autogalaxy.analysis.adapt_images.adapt_images import AdaptImages
from autogalaxy.analysis.adapt_images.adapt_image_maker import AdaptImageMaker
from autogalaxy.gui.clicker import Clicker
from autogalaxy.gui.scribbler import Scribbler
from autogalaxy.galaxy.galaxy import Galaxy
Expand All @@ -57,7 +57,6 @@
from autogalaxy.analysis.clump_model import ClumpModelDisabled

from autogalaxy.quantity.dataset_quantity import DatasetQuantity
from autogalaxy.quantity.dataset_quantity import SettingsQuantity
from autogalaxy.profiles.geometry_profiles import EllProfile
from autogalaxy.profiles import (
point_sources as ps,
Expand Down
12 changes: 2 additions & 10 deletions autolens/aggregator/fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
def _fit_imaging_from(
fit: af.Fit,
instance: Optional[af.ModelInstance] = None,
settings_dataset: aa.SettingsImaging = None,
settings_inversion: aa.SettingsInversion = None,
use_preloaded_grid: bool = True,
) -> List[FitImaging]:
Expand All @@ -37,7 +36,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 a pixelization of inversion can be overwritten by inputting a `settings_dataset` object, for example
The settings of an inversion can be overwritten by inputting a `settings_inversion` object, for example
if you want to use a grid with a different inversion solver.

Parameters
Expand All @@ -47,8 +46,6 @@ 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_dataset
Optionally overwrite the `SettingsImaging` of the `Imaging` object that is created from the fit.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Expand All @@ -57,7 +54,7 @@ def _fit_imaging_from(
as the fit.
"""

dataset_list = _imaging_from(fit=fit, settings_dataset=settings_dataset)
dataset_list = _imaging_from(fit=fit)

tracer_list = _tracer_from(fit=fit, instance=instance)

Expand Down Expand Up @@ -98,7 +95,6 @@ class FitImagingAgg(af.AggBase):
def __init__(
self,
aggregator: af.Aggregator,
settings_dataset: Optional[aa.SettingsImaging] = None,
settings_inversion: Optional[aa.SettingsInversion] = None,
use_preloaded_grid: bool = True,
):
Expand Down Expand Up @@ -132,8 +128,6 @@ def __init__(
----------
aggregator
A `PyAutoFit` aggregator object which can load the results of model-fits.
settings_dataset
Optionally overwrite the `SettingsImaging` of the `Imaging` object that is created from the fit.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Expand All @@ -143,7 +137,6 @@ def __init__(
"""
super().__init__(aggregator=aggregator)

self.settings_dataset = settings_dataset
self.settings_inversion = settings_inversion
self.use_preloaded_grid = use_preloaded_grid

Expand All @@ -166,7 +159,6 @@ def object_via_gen_from(
return _fit_imaging_from(
fit=fit,
instance=instance,
settings_dataset=self.settings_dataset,
settings_inversion=self.settings_inversion,
use_preloaded_grid=self.use_preloaded_grid,
)
11 changes: 1 addition & 10 deletions autolens/aggregator/fit_interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def _fit_interferometer_from(
fit: af.Fit,
instance: Optional[af.ModelInstance] = None,
real_space_mask: Optional[aa.Mask2D] = None,
settings_dataset: aa.SettingsInterferometer = None,
settings_inversion: aa.SettingsInversion = None,
use_preloaded_grid: bool = True,
) -> List[FitInterferometer]:
Expand All @@ -39,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 a pixelization of inversion can be overwritten by inputting a `settings_dataset` object, for
The settings of an inversion can be overwritten by inputting a `settings_inversion` object, for
example if you want to use a grid with a different inversion solver.

Parameters
Expand All @@ -49,8 +48,6 @@ 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_dataset
Optionally overwrite the `SettingsInterferometer` of the `Interferometer` object that is created from the fit.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Expand All @@ -61,7 +58,6 @@ def _fit_interferometer_from(
dataset_list = _interferometer_from(
fit=fit,
real_space_mask=real_space_mask,
settings_dataset=settings_dataset,
)
tracer_list = _tracer_from(fit=fit, instance=instance)

Expand Down Expand Up @@ -102,7 +98,6 @@ class FitInterferometerAgg(af.AggBase):
def __init__(
self,
aggregator: af.Aggregator,
settings_dataset: Optional[aa.SettingsInterferometer] = None,
settings_inversion: Optional[aa.SettingsInversion] = None,
use_preloaded_grid: bool = True,
real_space_mask: Optional[aa.Mask2D] = None,
Expand Down Expand Up @@ -133,8 +128,6 @@ def __init__(
----------
aggregator
A `PyAutoFit` aggregator object which can load the results of model-fits.
settings_dataset
Optionally overwrite the `SettingsInterferometer` of the `Interferometer` object that is created from the fit.
settings_inversion
Optionally overwrite the `SettingsInversion` of the `Inversion` object that is created from the fit.
use_preloaded_grid
Expand All @@ -144,7 +137,6 @@ def __init__(
"""
super().__init__(aggregator=aggregator)

self.settings_dataset = settings_dataset
self.settings_inversion = settings_inversion
self.use_preloaded_grid = use_preloaded_grid
self.real_space_mask = real_space_mask
Expand All @@ -168,7 +160,6 @@ def object_via_gen_from(
return _fit_interferometer_from(
fit=fit,
instance=instance,
settings_dataset=self.settings_dataset,
settings_inversion=self.settings_inversion,
use_preloaded_grid=self.use_preloaded_grid,
)
2 changes: 0 additions & 2 deletions autolens/aggregator/subhalo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class SubhaloAgg:
def __init__(
self,
aggregator_grid_search: af.GridSearchAggregator,
settings_dataset: Optional[aa.SettingsImaging] = None,
settings_inversion: Optional[aa.SettingsInversion] = None,
use_preloaded_grid: bool = True,
):
Expand All @@ -20,7 +19,6 @@ def __init__(
"""

self.aggregator_grid_search = aggregator_grid_search
self.settings_dataset = settings_dataset
self.settings_inversion = settings_inversion
self.use_preloaded_grid = use_preloaded_grid

Expand Down
19 changes: 7 additions & 12 deletions autolens/analysis/analysis.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import dill
import os
import json
import logging
import numpy as np
from os import path
from scipy.stats import norm
from typing import Dict, Optional, List, Union
from typing import Dict, Optional, Union

from autoconf import conf
from autoconf.dictable import to_dict, output_to_json
Expand All @@ -14,14 +10,13 @@
import autoarray as aa
import autogalaxy as ag

from autogalaxy.analysis.analysis import AnalysisDataset as AgAnalysisDataset
from autogalaxy.analysis.analysis.dataset import AnalysisDataset as AgAnalysisDataset

from autolens.analysis.result import ResultDataset
from autolens.analysis.maker import FitMaker
from autolens.analysis.preloads import Preloads
from autolens.analysis.positions import PositionsLHResample
from autolens.analysis.positions import PositionsLHPenalty
from autolens.analysis.visualizer import Visualizer
from autolens.lens.tracer import Tracer

from autolens.lens import tracer_util
Expand All @@ -33,7 +28,7 @@
logger.setLevel(level="INFO")


class AnalysisLensing:
class AnalysisLens:
def __init__(
self,
positions_likelihood: Optional[
Expand Down Expand Up @@ -139,14 +134,14 @@ def log_likelihood_positions_overwrite_from(
raise exc.FitException from e


class AnalysisDataset(AgAnalysisDataset, AnalysisLensing):
class AnalysisDataset(AgAnalysisDataset, AnalysisLens):
def __init__(
self,
dataset,
positions_likelihood: Optional[
Union[PositionsLHResample, PositionsLHPenalty]
] = None,
adapt_images: Optional[ag.AdaptImages] = None,
adapt_image_maker: Optional[ag.AdaptImageMaker] = None,
cosmology: ag.cosmo.LensingCosmology = ag.cosmo.Planck15(),
settings_inversion: aa.SettingsInversion = None,
raise_inversion_positions_likelihood_exception: bool = True,
Expand Down Expand Up @@ -185,12 +180,12 @@ def __init__(

super().__init__(
dataset=dataset,
adapt_images=adapt_images,
adapt_image_maker=adapt_image_maker,
cosmology=cosmology,
settings_inversion=settings_inversion,
)

AnalysisLensing.__init__(
AnalysisLens.__init__(
self=self,
positions_likelihood=positions_likelihood,
cosmology=cosmology,
Expand Down
Empty file.
Loading