From a09a910abf3a81ef81b1858a8467bcb79713de92 Mon Sep 17 00:00:00 2001 From: rpoleski Date: Thu, 25 Apr 2024 05:44:02 +0200 Subject: [PATCH] adding ModelParameters._check_orbit_parameters() --- source/MulensModel/modelparameters.py | 17 +++++++++++++---- source/MulensModel/version.py | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/source/MulensModel/modelparameters.py b/source/MulensModel/modelparameters.py index 8c2f35530..7cae86183 100644 --- a/source/MulensModel/modelparameters.py +++ b/source/MulensModel/modelparameters.py @@ -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): diff --git a/source/MulensModel/version.py b/source/MulensModel/version.py index 736365772..924ad48fb 100644 --- a/source/MulensModel/version.py +++ b/source/MulensModel/version.py @@ -1 +1 @@ -__version__ = "2.21.4" +__version__ = "2.21.5"