Closed Mohammad-Mardini closed 6 years ago
I don't exactly understand what is your problem.
The initial conditions for a single orbit should be a 6-d array, but the ordering of its elements is different between Agama and Galpy. Agama uses Cartesian coordinates: x,y,z,vx,vy,vz. Galpy uses Cylindrical coordinates in some weird order: R, vR, vphi, z, vz, phi. Moreover, in Agama you may integrate many orbits at once (parallelized internally), by passing a 2d Nx6 array of initial conditions. The integration time is also specified differently: in Agama, you set the total time and the number of equally-spaced points sampled from the trajectory. in Galpy, you provide an arbitrary array of times at which the trajectory is needed. I think in both cases (certainly in Agama) the internal timestep of orbit integration is independent of the requested output times. So if you want to integrate an orbit in galpy, pass the array of output times (in the example program, it was a uniformly spaced array created by numpy.linspace). Of course you don't need Agama for this. You may also use Galpy orbit integration and action computation routines with a potential provided by Agama, but this is not practical (much slower than using equivalent native Agama routines), and is provided only for testing the compatibility.
Hi everyone,
I'm trying to run galpypot.py, unfortunately, I faced the following problem in lines 156 - 165, where I have to create an array of initial conditions
ic is the array of initial conditions: R, z, phi, vR, vz, vphi
def compare(ic, inttime, numsteps): times = _numpy.linspace(0, inttime, numsteps)
integrate the orbit in galpy using MWPotential2014 from galpy
g_orb_obj = galpy.orbit.Orbit([ic[0],ic[3],ic[5],ic[1],ic[4],ic[2]]) dt = time.time() g_orb_obj.integrate(times, g_pot) g_orb = g_orb_obj.getOrbit() print('Time to integrate orbit in galpy: %.4g s' % (time.time()-dt))
Now, I have two questions: 1- How to create this array? 2- I had created an arbitrary array ic=[11.1, 12.24, 7.25, 11.1, 12.24, 7.25], then I got the following problem `--------------------------------------------------------------------------- NameError Traceback (most recent call last)