Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions autogalaxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
from autoarray.inversion.pixelization.border_relocator import BorderRelocator
from autoarray.mask.mask_1d import Mask1D # noqa
from autoarray.mask.mask_2d import Mask2D # noqa
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 Down
12 changes: 6 additions & 6 deletions autogalaxy/analysis/analysis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,18 @@ def profile_log_likelihood_function(

try:
info_dict["image_pixels"] = self.dataset.grids.lp.shape_slim
info_dict[
"sub_total_light_profiles"
] = self.dataset.grids.lp.over_sampler.sub_total
info_dict["sub_total_light_profiles"] = (
self.dataset.grids.lp.over_sampler.sub_total
)
except AttributeError:
pass

if fit.model_obj.has(cls=aa.Pixelization):
info_dict["use_w_tilde"] = fit.inversion.settings.use_w_tilde
try:
info_dict[
"sub_total_pixelization"
] = self.dataset.grids.pixelization.over_sampler.sub_total
info_dict["sub_total_pixelization"] = (
self.dataset.grids.pixelization.over_sampler.sub_total
)
except AttributeError:
pass
info_dict["use_positive_only_solver"] = (
Expand Down
40 changes: 15 additions & 25 deletions autogalaxy/analysis/chaining_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,39 +215,29 @@ def extra_galaxies_from(

for extra_galaxy_index in range(len(result.instance.extra_galaxies)):
if hasattr(result.instance.extra_galaxies[extra_galaxy_index], "mass"):
extra_galaxies[
extra_galaxy_index
].mass.centre = result.instance.extra_galaxies[
extra_galaxy_index
].mass.centre
extra_galaxies[
extra_galaxy_index
].mass.einstein_radius = result.model.extra_galaxies[
extra_galaxy_index
].mass.einstein_radius
extra_galaxies[extra_galaxy_index].mass.centre = (
result.instance.extra_galaxies[extra_galaxy_index].mass.centre
)
extra_galaxies[extra_galaxy_index].mass.einstein_radius = (
result.model.extra_galaxies[extra_galaxy_index].mass.einstein_radius
)
if free_centre:
extra_galaxies[
extra_galaxy_index
].mass.centre = result.model.extra_galaxies[
extra_galaxy_index
].mass.centre
extra_galaxies[extra_galaxy_index].mass.centre = (
result.model.extra_galaxies[extra_galaxy_index].mass.centre
)

elif light_as_model:
extra_galaxies = result.instance.extra_galaxies.as_model((LightProfile,))

for extra_galaxy_index in range(len(result.instance.extra_galaxies)):
if extra_galaxies[extra_galaxy_index].bulge is not None:
extra_galaxies[
extra_galaxy_index
].bulge.centre = result.instance.extra_galaxies[
extra_galaxy_index
].bulge.centre
extra_galaxies[extra_galaxy_index].bulge.centre = (
result.instance.extra_galaxies[extra_galaxy_index].bulge.centre
)
if free_centre:
extra_galaxies[
extra_galaxy_index
].bulge.centre = result.model.extra_galaxies[
extra_galaxy_index
].bulge.centre
extra_galaxies[extra_galaxy_index].bulge.centre = (
result.model.extra_galaxies[extra_galaxy_index].bulge.centre
)

else:
extra_galaxies = result.instance.extra_galaxies.as_model(())
Expand Down
6 changes: 1 addition & 5 deletions autogalaxy/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ def axis_ratio_and_angle_from(ell_comps: Tuple[float, float]) -> Tuple[float, fl
angle *= 180.0 / np.pi

if use_jax:
angle = jax.lax.select(
angle < -45,
angle + 180,
angle
)
angle = jax.lax.select(angle < -45, angle + 180, angle)
else:
if abs(angle) > 45 and angle < 0:
angle += 180
Expand Down
14 changes: 7 additions & 7 deletions autogalaxy/galaxy/to_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,20 @@ def __init__(
self.run_time_dict = run_time_dict

@property
def convolver(self) -> Optional[aa.Convolver]:
def psf(self) -> Optional[aa.Kernel2D]:
"""
Returns the convolver of the imaging dataset, if the inversion is performed on an imaging dataset.
Returns the PSF of the imaging dataset, if the inversion is performed on an imaging dataset.

The `GalaxiesToInversion` class acts as an interface between the dataset and inversion module for
both imaging and interferometer datasets. Only imaging datasets have a convolver, thus this property
ensures that for an interferometer dataset code which references a convolver does not raise an error.
both imaging and interferometer datasets. Only imaging datasets have a PSF, thus this property
ensures that for an interferometer dataset code which references a PSF does not raise an error.

Returns
-------
The convolver of the imaging dataset, if it is an imaging dataset.
The psf of the imaging dataset, if it is an imaging dataset.
"""
try:
return self.dataset.convolver
return self.dataset.psf
except AttributeError:
return None

Expand Down Expand Up @@ -310,7 +310,7 @@ def cls_light_profile_func_list_galaxy_dict_from(
lp_linear_func = LightProfileLinearObjFuncList(
grid=self.dataset.grids.lp,
blurring_grid=self.dataset.grids.blurring,
convolver=self.dataset.convolver,
psf=self.dataset.psf,
light_profile_list=light_profile_list,
regularization=light_profile.regularization,
)
Expand Down
6 changes: 3 additions & 3 deletions autogalaxy/imaging/fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def blurred_image(self) -> aa.Array2D:

return self.galaxies.blurred_image_2d_from(
grid=self.grids.lp,
convolver=self.dataset.convolver,
psf=self.dataset.psf,
blurring_grid=self.grids.blurring,
)

Expand All @@ -120,7 +120,7 @@ def galaxies_to_inversion(self) -> GalaxiesToInversion:
data=self.profile_subtracted_image,
noise_map=self.noise_map,
grids=self.grids,
convolver=self.dataset.convolver,
psf=self.dataset.psf,
w_tilde=self.w_tilde,
)

Expand Down Expand Up @@ -179,7 +179,7 @@ def galaxy_model_image_dict(self) -> Dict[Galaxy, np.ndarray]:

galaxy_blurred_image_2d_dict = self.galaxies.galaxy_blurred_image_2d_dict_from(
grid=self.grids.lp,
convolver=self.dataset.convolver,
psf=self.dataset.psf,
blurring_grid=self.grids.blurring,
)

Expand Down
Loading
Loading