Skip to content

Commit

Permalink
horrible refactor nearly done
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Dec 15, 2024
1 parent e4a20aa commit 8598e8e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
6 changes: 2 additions & 4 deletions autolens/analysis/preloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,12 @@ def set_traced_grids_of_planes_for_inversion(self, fit_0, fit_1):

self.traced_grids_of_planes_for_inversion = None

over_sampled_grid = fit_0.grids.pixelization.over_sampler.uniform_over_sampled

traced_grids_of_planes_0 = fit_0.tracer.traced_grid_2d_list_from(
grid=over_sampled_grid
grid=fit_0.grids.pixelization
)

traced_grids_of_planes_1 = fit_1.tracer.traced_grid_2d_list_from(
grid=over_sampled_grid
grid=fit_0.grids.pixelization
)

if traced_grids_of_planes_0[-1] is not None:
Expand Down
2 changes: 1 addition & 1 deletion autolens/lens/to_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def mapper_galaxy_dict(self) -> Dict[aa.AbstractMapper, ag.Galaxy]:
].regularization,
source_plane_data_grid=traced_grids_of_planes_list[
plane_index
].grid_over_sampled,
],
source_plane_mesh_grid=traced_mesh_grids_list_of_planes[
plane_index
][mapper_index],
Expand Down
1 change: 1 addition & 0 deletions test_autolens/analysis/analysis/test_analysis_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
def test__modify_before_fit__inversion_no_positions_likelihood__raises_exception(
masked_imaging_7x7,
):

lens = al.Galaxy(redshift=0.5, mass=al.mp.IsothermalSph())

pixelization = al.Pixelization(
Expand Down
6 changes: 3 additions & 3 deletions 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[4] = np.array([300.0, 0.0])
masked_imaging_7x7.grids.uniform.grid_over_sampled[4] = np.array([300.0, 0.0])

analysis = al.AnalysisImaging(
dataset=masked_imaging_7x7,
Expand All @@ -105,7 +105,7 @@ def test__use_border_relocator__determines_if_border_pixel_relocation_is_used(
instance = model.instance_from_unit_vector([])
fit = analysis.fit_from(instance=instance)

grid = fit.inversion.linear_obj_list[0].source_plane_data_grid
grid = fit.inversion.linear_obj_list[0].source_plane_data_grid.grid_over_sampled

assert grid[2] == pytest.approx([-82.99114877, 52.81254922], 1.0e-4)

Expand All @@ -117,7 +117,7 @@ def test__use_border_relocator__determines_if_border_pixel_relocation_is_used(
instance = model.instance_from_unit_vector([])
fit = analysis.fit_from(instance=instance)

grid = fit.inversion.linear_obj_list[0].source_plane_data_grid
grid = fit.inversion.linear_obj_list[0].source_plane_data_grid.grid_over_sampled

assert grid[2] == pytest.approx([-82.89544515, 52.7491249], 1.0e-4)

Expand Down

0 comments on commit 8598e8e

Please sign in to comment.