Skip to content

Commit

Permalink
Merge branch 'elastic_format_data' of https://github.com/nkhadka21/slsim
Browse files Browse the repository at this point in the history
 into elastic_format_data

merged to remote.
  • Loading branch information
nkhadka21 committed Dec 6, 2024
2 parents 0395c5a + 6b1ecc2 commit 03ebc23
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions tests/test_lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def setup_method(self):
if gg_lens.validity_test(mag_arc_limit=mag_arc_limit):
self.gg_lens = gg_lens
break

def test_lens_id_gg(self):
lens_id = self.gg_lens.generate_id()
ra = self.gg_lens.deflector_position[0]
dec = self.gg_lens.deflector_position[1]
ra2=12.03736542
dec2=35.17363534
lens_id2=self.gg_lens.generate_id(ra=ra2, dec=dec2)
ra2 = 12.03736542
dec2 = 35.17363534
lens_id2 = self.gg_lens.generate_id(ra=ra2, dec=dec2)
assert lens_id == f"GG-LENS-{ra:.4f}_{dec:.4f}"
assert lens_id2 == f"GG-LENS-{ra2:.4f}_{dec2:.4f}"

Expand Down Expand Up @@ -312,15 +312,17 @@ def test_point_source_magnitude(pes_lens_instance):
assert len(mag) >= 2
assert len(mag_unlensed) == 1


def test_lens_id_qso(pes_lens_instance):
lens_id = pes_lens_instance.generate_id()
ra = pes_lens_instance.deflector_position[0]
dec = pes_lens_instance.deflector_position[1]
ra2=12.03736542
dec2=35.17363534
lens_id2=pes_lens_instance.generate_id(ra=ra2, dec=dec2)
assert lens_id == f"QSO-LENS-{ra:.4f}_{dec:.4f}"
assert lens_id2 == f"QSO-LENS-{ra2:.4f}_{dec2:.4f}"
lens_id = pes_lens_instance.generate_id()
ra = pes_lens_instance.deflector_position[0]
dec = pes_lens_instance.deflector_position[1]
ra2 = 12.03736542
dec2 = 35.17363534
lens_id2 = pes_lens_instance.generate_id(ra=ra2, dec=dec2)
assert lens_id == f"QSO-LENS-{ra:.4f}_{dec:.4f}"
assert lens_id2 == f"QSO-LENS-{ra2:.4f}_{dec2:.4f}"


@pytest.fixture
def supernovae_lens_instance():
Expand Down Expand Up @@ -356,6 +358,7 @@ def supernovae_lens_instance():
break
return supernovae_lens


def test_point_source_magnitude_with_lightcurve(supernovae_lens_instance):
supernovae_lens = supernovae_lens_instance
mag = supernovae_lens.point_source_magnitude(band="r", lensed=True)[0]
Expand Down Expand Up @@ -538,16 +541,19 @@ def supernovae_lens_instance_double_sersic_multisource():
break
return supernovae_lens


def test_lens_id_snia(supernovae_lens_instance_double_sersic_multisource):
lens_id = supernovae_lens_instance_double_sersic_multisource.generate_id()
ra = supernovae_lens_instance_double_sersic_multisource.deflector_position[0]
dec = supernovae_lens_instance_double_sersic_multisource.deflector_position[1]
ra2=12.03736542
dec2=35.17363534
lens_id2=supernovae_lens_instance_double_sersic_multisource.generate_id(
ra=ra2, dec=dec2)
assert lens_id == f"SNIa-LENS-{ra:.4f}_{dec:.4f}"
assert lens_id2 == f"SNIa-LENS-{ra2:.4f}_{dec2:.4f}"
lens_id = supernovae_lens_instance_double_sersic_multisource.generate_id()
ra = supernovae_lens_instance_double_sersic_multisource.deflector_position[0]
dec = supernovae_lens_instance_double_sersic_multisource.deflector_position[1]
ra2 = 12.03736542
dec2 = 35.17363534
lens_id2 = supernovae_lens_instance_double_sersic_multisource.generate_id(
ra=ra2, dec=dec2
)
assert lens_id == f"SNIa-LENS-{ra:.4f}_{dec:.4f}"
assert lens_id2 == f"SNIa-LENS-{ra2:.4f}_{dec2:.4f}"


class TestMultiSource(object):
def setup_method(self):
Expand Down

0 comments on commit 03ebc23

Please sign in to comment.