Skip to content

Commit

Permalink
unit test for previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoleski committed Jun 24, 2024
1 parent 25fc338 commit c2ad834
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions source/MulensModel/tests/test_ModelParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,18 +772,21 @@ def test_xallarap_n_sources():
assert model_4.n_sources == 1


def test_2S1L_xallarap_individual_source_parameters():
def _test_2S1L_xallarap_individual_source_parameters(xi_u):
"""
Make sure that parameters of both sources are properly set.
Most importantly, xi_u is shifted by 180 deg and xi_a is scaled by
q_source.
Most importantly, xi_u is shifted by 180 deg and xi_a is scaled by q_source.
"""
q_source = 1.23456
parameters_1st = {**xallarap_parameters}
parameters_1st['xi_argument_of_latitude_reference'] = xi_u

parameters_2nd = {**parameters_1st}
parameters_2nd['xi_semimajor_axis'] /= q_source
parameters_2nd['xi_argument_of_latitude_reference'] += 180.
if xi_u < 180:
parameters_2nd['xi_argument_of_latitude_reference'] += 180.
else:
parameters_2nd['xi_argument_of_latitude_reference'] -= 180.

parameters = {'q_source': q_source, **parameters_1st}
model = mm.ModelParameters(parameters)
Expand All @@ -796,6 +799,20 @@ def test_2S1L_xallarap_individual_source_parameters():
assert check_2nd == parameters_2nd


def test_2S1L_xallarap_individual_source_parameters_1():
"""
Make sure xi_u is increased by 180 for small input.
"""
_test_2S1L_xallarap_individual_source_parameters(xi_u=8.642)


def test_2S1L_xallarap_individual_source_parameters_2():
"""
Make sure xi_u is increased by 180 for large input.
"""
_test_2S1L_xallarap_individual_source_parameters(xi_u=234.567)


tested_keys_3 = tested_keys_2 + ['q_source']


Expand Down

0 comments on commit c2ad834

Please sign in to comment.