Skip to content

Commit

Permalink
adding ModelParameters._check_orbit_parameters()
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoleski committed Apr 25, 2024
1 parent b590083 commit a09a910
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions source/MulensModel/modelparameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,17 +673,26 @@ def _check_valid_combination_1_source_xallarap(self, keys):
if not self._type['xallarap']:
return

required = ('xi_period xi_semimajor_axis xi_inclination '
'xi_Omega_node xi_argument_of_latitude_reference').split()
self._check_orbit_parameters(keys, "xi_")

def _check_orbit_parameters(self, keys, prefix):
"""
check if orbit is properly defined; prefix is added to
checked orbit parameters
"""
required = ('period semimajor_axis inclination '
'Omega_node argument_of_latitude_reference').split()
required = [prefix + req for req in required]
for parameter in required:
if parameter not in keys:
raise KeyError(parameter)

allowed = set(['xi_eccentricity', 'xi_omega_periapsis'])
allowed = set([prefix + 'eccentricity', prefix + 'omega_periapsis'])
n_used = len(set(keys).intersection(allowed))
if n_used not in [0, len(allowed)]:
raise KeyError(
'Error in defining xi_eccentricity and xi_omega_periapsis. '
'Error in defining ' + prefix + 'eccentricity and ' +
prefix + 'omega_periapsis. ' +
'Both of them or neither should be defined.')

def _check_valid_combination_1_source_Cassan08(self, keys):
Expand Down
2 changes: 1 addition & 1 deletion source/MulensModel/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.21.4"
__version__ = "2.21.5"

0 comments on commit a09a910

Please sign in to comment.