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: 1 addition & 1 deletion autogalaxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@

conf.instance.register(__file__)

__version__ = '0.16.3'
__version__ = "0.16.3"
3 changes: 2 additions & 1 deletion autogalaxy/config/general.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ interpolated_grid_shape=image_grid

[hyper]
hyper_minimum_percent=0.01
hyper_noise_limit=1.0e8
hyper_noise_limit=1.0e8
stochastic_outputs=False
24 changes: 12 additions & 12 deletions autogalaxy/config/grids/interpolate.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ EllipticalCoredIsothermal=True
SphericalCoredIsothermal=True
EllipticalGaussian=False
SphericalGaussian=False
EllipticalSersic=True
SphericalSersic=True
EllipticalCoreSersic=True
SphericalCoreSersic=True
EllipticalExponential=True
SphericalExponential=True
EllipticalDevVaucouleurs=True
SphericalDevVaucouleurs=True
EllipticalSersicRadialGradient=True
SphericalSersicRadialGradient=True
EllipticalExponentialRadialGradient=True
SphericalExponentialRadialGradient=True
EllipticalSersic=False
SphericalSersic=False
EllipticalCoreSersic=False
SphericalCoreSersic=False
EllipticalExponential=False
SphericalExponential=False
EllipticalDevVaucouleurs=False
SphericalDevVaucouleurs=False
EllipticalSersicRadialGradient=False
SphericalSersicRadialGradient=False
EllipticalExponentialRadialGradient=False
SphericalExponentialRadialGradient=False
EllipticalChameleon=False
SphericalChameleon=False
EllipticalNFW=True
Expand Down
2 changes: 1 addition & 1 deletion autogalaxy/fit/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def __init__(
"""

if hyper_background_noise is not None:
noise_map = hyper_background_noise.hyper_noise_map_from_noise_map(
noise_map = hyper_background_noise.hyper_noise_map_from_complex_noise_map(
noise_map=masked_interferometer.noise_map
)
else:
Expand Down
13 changes: 13 additions & 0 deletions autogalaxy/hyper/hyper_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,16 @@ def hyper_noise_map_from_noise_map(self, noise_map):
The background noise_maps values (electrons per second).
"""
return noise_map + self.noise_scale

def hyper_noise_map_from_complex_noise_map(self, noise_map):
"""
Returns a hyper noise_maps from the background noise_maps grid.

Parameters
-----------
noise_map : np.ndarray
The noise_maps before scaling (electrons per second).
background_noise : np.ndarray
The background noise_maps values (electrons per second).
"""
return noise_map + (1.0 + 1.0j) * self.noise_scale
4 changes: 2 additions & 2 deletions autogalaxy/mock/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def make_masked_imaging_7x7():
def make_masked_interferometer_7():
return ag.MaskedInterferometer(
interferometer=make_interferometer_7(),
visibilities_mask=make_visibilities_mask_7x2(),
visibilities_mask=make_visibilities_mask_7(),
real_space_mask=make_mask_7x7(),
settings=ag.SettingsMaskedInterferometer(
sub_size=1, transformer_class=ag.TransformerDFT
Expand All @@ -27,7 +27,7 @@ def make_masked_interferometer_7():
def make_masked_interferometer_7_lop():
return ag.MaskedInterferometer(
interferometer=make_interferometer_7(),
visibilities_mask=make_visibilities_mask_7x2(),
visibilities_mask=make_visibilities_mask_7(),
real_space_mask=make_mask_7x7(),
settings=ag.SettingsMaskedInterferometer(transformer_class=ag.TransformerNUFFT),
)
Expand Down
3 changes: 1 addition & 2 deletions autogalaxy/pipeline/phase/dataset/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import autofit as af
from autoarray.inversion import pixelizations as pix
from autoarray.inversion import regularization as reg
from autofit.tools.phase import Dataset
from autogalaxy.hyper import hyper_data as hd
from autogalaxy.pipeline.phase import abstract
from autogalaxy.pipeline.phase import extensions
Expand Down Expand Up @@ -37,7 +36,7 @@ def __init__(self, settings, search, galaxies=None, cosmology=cosmo.Planck15):

def run(
self,
dataset: Dataset,
dataset,
mask,
results=None,
info=None,
Expand Down
18 changes: 3 additions & 15 deletions autogalaxy/pipeline/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,8 +1332,6 @@ def bulge_prior_model_with_updated_priors(self, index=0):

if bulge.cls is lmp.EllipticalExponential or bulge.cls is lmp.EllipticalSersic:

bulge = af.PriorModel(lmp.EllipticalSersic)

bulge.centre = af.last[index].model.galaxies.lens.bulge.centre
bulge.elliptical_comps = af.last[
index
Expand Down Expand Up @@ -1386,8 +1384,6 @@ def disk_prior_model_with_updated_priors(self, index=0):

if disk.cls is lmp.EllipticalExponential or disk.cls is lmp.EllipticalSersic:

disk = af.PriorModel(lmp.EllipticalSersic)

disk.centre = af.last[index].model.galaxies.lens.disk.centre
disk.elliptical_comps = af.last[
index
Expand Down Expand Up @@ -1441,8 +1437,6 @@ def envelope_prior_model_with_updated_priors(self, index=0):
or envelope.cls is lmp.EllipticalSersic
):

envelope = af.PriorModel(lmp.EllipticalSersic)

envelope.centre = af.last[index].model.galaxies.lens.envelope.centre
envelope.elliptical_comps = af.last[
index
Expand Down Expand Up @@ -1499,8 +1493,6 @@ def bulge_prior_instance_with_updated_priors(self, index=0):

if bulge.cls is lmp.EllipticalExponential or bulge.cls is lmp.EllipticalSersic:

bulge = af.PriorModel(lmp.EllipticalSersic)

bulge.centre = af.last[index].instance.galaxies.lens.bulge.centre
bulge.elliptical_comps = af.last[
index
Expand All @@ -1510,7 +1502,7 @@ def bulge_prior_instance_with_updated_priors(self, index=0):
index
].instance.galaxies.lens.bulge.effective_radius

if bulge.cls is lp.EllipticalSersic:
if bulge.cls is lmp.EllipticalSersic:
bulge.sersic_index = af.last[
index
].instance.galaxies.lens.bulge.sersic_index
Expand Down Expand Up @@ -1557,8 +1549,6 @@ def disk_prior_instance_with_updated_priors(self, index=0):

if disk.cls is lmp.EllipticalExponential or disk.cls is lmp.EllipticalSersic:

disk = af.PriorModel(lmp.EllipticalSersic)

disk.centre = af.last[index].instance.galaxies.lens.disk.centre
disk.elliptical_comps = af.last[
index
Expand All @@ -1568,7 +1558,7 @@ def disk_prior_instance_with_updated_priors(self, index=0):
index
].instance.galaxies.lens.disk.effective_radius

if disk.cls is lp.EllipticalSersic:
if disk.cls is lmp.EllipticalSersic:
disk.sersic_index = af.last[
index
].instance.galaxies.lens.disk.sersic_index
Expand Down Expand Up @@ -1618,8 +1608,6 @@ def envelope_prior_instance_with_updated_priors(self, index=0):
or envelope.cls is lmp.EllipticalSersic
):

envelope = af.PriorModel(lmp.EllipticalSersic)

envelope.centre = af.last[index].instance.galaxies.lens.envelope.centre
envelope.elliptical_comps = af.last[
index
Expand All @@ -1631,7 +1619,7 @@ def envelope_prior_instance_with_updated_priors(self, index=0):
index
].instance.galaxies.lens.envelope.effective_radius

if envelope.cls is lp.EllipticalSersic:
if envelope.cls is lmp.EllipticalSersic:
envelope.sersic_index = af.last[
index
].instance.galaxies.lens.envelope.sersic_index
Expand Down
22 changes: 12 additions & 10 deletions autogalaxy/plot/fit_interferometer_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def visibilities(fit, include=None, plotter=None):
origin : True
If true, the origin of the datas's coordinate system is plotted as a 'x'.
"""
plotter.plot_grid(grid=fit.visibilities)
plotter.plot_grid(grid=fit.visibilities.in_grid)


@lensing_plotters.set_include_and_plotter
Expand All @@ -234,7 +234,7 @@ def noise_map(fit, include=None, plotter=None):
origin : True
If true, the origin of the datas's coordinate system is plotted as a 'x'.
"""
plotter.plot_grid(grid=fit.visibilities, color_array=fit.noise_map[:, 0])
plotter.plot_grid(grid=fit.visibilities.in_grid, color_array=fit.noise_map.real)


@lensing_plotters.set_include_and_plotter
Expand All @@ -251,7 +251,9 @@ def signal_to_noise_map(fit, include=None, plotter=None):
origin : True
If true, the origin of the datas's coordinate system is plotted as a 'x'.
"""
plotter.plot_grid(grid=fit.visibilities, color_array=fit.signal_to_noise_map[:, 0])
plotter.plot_grid(
grid=fit.visibilities.in_grid, color_array=fit.signal_to_noise_map.real
)


@lensing_plotters.set_include_and_plotter
Expand All @@ -268,7 +270,7 @@ def model_visibilities(fit, include=None, plotter=None):
visibilities_index : int
The index of the datas in the datas-set of which the model visibilities is plotted.
"""
plotter.plot_grid(grid=fit.visibilities)
plotter.plot_grid(grid=fit.visibilities.in_grid)


@lensing_plotters.set_include_and_plotter
Expand All @@ -294,13 +296,13 @@ def residual_map_vs_uv_distances(
"""

if plot_real:
y = fit.residual_map[:, 0]
y = fit.residual_map.real
plotter = plotter.plotter_with_new_labels(title=plotter.labels.title + " Real")
plotter = plotter.plotter_with_new_output(
filename=plotter.output.filename + "_real"
)
else:
y = fit.residual_map[:, 1]
y = fit.residual_map.imag
plotter = plotter.plotter_with_new_labels(title=plotter.labels.title + " Imag")
plotter = plotter.plotter_with_new_output(
filename=plotter.output.filename + "_imag"
Expand Down Expand Up @@ -336,13 +338,13 @@ def normalized_residual_map_vs_uv_distances(
"""

if plot_real:
y = fit.residual_map[:, 0]
y = fit.residual_map.real
plotter = plotter.plotter_with_new_labels(title=plotter.labels.title + " Real")
plotter = plotter.plotter_with_new_output(
filename=plotter.output.filename + "_real"
)
else:
y = fit.residual_map[:, 1]
y = fit.residual_map.imag
plotter = plotter.plotter_with_new_labels(title=plotter.labels.title + " Imag")
plotter = plotter.plotter_with_new_output(
filename=plotter.output.filename + "_imag"
Expand Down Expand Up @@ -378,13 +380,13 @@ def chi_squared_map_vs_uv_distances(
"""

if plot_real:
y = fit.residual_map[:, 0]
y = fit.residual_map.real
plotter = plotter.plotter_with_new_labels(title=plotter.labels.title + " Real")
plotter = plotter.plotter_with_new_output(
filename=plotter.output.filename + "_real"
)
else:
y = fit.residual_map[:, 1]
y = fit.residual_map.imag
plotter = plotter.plotter_with_new_labels(title=plotter.labels.title + " Imag")
plotter = plotter.plotter_with_new_output(
filename=plotter.output.filename + "_imag"
Expand Down
4 changes: 2 additions & 2 deletions autogalaxy/profiles/mass_profiles/mass_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def __init__(self, elliptical_comps: typing.Tuple[float, float] = (0.0, 0.0)):
def convergence_func(self, grid_radius):
return 0.0

def average_convergence_of_1_radius(self,):
return dim.Length(value=0.0, unit_length=self.unit_length)
def average_convergence_of_1_radius(self):
return 0.0

@grids.grid_like_to_structure
def convergence_from_grid(self, grid):
Expand Down
6 changes: 1 addition & 5 deletions autogalaxy/profiles/mass_profiles/stellar_mass_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,7 @@ def convergence_from_grid_via_gaussians(self, grid):

eccentric_radii = self.grid_to_eccentric_radii(grid=grid)

convergence = self._convergence_from_grid_via_gaussians(
grid_radii=eccentric_radii
)

return np.multiply(self.mass_to_light_ratio, convergence)
return self._convergence_from_grid_via_gaussians(grid_radii=eccentric_radii)

@grids.grid_like_to_structure
def potential_from_grid(self, grid):
Expand Down
3 changes: 2 additions & 1 deletion test_autogalaxy/config/general.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ stochastic_histogram_bins = 10

[hyper]
hyper_minimum_percent=0.01
hyper_noise_limit=1.0e8
hyper_noise_limit=1.0e8
stochastic_outputs=False
3 changes: 0 additions & 3 deletions test_autogalaxy/config/non_linear/mcmc/Emcee.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ model_results_every_update=1
log_every_update=1
remove_state_files_at_end=True

[initialize]
method=prior

[printing]
silence=False

Expand Down
2 changes: 1 addition & 1 deletion test_autogalaxy/config/visualize/general.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[general]
backend = TKAgg
backend=default
visualize_every_update = 10

[units]
Expand Down
4 changes: 2 additions & 2 deletions test_autogalaxy/unit/aggregator/test_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test__fit_imaging_generator_from_aggregator(imaging_7x7, mask_7x7, samples):


def test__masked_interferometer_generator_from_aggregator(
interferometer_7, mask_7x7, samples
interferometer_7, visibilities_mask_7, mask_7x7, samples
):
phase_interferometer_7x7 = ag.PhaseInterferometer(
galaxies=dict(
Expand All @@ -147,7 +147,7 @@ def test__masked_interferometer_generator_from_aggregator(

phase_interferometer_7x7.run(
dataset=interferometer_7,
mask=mask_7x7,
mask=visibilities_mask_7,
results=mock.MockResults(samples=samples),
)

Expand Down
12 changes: 6 additions & 6 deletions test_autogalaxy/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ def make_positions_7x7():
return fixtures.make_positions_7x7()


@pytest.fixture(name="visibilities_mask_7x2")
def make_visibilities_mask_7x2():
return np.full(fill_value=False, shape=(7, 2))
@pytest.fixture(name="visibilities_mask_7")
def make_visibilities_mask_7():
return fixtures.make_visibilities_mask_7()


@pytest.fixture(name="blurring_grid_7x7")
def make_blurring_grid_7x7():
return fixtures.make_blurring_grid_7x7()


@pytest.fixture(name="noise_map_7x2")
@pytest.fixture(name="noise_map_7")
def make_noise_map_7():
return fixtures.make_noise_map_7()
return fixtures.make_visibilities_noise_map_7()


@pytest.fixture(name="visibilities_7x2")
@pytest.fixture(name="visibilities_7")
def make_visibilities_7():
return fixtures.make_visibilities_7()

Expand Down
Loading