Skip to content

Commit

Permalink
uniform -> lp
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Dec 15, 2024
1 parent ed65517 commit 137d403
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions autogalaxy/aggregator/imaging/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _imaging_from(
psf = None

try:
over_sampling_uniform = aa.Array2D.from_primary_hdu(primary_hdu=fit.value(name="dataset.over_sampling_size_uniform")).native
over_sampling_uniform = aa.Array2D.from_primary_hdu(primary_hdu=fit.value(name="dataset.over_sampling_size_lp")).native
except AttributeError:
over_sampling_uniform = 1
try:
Expand All @@ -63,7 +63,7 @@ def _imaging_from(
data=data,
noise_map=noise_map,
psf=psf,
over_sampling=aa.OverSamplingDataset(uniform=over_sampling_uniform, pixelization=over_sampling_pixelization),
over_sampling=aa.OverSamplingDataset(lp=over_sampling_uniform, pixelization=over_sampling_pixelization),
check_noise_map=False,
)

Expand Down
4 changes: 2 additions & 2 deletions autogalaxy/analysis/analysis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ def profile_log_likelihood_function(
fit.figure_of_merit

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

Expand Down
4 changes: 2 additions & 2 deletions autogalaxy/analysis/analysis/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def save_attributes(self, paths: af.DirectoryPaths):
prefix="dataset",
)
paths.save_fits(
name="over_sampling_size_uniform",
hdu=self.dataset.grids.uniform.over_sampling_size.native.hdu_for_output,
name="over_sampling_size_lp",
hdu=self.dataset.grids.lp.over_sampling_size.native.hdu_for_output,
prefix="dataset",
)
paths.save_fits(
Expand Down
2 changes: 1 addition & 1 deletion autogalaxy/galaxy/to_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def cls_light_profile_func_list_galaxy_dict_from(

if len(light_profile_list) > 0:
lp_linear_func = LightProfileLinearObjFuncList(
grid=self.dataset.grids.uniform,
grid=self.dataset.grids.lp,
blurring_grid=self.dataset.grids.blurring,
convolver=self.dataset.convolver,
light_profile_list=light_profile_list,
Expand Down
10 changes: 5 additions & 5 deletions autogalaxy/imaging/fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ def blurred_image(self) -> aa.Array2D:
self.galaxies.cls_list_from(cls=LightProfileOperated)
):
return self.galaxies.image_2d_from(
grid=self.grids.uniform,
grid=self.grids.lp,
)

return self.galaxies.blurred_image_2d_from(
grid=self.grids.uniform,
grid=self.grids.lp,
convolver=self.dataset.convolver,
blurring_grid=self.grids.blurring,
)
Expand Down Expand Up @@ -185,7 +185,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.uniform,
grid=self.grids.lp,
convolver=self.dataset.convolver,
blurring_grid=self.grids.blurring,
)
Expand Down Expand Up @@ -257,7 +257,7 @@ def unmasked_blurred_image(self) -> aa.Array2D:
exc.raise_linear_light_profile_in_unmasked()

return self.galaxies.unmasked_blurred_image_2d_from(
grid=self.grids.uniform, psf=self.dataset.psf
grid=self.grids.lp, psf=self.dataset.psf
)

@property
Expand All @@ -272,7 +272,7 @@ def unmasked_blurred_image_of_galaxies_list(self) -> List[aa.Array2D]:
exc.raise_linear_light_profile_in_unmasked()

return self.galaxies.unmasked_blurred_image_2d_list_from(
grid=self.grids.uniform, psf=self.dataset.psf
grid=self.grids.lp, psf=self.dataset.psf
)

@property
Expand Down
4 changes: 2 additions & 2 deletions autogalaxy/imaging/model/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def visualize(
galaxies = fit.galaxies_linear_light_profiles_to_light_profiles

plotter.galaxies(
galaxies=galaxies, grid=fit.grids.uniform, during_analysis=during_analysis
galaxies=galaxies, grid=fit.grids.lp, during_analysis=during_analysis
)
plotter.galaxies_1d(
galaxies=galaxies, grid=fit.grids.uniform, during_analysis=during_analysis
galaxies=galaxies, grid=fit.grids.lp, during_analysis=during_analysis
)
if fit.inversion is not None:
plotter.inversion(inversion=fit.inversion, during_analysis=during_analysis)
Expand Down
6 changes: 3 additions & 3 deletions autogalaxy/interferometer/fit_interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def profile_visibilities(self) -> aa.Visibilities:
a Fourier transform to the sum of light profile images.
"""
return self.galaxies.visibilities_from(
grid=self.grids.uniform, transformer=self.dataset.transformer
grid=self.grids.lp, transformer=self.dataset.transformer
)

@property
Expand Down Expand Up @@ -173,7 +173,7 @@ def galaxy_model_image_dict(self) -> Dict[Galaxy, np.ndarray]:
data being fitted.
"""
galaxy_model_image_dict = self.galaxies.galaxy_image_2d_dict_from(
grid=self.grids.uniform
grid=self.grids.lp
)

galaxy_linear_obj_image_dict = self.galaxy_linear_obj_data_dict_from(
Expand All @@ -197,7 +197,7 @@ def galaxy_model_visibilities_dict(self) -> Dict[Galaxy, np.ndarray]:
data being fitted.
"""
galaxy_model_visibilities_dict = self.galaxies.galaxy_visibilities_dict_from(
grid=self.grids.uniform, transformer=self.dataset.transformer
grid=self.grids.lp, transformer=self.dataset.transformer
)

galaxy_linear_obj_data_dict = self.galaxy_linear_obj_data_dict_from(
Expand Down
4 changes: 2 additions & 2 deletions autogalaxy/interferometer/model/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def visualize(
galaxies = fit.galaxies_linear_light_profiles_to_light_profiles

PlotterInterface.galaxies(
galaxies=galaxies, grid=fit.grids.uniform, during_analysis=during_analysis
galaxies=galaxies, grid=fit.grids.lp, during_analysis=during_analysis
)
PlotterInterface.galaxies_1d(
galaxies=galaxies, grid=fit.grids.uniform, during_analysis=during_analysis
galaxies=galaxies, grid=fit.grids.lp, during_analysis=during_analysis
)

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def galaxies_plotter_from(self, galaxies: List[Galaxy]) -> GalaxiesPlotter:
"""
return GalaxiesPlotter(
galaxies=galaxies,
grid=self.fit.grids.uniform,
grid=self.fit.grids.lp,
mat_plot_2d=self.mat_plot_2d,
visuals_2d=self.get_visuals_2d_real_space(),
include_2d=self.include_2d,
Expand Down
2 changes: 1 addition & 1 deletion autogalaxy/plot/get_visuals/two_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def via_fit_imaging_from(self, fit: FitImaging) -> Visuals2D:
visuals_2d_via_fit = super().via_fit_imaging_from(fit=fit)

visuals_2d_via_light_mass_obj = self.via_light_mass_obj_from(
light_mass_obj=fit.galaxies, grid=fit.grids.uniform
light_mass_obj=fit.galaxies, grid=fit.grids.lp
)

return visuals_2d_via_fit + visuals_2d_via_light_mass_obj
2 changes: 1 addition & 1 deletion autogalaxy/quantity/fit_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
def model_data(self):
if self.model_data_manual is None:
func = getattr(self.light_mass_obj, self.func_str)
return func(grid=self.grids.uniform)
return func(grid=self.grids.lp)

return self.model_data_manual

Expand Down
4 changes: 2 additions & 2 deletions test_autogalaxy/aggregator/imaging/test_aggregator_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test__dataset_generator_from_aggregator__analysis_has_single_dataset(
psf=psf_3x3,
noise_map=noise_map_7x7,
over_sampling=ag.OverSamplingDataset(
uniform=5,
lp=5,
pixelization=3,
),
)
Expand All @@ -34,7 +34,7 @@ def test__dataset_generator_from_aggregator__analysis_has_single_dataset(

for dataset_list in dataset_gen:
assert (dataset_list[0].data == masked_imaging_7x7.data).all()
assert dataset_list[0].grids.uniform.over_sampling_size[0] == 5
assert dataset_list[0].grids.lp.over_sampling_size[0] == 5
assert dataset_list[0].grids.pixelization.over_sampling_size[0] == 3

clean(database_file=database_file)
Expand Down
4 changes: 2 additions & 2 deletions test_autogalaxy/analysis/test_plotter_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test__galaxies(

plotter_interface.galaxies(
galaxies=galaxies_7x7,
grid=masked_imaging_7x7.grids.uniform,
grid=masked_imaging_7x7.grids.lp,
during_analysis=False,
)

Expand Down Expand Up @@ -57,7 +57,7 @@ def test__galaxies_1d(

plotter_interface.galaxies_1d(
galaxies=galaxies_7x7,
grid=masked_imaging_7x7.grids.uniform,
grid=masked_imaging_7x7.grids.lp,
during_analysis=False,
)

Expand Down
8 changes: 4 additions & 4 deletions test_autogalaxy/imaging/test_fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ def test__galaxy_model_image_dict(masked_imaging_7x7):
fit = ag.FitImaging(dataset=masked_imaging_7x7, galaxies=[g0, g1, g2, g3])

g0_blurred_image_2d = g0.blurred_image_2d_from(
grid=masked_imaging_7x7.grids.uniform,
grid=masked_imaging_7x7.grids.lp,
blurring_grid=masked_imaging_7x7.grids.blurring,
convolver=masked_imaging_7x7.convolver,
)

g1_blurred_image_2d = g1.blurred_image_2d_from(
grid=masked_imaging_7x7.grids.uniform,
grid=masked_imaging_7x7.grids.lp,
blurring_grid=masked_imaging_7x7.grids.blurring,
convolver=masked_imaging_7x7.convolver,
)
Expand Down Expand Up @@ -426,14 +426,14 @@ def test___unmasked_blurred_images(masked_imaging_7x7):
fit = ag.FitImaging(dataset=masked_imaging_7x7, galaxies=[g0, g1])

unmasked_blurred_image = galaxies.unmasked_blurred_image_2d_from(
grid=masked_imaging_7x7.grids.uniform, psf=masked_imaging_7x7.psf
grid=masked_imaging_7x7.grids.lp, psf=masked_imaging_7x7.psf
)

assert (fit.unmasked_blurred_image == unmasked_blurred_image).all()

unmasked_blurred_image_of_galaxies_list = (
galaxies.unmasked_blurred_image_2d_list_from(
grid=masked_imaging_7x7.grids.uniform, psf=masked_imaging_7x7.psf
grid=masked_imaging_7x7.grids.lp, psf=masked_imaging_7x7.psf
)
)

Expand Down
6 changes: 3 additions & 3 deletions test_autogalaxy/imaging/test_simulate_and_fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test__perfect_fit__chi_squared_0():
noise_map_path=path.join(file_path, "noise_map.fits"),
psf_path=path.join(file_path, "psf.fits"),
pixel_scales=0.2,
over_sampling=ag.OverSamplingDataset(uniform=1),
over_sampling=ag.OverSamplingDataset(lp=1),
)

mask = ag.Mask2D.circular(
Expand Down Expand Up @@ -171,7 +171,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_agree_with_standa

masked_dataset = dataset.apply_mask(mask=mask)
masked_dataset = masked_dataset.apply_over_sampling(
over_sampling=ag.OverSamplingDataset(uniform=1)
over_sampling=ag.OverSamplingDataset(lp=1)
)

fit = ag.FitImaging(dataset=masked_dataset, galaxies=[galaxy])
Expand Down Expand Up @@ -203,7 +203,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_agree_with_standa
assert fit_linear.figure_of_merit == pytest.approx(-45.02798, 1.0e-4)

galaxy_image = galaxy.blurred_image_2d_from(
grid=masked_dataset.grids.uniform,
grid=masked_dataset.grids.lp,
convolver=masked_dataset.convolver,
blurring_grid=masked_dataset.grids.blurring,
)
Expand Down
12 changes: 6 additions & 6 deletions test_autogalaxy/interferometer/test_fit_interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ def test___galaxy_model_image_dict(interferometer_7):
settings_inversion=ag.SettingsInversion(use_w_tilde=False),
)

g0_image = g0.image_2d_from(grid=interferometer_7.grids.uniform)
g1_image = g1.image_2d_from(grid=interferometer_7.grids.uniform)
g0_image = g0.image_2d_from(grid=interferometer_7.grids.lp)
g1_image = g1.image_2d_from(grid=interferometer_7.grids.lp)

assert fit.galaxy_model_image_dict[g0] == pytest.approx(g0_image, 1.0e-4)
assert fit.galaxy_model_image_dict[g1] == pytest.approx(g1_image, 1.0e-4)
Expand Down Expand Up @@ -187,7 +187,7 @@ def test___galaxy_model_image_dict(interferometer_7):

mapper_grids = pixelization.mesh.mapper_grids_from(
mask=interferometer_7.real_space_mask,
source_plane_data_grid=interferometer_7.grids.uniform,
source_plane_data_grid=interferometer_7.grids.lp,
border_relocator=interferometer_7.grids.border_relocator,
source_plane_mesh_grid=None,
)
Expand Down Expand Up @@ -265,10 +265,10 @@ def test___galaxy_model_visibilities_dict(interferometer_7):
)

g0_visibilities = g0.visibilities_from(
grid=interferometer_7.grids.uniform, transformer=interferometer_7.transformer
grid=interferometer_7.grids.lp, transformer=interferometer_7.transformer
)
g1_visibilities = g1.visibilities_from(
grid=interferometer_7.grids.uniform, transformer=interferometer_7.transformer
grid=interferometer_7.grids.lp, transformer=interferometer_7.transformer
)

assert fit.galaxy_model_visibilities_dict[g0] == pytest.approx(
Expand Down Expand Up @@ -313,7 +313,7 @@ def test___galaxy_model_visibilities_dict(interferometer_7):

mapper_grids = pixelization.mesh.mapper_grids_from(
mask=interferometer_7.real_space_mask,
source_plane_data_grid=interferometer_7.grids.uniform,
source_plane_data_grid=interferometer_7.grids.lp,
border_relocator=interferometer_7.grids.border_relocator,
source_plane_mesh_grid=None,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ def test__linear_light_profiles_agree_with_standard_light_profiles():
] == pytest.approx(0.2, 1.0e-2)
assert fit.log_likelihood == pytest.approx(fit_linear.log_likelihood, 1.0e-4)

galaxy_image = galaxy.image_2d_from(grid=dataset.grids.uniform)
galaxy_image = galaxy.image_2d_from(grid=dataset.grids.lp)

assert fit_linear.galaxy_model_image_dict[galaxy_linear] == pytest.approx(
galaxy_image, 1.0e-4
)

galaxy_visibilities = galaxy.visibilities_from(
grid=dataset.grids.uniform, transformer=dataset.transformer
grid=dataset.grids.lp, transformer=dataset.transformer
)

assert fit_linear.galaxy_model_visibilities_dict[galaxy_linear] == pytest.approx(
Expand Down
8 changes: 4 additions & 4 deletions test_autogalaxy/quantity/test_dataset_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,20 @@ def test__grid(
):
dataset = dataset_quantity_7x7_array_2d.apply_mask(mask=mask_2d_7x7)

assert isinstance(dataset.grids.uniform, ag.Grid2D)
assert (dataset.grids.uniform == grid_2d_7x7).all()
assert isinstance(dataset.grids.lp, ag.Grid2D)
assert (dataset.grids.lp == grid_2d_7x7).all()

dataset_quantity = ag.DatasetQuantity(
data=ag.Array2D.ones(shape_native=(7, 7), pixel_scales=1.0),
noise_map=ag.Array2D.full(
fill_value=2.0, shape_native=(7, 7), pixel_scales=1.0
),
over_sampling=ag.OverSamplingDataset(uniform=4),
over_sampling=ag.OverSamplingDataset(lp=4),
)

dataset = dataset_quantity.apply_mask(mask=mask_2d_7x7)

assert (dataset.grids.uniform == grid_2d_7x7).all()
assert (dataset.grids.lp == grid_2d_7x7).all()


def test__vector_data__y_x():
Expand Down

0 comments on commit 137d403

Please sign in to comment.