Skip to content
Advertisement

Orbit integration in galpy without specifying the time steps array

I just discovered galpy and went all day through documentation and examples but I am still a little confused about the possibility to integrate an orbit without specifying the set of times.

A simple example present in the documentation reads:

from galpy import potential
import numpy
ts= numpy.linspace(0,100,10000)
o= Orbit([1.,0.1,1.1,0.,0.1,0.])
o.integrate(ts,potential.MWPotential2014)

but I ask if it’s possible to use the integrate method without specifying the whole array of times but only the amount of time in the appropriate units. For example:

t = 100
o.integrate(t, potential.MWPotential2014)

Thank you.

Advertisement

Answer

If the documentation doesn’t say such an interface exists, you can probably assume it doesn’t, though a quick look at the code confirms this. In any case, even if such a shortcut existed the integrator functions themselves still require an array of time steps to integrate over, so this would be just a shortcut.

Even if you just wanted to specify “an amount of time” you would still need to also provide a time step, though you could also have a default time step. You could write your own shortcut function like:

def integrate_orbit(orbit, pot, t, dt=0.01):
    t = np.arange(0, t, dt)
    return orbit.integrate(t, pot)
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement