Skip to content
This repository was archived by the owner on Oct 14, 2023. It is now read-only.
This repository was archived by the owner on Oct 14, 2023. It is now read-only.

farnocchia propagator returns NaN for some orbits #1296

@Yash-10

Description

@Yash-10

I tried to create ephemerides for an orbit that had a very small period (9.3605811e-8s).

import numpy as np; from poliastro.twobody.orbit import Orbit; from poliastro.twobody.propagation import cowell; from poliastro.ephem import Ephem

import astropy.units as u; from poliastro.bodies import Earth; from astropy.time import Time

r = np.array([-500, 1500, 4012.09]) << u.km
v = np.array([5021.38, -2900.7, 1000.354]) << u.km / u.s
orbit = Orbit.from_vectors(Earth, r, v, epoch=Time("2020-01-01"))

tofs = [100, 125, 150] << u.s
# Propagate the secondary body to generate its position coordinates.
rr, vv = cowell(
    Earth.k,
    orbit.r,
    orbit.v,
    tofs,
)

ephem = Ephem.from_orbit(orbit, orbit.epoch+tofs)
print(ephem.rv())

Output

(<Quantity [[nan, nan, nan],
           [nan, nan, nan],
           [nan, nan, nan]] km>, <Quantity [[nan, nan, nan],
           [nan, nan, nan],
           [nan, nan, nan]] km / s>)

For any t < 100 * u.s , the values were non-nan, whereas they start to become nan from the 100s mark.

I initially thought this might be because the period of the orbit is small whereas tof is high. I tried with another orbit, again with a small period of (8.3325481e-5s) but I got a non-nan result:

r = np.array([-5000, 1500, 4012.09]) << u.km
v = np.array([502.38, -2900.7, 1000.354]) << u.km / u.s
orbit = Orbit.from_vectors(Earth, r, v, epoch=Time("2020-01-01"))

tofs = [100, 125, 150] << u.s
rr, vv = cowell(
    Earth.k,
    orbit.r,
    orbit.v,
    tofs,
)

ephem = Ephem.from_orbit(orbit, orbit.epoch+tofs)
print(ephem.rv())

gives

(<Quantity [[  45239.34869765, -288568.58094236,  104045.47706077],
           [  57799.18822177, -361085.69078418,  129053.80351732],
           [  70359.02749432, -433602.79905165,  154062.12941078]] km>, <Quantity [[  502.39358751, -2900.68443511,  1000.33307316],
           [  502.39357529, -2900.68435797,  1000.33304546],
           [  502.393567  , -2900.68430656,  1000.33302714]] km / s>)

Also, for an orbit with a period of 1.0245247e-7s, the output values are nan.

Any suggestions on this would be helpful. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions