Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust for LOS #285

Merged
merged 13 commits into from
Nov 21, 2024
3 changes: 2 additions & 1 deletion slsim/ParamDistributions/kext_gext_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def get_kappa_gamma(self, z_source, z_lens, use_nonlinear_correction=False):
:param use_nonlinear_correction: Boolean to use the nonlinear correction data.
:return: Tuple of gamma and kappa values.
"""

if z_source <= z_lens:
return 0.0, 0.0
z_source_rounded = self._round_to_nearest_0_1(z_source)
z_lens_rounded = self._round_to_nearest_0_1(z_lens)
if z_lens_rounded == z_source_rounded:
Expand Down
5 changes: 5 additions & 0 deletions tests/test_kext_gext_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def test_valid_inputs():
assert isinstance(result2[0], float)
assert isinstance(result2[1], float)

result3 = line_of_sight.get_kappa_gamma(0.3, 0.4)
assert isinstance(result3, tuple)
assert len(result3) == 2
assert result3[0] == 0.0


def test_invalid():
with pytest.raises(FileNotFoundError):
Expand Down
Loading