def test__furthest_separation_of_source_plane_positions(self): positions = al.Grid2DIrregular(grid=[(0.0, 0.0), (0.0, 1.0)]) noise_map = al.ValuesIrregular([[1.0, 1.0]]) tracer = mock.MockTracer(traced_grid=positions) fit = al.FitPositionsSourceMaxSeparation(positions=positions, noise_map=noise_map, tracer=tracer) assert fit.furthest_separations_of_source_plane_positions.in_list == [ 1.0, 1.0 ] assert fit.max_separation_of_source_plane_positions == 1.0 assert fit.max_separation_within_threshold(threshold=2.0) == True assert fit.max_separation_within_threshold(threshold=0.5) == False positions = al.Grid2DIrregular(grid=[(0.0, 0.0), (0.0, 1.0), (0.0, 3.0)]) noise_map = al.ValuesIrregular([1.0, 1.0, 1.0]) tracer = mock.MockTracer(traced_grid=positions) fit = al.FitPositionsSourceMaxSeparation(positions=positions, noise_map=noise_map, tracer=tracer) assert fit.furthest_separations_of_source_plane_positions.in_list == [ 3.0, 2.0, 3.0, ] assert fit.max_separation_of_source_plane_positions == 3.0 assert fit.max_separation_within_threshold(threshold=3.5) == True assert fit.max_separation_within_threshold(threshold=2.0) == False assert fit.max_separation_within_threshold(threshold=0.5) == False
def test__same_as_above_with_real_tracer(self): tracer = al.Tracer.from_galaxies( galaxies=[ al.Galaxy( redshift=0.5, mass=al.mp.SphericalIsothermal(einstein_radius=1.0) ), al.Galaxy(redshift=1.0), ] ) noise_map = al.ValuesIrregularGrouped([[1.0, 1.0]]) positions = al.GridIrregularGrouped([[(1.0, 0.0), (-1.0, 0.0)]]) fit = al.FitPositionsSourceMaxSeparation( positions=positions, noise_map=noise_map, tracer=tracer ) assert fit.max_separation_within_threshold(threshold=0.01) positions = al.GridIrregularGrouped([[(1.2, 0.0), (-1.0, 0.0)]]) fit = al.FitPositionsSourceMaxSeparation( positions=positions, noise_map=noise_map, tracer=tracer ) assert fit.max_separation_within_threshold(threshold=0.3) assert not fit.max_separation_within_threshold(threshold=0.15)