Two Dimensional Galactic Orbits - Part 2

We will be using an open source package, called GalPy, that has been used in research.

The code is available via github: https://github.com/jobovy/galpy

A paper that describes the code via ASCL http://ascl.net/galpy

To install:

   cd ASTR288
   git clone  https://github.com/jobovy/galpy
   cd galpy
   # first try out a build (compilation!) - 
   #      make sure you use the right (miniconda3) python
   which python
   python setup.py build

   # if this all works, it can be "installed"
   python setup.py install

   # this will install it within your `which python` tree

   # an alternative is to use pip:
   pip install galpy
   # which for this package happens to work.

In [ ]:
%matplotlib inline

In [ ]:
import galpy
import galpy.potential
# 
print(galpy.__file__)
print(galpy.__version__)

In [ ]:
print([p for p in dir(galpy.potential) if 'Potential' in p])

In [ ]:
from galpy.orbit import Orbit

In [ ]:
from galpy.potential import PlummerPotential
pp = PlummerPotential(amp=1.0,b=1.0)

In [ ]:
pp.vcirc(1.0)

In [ ]:
o1= Orbit(vxvv=[1.,0.1,1.1,0.,0.1])

In [ ]:
import numpy as np
ts = np.linspace(0,100,10000)

In [ ]:
o1.integrate(ts,pp,method='leapfrog')

In [ ]:
o2= Orbit(vxvv=[1.,0.1,1.1,0.,0.1])
o2.integrate(ts,pp,method='odeint')

In [ ]:
o1.plot()
o2.plot()

In [ ]:
o1.plotE(normed=True)
o2.plotE(normed=True)