Skip to content

Commit

Permalink
in OrbitCircular change: periapsis_epoch -> ascending_node_epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoleski committed Jul 22, 2023
1 parent 2ccd180 commit 433e103
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
29 changes: 16 additions & 13 deletions source/MulensModel/orbits/orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ def _check_circular_orbit_parameters(self, semimajor_axis):
raise ValueError('Semimajor axis has to be positive.\n'
'Provided value: ' + str(semimajor_axis))

def _check_and_get_for_periapsis_epoch(
def _check_for_and_get_periapsis_epoch(
self, periapsis_epoch, argument_of_latitude_reference,
epoch_reference):
"""
Check if arguments properly define epoch of
the periapsis/ascending node passage
the periapsis (eccentric orbit) or
the ascending node (circular orbit) passage
"""
if periapsis_epoch is not None:
if argument_of_latitude_reference is not None:
Expand Down Expand Up @@ -179,34 +180,36 @@ class OrbitCircular(_OrbitAbstract):
inclination: *float*
Inclination of the orbit relative to plane of the sky.
periapsis_epoch: *float* or *None*
Epoch when body is in
the ascending node (periapsis is for eccentric orbits).
ascending_node_epoch: *float* or *None*
Epoch when body is in the ascending node.
It's in days and usually you want to provide full BJD or HJD.
argument_of_latitude_reference: *float* or *None*
Argument of latitude (i.e., u = omega + nu(t_ref)) for
*epoch_reference*, which together define
*periapsis_epoch* (omega).
*ascending_node_epoch* (omega).
epoch_reference: *float* or *None*
Reference epoch that together with
*argument_of_latitude_reference* defines
*periapsis_epoch* (omega).
*ascending_node_epoch* (omega).
"""
def __init__(self, period, semimajor_axis, Omega_node, inclination,
periapsis_epoch=None,
ascending_node_epoch=None,
argument_of_latitude_reference=None, epoch_reference=None):
self._period = period
self._check_circular_orbit_parameters(semimajor_axis)
periapsis_epoch = self._check_and_get_for_periapsis_epoch(
periapsis_epoch, argument_of_latitude_reference, epoch_reference)
ascending_node_epoch = self._check_for_and_get_periapsis_epoch(
ascending_node_epoch, argument_of_latitude_reference,
epoch_reference)
self._set_circular_orbit_parameters(
period, semimajor_axis, Omega_node, inclination, periapsis_epoch)
period, semimajor_axis, Omega_node,
inclination, ascending_node_epoch)

def _get_periapsis_epoch(self, u_reference, epoch_reference):
"""
Calculate periapsis epoch based on
Calculate ascending node epoch
(called periapis in general case of eccentric orbits) based on
the argument_of_latitude (u) at given epoch
"""
time_shift = self._period * u_reference / (2. * np.pi)
Expand Down Expand Up @@ -280,7 +283,7 @@ def __init__(
self._omega_periapsis = omega_periapsis * np.pi / 180.
self._eccentricity = eccentricity
self._check_circular_orbit_parameters(semimajor_axis)
periapsis_epoch = self._check_and_get_for_periapsis_epoch(
periapsis_epoch = self._check_for_and_get_periapsis_epoch(
periapsis_epoch, argument_of_latitude_reference, epoch_reference)
self._set_circular_orbit_parameters(
period, semimajor_axis, Omega_node, inclination, periapsis_epoch)
Expand Down
9 changes: 5 additions & 4 deletions source/MulensModel/tests/test_Orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_1_circular():
circular orbit - simples calculation
"""
orbit = OrbitCircular(period=365., semimajor_axis=1., Omega_node=0.,
inclination=0., periapsis_epoch=0.)
inclination=0., ascending_node_epoch=0.)
position = orbit.get_orbital_plane_position(time=0.)
assert_almost_equal(position, [1., 0.])

Expand Down Expand Up @@ -119,7 +119,7 @@ def test_12_Orbit_class_circular():
Orbit class and simplest calculation for circular orbit
"""
orbit = Orbit(period=365., semimajor_axis=1., Omega_node=0.,
inclination=0., periapsis_epoch=0.)
inclination=0., ascending_node_epoch=0.)
position = orbit.get_orbital_plane_position(time=0.)
assert_almost_equal(position, [1., 0.])

Expand Down Expand Up @@ -164,7 +164,7 @@ def test_16_added_epoch(self):
with self.assertRaises(RuntimeError):
OrbitCircular(
period=123., semimajor_axis=5., Omega_node=90., inclination=0.,
periapsis_epoch=2450000., epoch_reference=2450000.)
ascending_node_epoch=2450000., epoch_reference=2450000.)

def test_17_added_u(self):
"""
Expand All @@ -173,7 +173,8 @@ def test_17_added_u(self):
with self.assertRaises(RuntimeError):
OrbitCircular(
period=123., semimajor_axis=5., Omega_node=90., inclination=0.,
periapsis_epoch=2450000., argument_of_latitude_reference=90.)
ascending_node_epoch=2450000.,
argument_of_latitude_reference=90.)


def test_18_OrbitEccentric_based_on_argument_of_latitude():
Expand Down

0 comments on commit 433e103

Please sign in to comment.