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 859cb17 commit 630f15c
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 51 deletions.
10 changes: 5 additions & 5 deletions autolens/imaging/fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def blurred_image(self) -> aa.Array2D:
if self.preloads.blurred_image is None:

return self.tracer.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 @@ -178,7 +178,7 @@ def galaxy_model_image_dict(self) -> Dict[ag.Galaxy, np.ndarray]:
"""

galaxy_blurred_image_2d_dict = self.tracer.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 @@ -249,7 +249,7 @@ def model_images_of_planes_list(self) -> List[aa.Array2D]:

model_images_of_planes_list = [
aa.Array2D(
values=np.zeros(self.grids.uniform.shape_slim), mask=self.dataset.mask
values=np.zeros(self.grids.lp.shape_slim), mask=self.dataset.mask
)
for i in range(self.tracer.total_planes)
]
Expand Down Expand Up @@ -305,7 +305,7 @@ def unmasked_blurred_image(self) -> aa.Array2D:
exc.raise_linear_light_profile_in_unmasked()

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

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

return self.tracer.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 autolens/imaging/mock/mock_fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def grid(self):
if self._grid is not None:
return self._grid

return super().grids.uniform
return super().grids.lp

@property
def grids(self) -> aa.GridsInterface:

return aa.GridsInterface(
uniform=self.grid,
lp=self.grid,
pixelization=self.grid,
)

Expand Down
2 changes: 1 addition & 1 deletion autolens/imaging/model/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def visualize(
)
plotter_interface.galaxies(
galaxies=tracer.galaxies,
grid=fit.grids.uniform,
grid=fit.grids.lp,
during_analysis=during_analysis,
)
if fit.inversion is not None:
Expand Down
6 changes: 3 additions & 3 deletions autolens/interferometer/fit_interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def profile_visibilities(self) -> aa.Visibilities:
transform to the sum of light profile images.
"""
return self.tracer.visibilities_from(
grid=self.grids.uniform, transformer=self.dataset.transformer
grid=self.grids.lp, transformer=self.dataset.transformer
)

@property
Expand Down Expand Up @@ -172,7 +172,7 @@ def galaxy_model_image_dict(self) -> Dict[ag.Galaxy, np.ndarray]:
data being fitted.
"""
galaxy_model_image_dict = self.tracer.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 @@ -194,7 +194,7 @@ def galaxy_model_visibilities_dict(self) -> Dict[ag.Galaxy, np.ndarray]:
are solved for first via the inversion.
"""
galaxy_model_visibilities_dict = self.tracer.galaxy_visibilities_dict_from(
grid=self.grids.uniform, transformer=self.dataset.transformer
grid=self.grids.lp, transformer=self.dataset.transformer
)

galaxy_linear_obj_visibilities_dict = self.galaxy_linear_obj_data_dict_from(
Expand Down
4 changes: 2 additions & 2 deletions autolens/interferometer/model/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def visualize(
tracer = fit.tracer_linear_light_profiles_to_light_profiles

plotter_interface.tracer(
tracer=tracer, grid=fit.grids.uniform, during_analysis=during_analysis
tracer=tracer, grid=fit.grids.lp, during_analysis=during_analysis
)
plotter_interface.galaxies(
galaxies=tracer.galaxies,
grid=fit.grids.uniform,
grid=fit.grids.lp,
during_analysis=during_analysis,
)
if fit.inversion is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def tracer_plotter(self) -> TracerPlotter:
"""
return TracerPlotter(
tracer=self.tracer,
grid=self.fit.grids.uniform,
grid=self.fit.grids.lp,
mat_plot_2d=self.mat_plot_2d,
visuals_2d=self.visuals_2d,
include_2d=self.include_2d,
Expand Down
4 changes: 2 additions & 2 deletions autolens/lens/to_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def lp_linear_func_list_galaxy_dict(
lp_linear_galaxy_dict_list = {}

traced_grids_of_planes_list = self.tracer.traced_grid_2d_list_from(
grid=self.dataset.grids.uniform
grid=self.dataset.grids.lp
)

if self.dataset.grids.blurring is not None:
Expand All @@ -178,7 +178,7 @@ def lp_linear_func_list_galaxy_dict(

for plane_index, galaxies in enumerate(self.planes):
grids = aa.GridsInterface(
uniform=traced_grids_of_planes_list[plane_index],
lp=traced_grids_of_planes_list[plane_index],
blurring=traced_blurring_grids_of_planes_list[plane_index],
)

Expand Down
2 changes: 1 addition & 1 deletion autolens/plot/get_visuals/two_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def via_fit_imaging_from(self, fit: FitImaging) -> aplt.Visuals2D:
visuals_2d_via_mask = self.via_mask_from(mask=fit.mask)

visuals_2d_via_tracer = self.via_tracer_from(
tracer=fit.tracer, grid=fit.grids.uniform, plane_index=0
tracer=fit.tracer, grid=fit.grids.lp, plane_index=0
)

return visuals_2d_via_mask + visuals_2d_via_tracer
2 changes: 1 addition & 1 deletion autolens/quantity/model/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def grid(self) -> aa.Grid2D:
"""
The masked 2D grid used by the dataset in the model-fit.
"""
return self.analysis.dataset.grids.uniform
return self.analysis.dataset.grids.lp

@property
def max_log_likelihood_tracer(self) -> Tracer:
Expand Down
2 changes: 1 addition & 1 deletion autolens/quantity/model/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ def visualize(
plotter_interface = PlotterInterface(image_path=paths.image_path)
plotter_interface.tracer(
tracer=fit.tracer,
grid=analysis.dataset.grids.uniform,
grid=analysis.dataset.grids.lp,
during_analysis=during_analysis,
)
2 changes: 1 addition & 1 deletion test_autolens/analysis/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test__use_border_relocator__determines_if_border_pixel_relocation_is_used(
)
)

masked_imaging_7x7.grids.uniform.grid_over_sampled[4] = np.array([300.0, 0.0])
masked_imaging_7x7.grids.lp.grid_over_sampled[4] = np.array([300.0, 0.0])

analysis = al.AnalysisImaging(
dataset=masked_imaging_7x7,
Expand Down
2 changes: 1 addition & 1 deletion test_autolens/analysis/test_plotter_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test__tracer(

plotter_interface.tracer(
tracer=tracer_x2_plane_7x7,
grid=masked_imaging_7x7.grids.uniform,
grid=masked_imaging_7x7.grids.lp,
during_analysis=False,
)

Expand Down
18 changes: 9 additions & 9 deletions test_autolens/imaging/test_fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def test__fit_figure_of_merit__sub_2(image_7x7, psf_3x3, noise_map_7x7, mask_2d_
data=image_7x7,
psf=psf_3x3,
noise_map=noise_map_7x7,
over_sampling=al.OverSamplingDataset(uniform=2),
over_sampling=al.OverSamplingDataset(lp=2),
)

masked_imaging_7x7 = dataset.apply_mask(
Expand Down Expand Up @@ -479,7 +479,7 @@ def test__galaxy_model_image_dict(masked_imaging_7x7):
fit = al.FitImaging(dataset=masked_imaging_7x7, tracer=tracer)

blurred_image_2d_list = tracer.blurred_image_2d_list_from(
grid=masked_imaging_7x7.grids.uniform,
grid=masked_imaging_7x7.grids.lp,
convolver=masked_imaging_7x7.convolver,
blurring_grid=masked_imaging_7x7.grids.blurring,
)
Expand Down Expand Up @@ -594,19 +594,19 @@ def test__subtracted_image_of_galaxies_dict(masked_imaging_7x7):
fit = al.FitImaging(dataset=masked_imaging_7x7, tracer=tracer)

g0_image = 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_image = 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
)

g2_image = g2.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 @@ -636,7 +636,7 @@ def test__subtracted_image_of_galaxies_dict(masked_imaging_7x7):
fit = al.FitImaging(dataset=masked_imaging_7x7, tracer=tracer)

blurred_image_2d_list = tracer.blurred_image_2d_list_from(
grid=masked_imaging_7x7.grids.uniform,
grid=masked_imaging_7x7.grids.lp,
convolver=masked_imaging_7x7.convolver,
blurring_grid=masked_imaging_7x7.grids.blurring,
)
Expand Down Expand Up @@ -740,19 +740,19 @@ def test___unmasked_blurred_images(masked_imaging_7x7):
fit = al.FitImaging(dataset=masked_imaging_7x7, tracer=tracer)

blurred_images_of_planes = tracer.blurred_image_2d_list_from(
grid=masked_imaging_7x7.grids.uniform,
grid=masked_imaging_7x7.grids.lp,
convolver=masked_imaging_7x7.convolver,
blurring_grid=masked_imaging_7x7.grids.blurring,
)

unmasked_blurred_image = tracer.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_planes_list = tracer.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
)

assert (
Expand Down
20 changes: 10 additions & 10 deletions test_autolens/imaging/test_simulate_and_fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,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=al.OverSamplingDataset(uniform=1)
over_sampling=al.OverSamplingDataset(lp=1)
)

mask = al.Mask2D.circular(
Expand Down Expand Up @@ -154,7 +154,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=al.OverSamplingDataset(uniform=1)
over_sampling=al.OverSamplingDataset(lp=1)
)

tracer = al.Tracer(galaxies=[lens_galaxy, source_galaxy])
Expand Down Expand Up @@ -198,7 +198,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)

lens_galaxy_image = lens_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 All @@ -210,7 +210,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_agree_with_standa
lens_galaxy_image, 1.0e-4
)

traced_grid_2d_list = tracer.traced_grid_2d_list_from(grid=masked_dataset.grids.uniform)
traced_grid_2d_list = tracer.traced_grid_2d_list_from(grid=masked_dataset.grids.lp)
traced_blurring_grid_2d_list = tracer.traced_grid_2d_list_from(
grid=masked_dataset.grids.blurring
)
Expand Down Expand Up @@ -263,7 +263,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization(

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

lens_galaxy_linear = al.Galaxy(
Expand Down Expand Up @@ -315,7 +315,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization(
assert fit_linear.figure_of_merit == pytest.approx(-84.04875317, 1.0e-4)

lens_galaxy_image = lens_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 Expand Up @@ -421,7 +421,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_
psf=dataset.psf,
noise_map=dataset.noise_map,
over_sampling=al.OverSamplingDataset(
uniform=2,
lp=2,
pixelization=2
)
)
Expand Down Expand Up @@ -465,7 +465,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_
assert fit_linear.figure_of_merit == pytest.approx(-84.36224277776512, 1.0e-4)

lens_galaxy_image = lens_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 Expand Up @@ -717,7 +717,7 @@ def test__fit_figure_of_merit__mge_mass_model(masked_imaging_7x7, masked_imaging
noise_map_path=path.join(file_path, "noise_map.fits"),
psf_path=path.join(file_path, "psf.fits"),
pixel_scales=0.2,
over_sampling=al.OverSamplingDataset(uniform=8)
over_sampling=al.OverSamplingDataset(lp=8)
)

mask = al.Mask2D.circular(
Expand Down Expand Up @@ -747,7 +747,7 @@ def test__fit_figure_of_merit__mge_mass_model(masked_imaging_7x7, masked_imaging
assert fit.chi_squared == pytest.approx(5.706423629698664e-05, 1e-4)

masked_dataset = masked_dataset.apply_over_sampling(
al.OverSamplingDataset(uniform=8)
al.OverSamplingDataset(lp=8)
)

basis = al.lp_basis.Basis(
Expand Down
4 changes: 2 additions & 2 deletions test_autolens/interferometer/test_fit_interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test___galaxy_model_image_dict(interferometer_7, interferometer_7_grid):
)

traced_grid_2d_list_from = tracer.traced_grid_2d_list_from(
grid=interferometer_7.grids.uniform
grid=interferometer_7.grids.lp
)

g0_image = g0.image_2d_from(grid=traced_grid_2d_list_from[0])
Expand Down Expand Up @@ -275,7 +275,7 @@ def test__galaxy_model_visibilities_dict(interferometer_7, interferometer_7_grid
fit = al.FitInterferometer(dataset=interferometer_7, tracer=tracer)

traced_grid_2d_list_from = tracer.traced_grid_2d_list_from(
grid=interferometer_7.grids.uniform
grid=interferometer_7.grids.lp
)

g0_profile_visibilities = g0.visibilities_from(
Expand Down
Loading

0 comments on commit 630f15c

Please sign in to comment.