Skip to content

Commit

Permalink
simplify API
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Dec 16, 2024
1 parent 8055f80 commit fe1f255
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions autogalaxy/analysis/analysis/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ def save_attributes(self, paths: af.DirectoryPaths):
)
paths.save_fits(
name="over_sampling_size_lp",
hdu=self.dataset.grids.lp.over_sampling_size.native.hdu_for_output,
hdu=self.dataset.grids.lp.over_sample_size.native.hdu_for_output,
prefix="dataset",
)
paths.save_fits(
name="over_sampling_size_pixelization",
hdu=self.dataset.grids.pixelization.over_sampling_size.native.hdu_for_output,
hdu=self.dataset.grids.pixelization.over_sample_size.native.hdu_for_output,
prefix="dataset",
)
paths.save_json(
Expand Down
2 changes: 1 addition & 1 deletion autogalaxy/galaxy/galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def traced_grid_2d_from(self, grid: aa.type.Grid2DLike) -> aa.type.Grid2DLike:
return aa.Grid2D(
values=grid - self.deflections_yx_2d_from(grid=grid),
mask=grid.mask,
over_sampling_size=grid.over_sampling_size,
over_sample_size=grid.over_sample_size,
over_sampled=grid.over_sampled - self.deflections_yx_2d_from(
grid=grid.over_sampled
)
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 @@ -34,8 +34,8 @@ 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.lp.over_sampling_size[0] == 5
assert dataset_list[0].grids.pixelization.over_sampling_size[0] == 3
assert dataset_list[0].grids.lp.over_sample_size[0] == 5
assert dataset_list[0].grids.pixelization.over_sample_size[0] == 3

clean(database_file=database_file)

Expand Down
8 changes: 4 additions & 4 deletions test_autogalaxy/galaxy/test_galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,13 +639,13 @@ def test__decorator__oversample_uniform__numerical_values(gal_x1_lp):

galaxy = ag.Galaxy(redshift=0.5, light=ag.lp.Sersic(intensity=1.0))

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=1)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=1)

image = galaxy.image_2d_from(grid=grid)

assert image[0] == pytest.approx(0.15987224303572964, 1.0e-6)

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=2)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=2)

image = galaxy.image_2d_from(grid=grid)

Expand All @@ -656,13 +656,13 @@ def test__decorator__oversample_uniform__numerical_values(gal_x1_lp):
redshift=0.5, light=ag.lp.Sersic(centre=(3.0, 3.0), intensity=1.0)
)

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=1)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=1)

image = galaxy.image_2d_from(grid=grid)

assert image[0] == pytest.approx(0.006719704400094508, 1.0e-6)

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=2)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=2)

image = galaxy.image_2d_from(grid=grid)

Expand Down
4 changes: 2 additions & 2 deletions test_autogalaxy/imaging/test_simulate_and_fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test__perfect_fit__chi_squared_0():
grid = ag.Grid2D.uniform(
shape_native=(11, 11),
pixel_scales=0.2,
over_sampling_size=1,
over_sample_size=1,
)

psf = ag.Kernel2D.from_gaussian(
Expand Down Expand Up @@ -141,7 +141,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_agree_with_standa
grid = ag.Grid2D.uniform(
shape_native=(11, 11),
pixel_scales=0.2,
over_sampling_size=1,
over_sample_size=1,
)

psf = ag.Kernel2D.from_gaussian(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test__perfect_fit__chi_squared_0():
grid = ag.Grid2D.uniform(
shape_native=(51, 51),
pixel_scales=0.1,
over_sampling_size=1,
over_sample_size=1,
)

galaxy_0 = ag.Galaxy(
Expand Down Expand Up @@ -143,7 +143,7 @@ def test__linear_light_profiles_agree_with_standard_light_profiles():
grid = ag.Grid2D.uniform(
shape_native=(51, 51),
pixel_scales=0.1,
over_sampling_size=1,
over_sample_size=1,
)

galaxy = ag.Galaxy(
Expand Down
2 changes: 1 addition & 1 deletion test_autogalaxy/operate/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test__unmasked_blurred_image_2d_from():
pixel_scales=1.0,
)

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=1)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=1)

lp = ag.lp.Sersic(intensity=0.1)

Expand Down
10 changes: 5 additions & 5 deletions test_autogalaxy/profiles/light/standard/test_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test__image_1d_from__grid_2d_in__returns_1d_image_via_projected_quantities()
grid_2d = ag.Grid2D.uniform(
shape_native=(5, 5),
pixel_scales=1.0,
over_sampling_size=1,
over_sample_size=1,
)

lp = ag.lp.Gaussian(
Expand Down Expand Up @@ -91,13 +91,13 @@ def test__decorator__oversample_uniform__numerical_values(gal_x1_lp):

lp = ag.lp.Sersic(intensity=1.0)

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=1)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=1)

image = lp.image_2d_from(grid=grid)

assert image[0] == pytest.approx(0.15987224303572964, 1.0e-6)

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=2)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=2)

image = lp.image_2d_from(grid=grid)

Expand All @@ -106,13 +106,13 @@ def test__decorator__oversample_uniform__numerical_values(gal_x1_lp):

lp = ag.lp.Sersic(centre=(3.0, 3.0), intensity=1.0)

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=1)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=1)

image = lp.image_2d_from(grid=grid)

assert image[0] == pytest.approx(0.006719704400094508, 1.0e-6)

grid = ag.Grid2D.from_mask(mask=mask, over_sampling_size=2)
grid = ag.Grid2D.from_mask(mask=mask, over_sample_size=2)

image = lp.image_2d_from(grid=grid)

Expand Down
2 changes: 1 addition & 1 deletion test_autogalaxy/profiles/mass/abstract/test_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test__decorators__convergence_1d_from__grid_2d_in__returns_1d_image_via_proj
grid_2d = ag.Grid2D.uniform(
shape_native=(5, 5),
pixel_scales=1.0,
over_sampling_size=1,
over_sample_size=1,
)

sie = ag.mp.Isothermal(centre=(0.0, 0.0), ell_comps=(0.0, 0.0), einstein_radius=1.0)
Expand Down

0 comments on commit fe1f255

Please sign in to comment.