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
16 changes: 10 additions & 6 deletions test_autolens/analysis/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,12 @@ def test__positions_threshold_from(analysis_imaging_7x7):
# x = 0), so the point solver's branch is decided by sub-ULP tie-breaking; PyAutoArray#519's
# exact identity transform at angle 0 selected the other branch (positions_threshold
# 0.0019501455 -> 0.0019534291, positions[1].x sign flip, magnitude bit-identical). Values
# are the exact-transform branch; a 1e-15 centre nudge flips them. See PyAutoLens#721.
assert result.positions_threshold_from() == pytest.approx(0.0019534291, 1.0e-4)
# are the exact-transform branch; a 1e-15 centre nudge flips them. The value moved again
# (0.0019534291 -> 0.00098983199) when the Isothermal q <= 0.99999 clamp was removed
# (PyAutoGalaxy#631), as the fixture is now exactly circular. See PyAutoLens#721.
assert result.positions_threshold_from() == pytest.approx(0.00098983199, 1.0e-4)
assert result.positions_threshold_from(factor=5.0) == pytest.approx(
0.0097671455155, 1.0e-4
0.0049491599483, 1.0e-4
)
assert result.positions_threshold_from(minimum_threshold=10.0) == pytest.approx(
10.0, 1.0e-4
Expand Down Expand Up @@ -346,12 +348,14 @@ def test__positions_likelihood_from__mass_centre_radial_distance_min(
# x = 0), so the point solver's branch is decided by sub-ULP tie-breaking; PyAutoArray#519's
# exact identity transform at angle 0 selected the other branch (positions_threshold
# 0.0019501455 -> 0.0019534291, positions[1].x sign flip, magnitude bit-identical). Values
# are the exact-transform branch; a 1e-15 centre nudge flips them. See PyAutoLens#721.
# are the exact-transform branch; a 1e-15 centre nudge flips them. The positions moved
# again (branch and order) when the Isothermal q <= 0.99999 clamp was removed
# (PyAutoGalaxy#631), as the fixture is now exactly circular. See PyAutoLens#721.
assert positions_likelihood.positions[0] == pytest.approx(
(-1.00097656e00, 5.63818622e-04), 1.0e-4
(9.99023438e-01, 5.63818622e-04), 1.0e-4
)
assert positions_likelihood.positions[1] == pytest.approx(
(1.00097656e00, 5.63818622e-04), 1.0e-4
(-1.00000000e00, 1.12763724e-03), 1.0e-4
)


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 @@ -494,7 +494,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization(
assert fit_linear.inversion.reconstruction[0:2] == pytest.approx(
np.array(
[
99.993449641, 0.114213814,
99.993447113, 0.114229460,
]
),
1.0e-4,
Expand Down Expand Up @@ -617,7 +617,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_
assert fit_linear.inversion.reconstruction[0:2] == pytest.approx(
np.array(
[
99.974078996, 0.251635768,
99.974074623, 0.251662353,
]
),
1.0e-4,
Expand Down Expand Up @@ -757,13 +757,13 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_
assert fit_linear.inversion.reconstruction[0:3] == pytest.approx(
np.array(
[
1.00179579e+02, 5.35321466e-01, 8.55754143e-01
1.00179521e+02, 2.48877703e-01, 9.28951186e-01
]
),
1.0e-4,
)

assert fit_linear.figure_of_merit == pytest.approx(-190.564548990939, 1.0e-4)
assert fit_linear.figure_of_merit == pytest.approx(-190.664392317177, 1.0e-4)

lens_galaxy_image = lens_galaxy.blurred_image_2d_from(
grid=masked_dataset.grids.lp,
Expand All @@ -779,15 +779,15 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_
)

assert fit_linear.galaxy_model_image_dict[source_galaxy_pix][0] == pytest.approx(
0.1667703826, 1.0e-4
0.1579572359, 1.0e-4
)

assert fit_linear.model_images_of_planes_list[1][0] == pytest.approx(
0.166757208736973, 1.0e-4
0.157957235866697, 1.0e-4
)

assert fit_linear.subtracted_images_of_planes_list[1][0] == pytest.approx(
0.180018267146, 1.0e-4
0.180065151300, 1.0e-4
)


Expand All @@ -804,13 +804,13 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_and_pixelization_
assert fit_linear.inversion.reconstruction[0:2] == pytest.approx(
np.array(
[
99.9785287998059,
0.8958653625423
99.9796865598131,
0.7557985549100
]
),
1.0e-4,
)
assert fit_linear.figure_of_merit == pytest.approx(-190.6935526756, 1.0e-4)
assert fit_linear.figure_of_merit == pytest.approx(-190.7901143681, 1.0e-4)


def test__fit_figure_of_merit__mge_mass_model(masked_imaging_7x7, masked_imaging_covariance_7x7):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,16 @@ def test__simulate_interferometer_data_and_fit__linear_light_profiles_and_pixeli
assert fit_linear.inversion.reconstruction == pytest.approx(
np.array(
[
101.76664331,
0.49639672,
0.49531196,
0.49854243,
0.44661417,
0.44782337,
0.44844437,
0.39942579,
0.40320996,
0.40104302,
102.21688734,
0.61507474,
0.61369673,
0.61727889,
0.55279219,
0.55418069,
0.55482003,
0.49375700,
0.49858010,
0.49588652,
]
),
1.0e-2,
Expand Down
Loading