In [1]:
import astropy.units as u
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline

from streamteam.potential.apw import PW14Potential
import streamteam.dynamics as sd
import streamteam.integrate as si
import streamteam.io as sio
from streamteam.util import use_backend
from streamteam.units import galactic

In [2]:
scf = sio.APWSCFReader("/Users/adrian/projects/morphology/simulations/runs/thin2/")
ppars = scf.read_potential(units=galactic)
potential = PW14Potential(**ppars)

In [8]:
ppars


Out[8]:
{'a': 6.5,
 'b': 0.26,
 'c': 0.3,
 'm_disk': 65000000000.0,
 'm_spher': 20000000000.0,
 'phi': 1.570796,
 'psi': 1.570796,
 'q1': 1.3,
 'q2': 1.0,
 'q3': 0.8,
 'r_h': 30.0,
 'theta': 1.570796,
 'v_h': 0.5600371815834104}

In [3]:
main_w0 = np.array([20.,2.5,4,0.,0.1,0.17])
spread = np.array([0.01,0.01,0.01,0.001,0.001,0.001])
w0 = np.random.normal(main_w0, spread, size=(100,6))

t,w = potential.integrate_orbit(w0, dt=0.2, nsteps=50000, Integrator=si.DOPRI853Integrator)
fig = sd.plot_orbits(w, ix=0., marker='.', alpha=0.1, linestyle='none')



In [6]:
actions,angles,freqs = sd.find_actions(t, w, N_max=6, units=galactic)

In [7]:
freqs


Out[7]:
array([[ 0.01775442,  0.01248167,  0.01206641],
       [ 0.01782622,  0.0125303 ,  0.01211811],
       [ 0.01773377,  0.01246973,  0.01205385],
       [ 0.01766598,  0.01242611,  0.01200829],
       [ 0.01783419,  0.01253735,  0.01212566],
       [ 0.01771524,  0.01245485,  0.01203789],
       [ 0.01766607,  0.0124236 ,  0.01200515],
       [ 0.01786477,  0.01255475,  0.01214369],
       [ 0.01772143,  0.01245994,  0.01204393],
       [ 0.0177697 ,  0.01249408,  0.01207967],
       [ 0.01770056,  0.01244618,  0.01202868],
       [ 0.01782335,  0.01252989,  0.01211768],
       [ 0.01788383,  0.0125684 ,  0.01215822],
       [ 0.01765644,  0.01241772,  0.011999  ],
       [ 0.01770312,  0.01245093,  0.01203453],
       [ 0.01769558,  0.01244499,  0.01202805],
       [ 0.017783  ,  0.01250222,  0.01208866],
       [ 0.0177496 ,  0.01247729,  0.01206277],
       [ 0.01769167,  0.01244146,  0.01202426],
       [ 0.01776859,  0.01249151,  0.01207688],
       [ 0.01777961,  0.0124985 ,  0.01208468],
       [ 0.01777324,  0.01249279,  0.01207802],
       [ 0.01767962,  0.01243129,  0.01201341],
       [ 0.01776993,  0.01249448,  0.01208002],
       [ 0.01787434,  0.01256002,  0.0121495 ],
       [ 0.01787374,  0.0125592 ,  0.01214938],
       [ 0.01778044,  0.01250021,  0.01208651],
       [ 0.01783329,  0.01253307,  0.01212074],
       [ 0.01776367,  0.01249012,  0.01207593],
       [ 0.01776107,  0.01248588,  0.01207056],
       [ 0.01778419,  0.01250093,  0.01208699],
       [ 0.01767396,  0.01242959,  0.01201173],
       [ 0.01769257,  0.01244293,  0.01202614],
       [ 0.01781325,  0.01252323,  0.01211076],
       [ 0.017641  ,  0.01240613,  0.01198659],
       [ 0.01784695,  0.01254185,  0.01212945],
       [ 0.01784309,  0.01253963,  0.01212764],
       [ 0.01772311,  0.012463  ,  0.01204708],
       [ 0.01778609,  0.01250472,  0.01209106],
       [ 0.01771354,  0.01245601,  0.01203943],
       [ 0.01764582,  0.01241046,  0.01199115],
       [ 0.01777674,  0.0124949 ,  0.01208054],
       [ 0.01776674,  0.01248836,  0.01207405],
       [ 0.0177538 ,  0.01248034,  0.01206498],
       [ 0.01777095,  0.0124902 ,  0.01207502],
       [ 0.01779722,  0.01250938,  0.01209578],
       [ 0.01780497,  0.01251599,  0.01210322],
       [ 0.01782022,  0.01252528,  0.01211288],
       [ 0.01775949,  0.01248475,  0.01206979],
       [ 0.01770678,  0.01245079,  0.01203388],
       [ 0.01778849,  0.01250458,  0.01209061],
       [ 0.01788615,  0.01256934,  0.01215961],
       [ 0.01782588,  0.01253129,  0.01211866],
       [ 0.01769891,  0.01244754,  0.01203089],
       [ 0.01785983,  0.01255142,  0.01214024],
       [ 0.01781831,  0.01252306,  0.01211101],
       [ 0.01783847,  0.01253528,  0.01212243],
       [ 0.01782777,  0.01253153,  0.01211948],
       [ 0.01779882,  0.01251242,  0.01209914],
       [ 0.01780989,  0.01251752,  0.01210443],
       [ 0.01773078,  0.01246811,  0.01205263],
       [ 0.0177505 ,  0.01248163,  0.01206696],
       [ 0.01779051,  0.01250538,  0.01209148],
       [ 0.01779388,  0.01250959,  0.01209595],
       [ 0.01774596,  0.01247724,  0.01206276],
       [ 0.01775033,  0.01248016,  0.0120648 ],
       [ 0.01792318,  0.01259086,  0.01218218],
       [ 0.01769567,  0.01244505,  0.01202819],
       [ 0.01778382,  0.01250009,  0.0120856 ],
       [ 0.01769485,  0.01244179,  0.01202418],
       [ 0.01776013,  0.01248568,  0.01207066],
       [ 0.01774756,  0.01247842,  0.01206326],
       [ 0.01774052,  0.01247241,  0.01205603],
       [ 0.01780455,  0.01251666,  0.01210306],
       [ 0.01781737,  0.01252406,  0.01211116],
       [ 0.01771292,  0.01245481,  0.01203821],
       [ 0.01772991,  0.01246604,  0.01205016],
       [ 0.01766229,  0.01242276,  0.0120042 ],
       [ 0.01783388,  0.01253511,  0.01212292],
       [ 0.01774615,  0.01247847,  0.01206316],
       [ 0.01781774,  0.012524  ,  0.01211143],
       [ 0.01775339,  0.0124802 ,  0.01206545],
       [ 0.01760032,  0.01238144,  0.01196107],
       [ 0.01776545,  0.01248873,  0.01207354],
       [ 0.01778624,  0.01250376,  0.01208935],
       [ 0.01772523,  0.01246177,  0.0120455 ],
       [ 0.01780216,  0.01251101,  0.01209813],
       [ 0.01781552,  0.01252308,  0.01211006],
       [ 0.01776723,  0.01249156,  0.01207716],
       [ 0.01763744,  0.01240582,  0.01198666],
       [ 0.01770666,  0.01245187,  0.01203495],
       [ 0.01776758,  0.01249095,  0.01207598],
       [ 0.01773766,  0.01247116,  0.01205519],
       [ 0.01779294,  0.01250701,  0.01209344],
       [ 0.0178123 ,  0.0125189 ,  0.0121061 ],
       [ 0.01777182,  0.01249382,  0.01207984],
       [ 0.01788672,  0.01256819,  0.01215746],
       [ 0.01773469,  0.01246952,  0.01205367],
       [ 0.01781898,  0.01252349,  0.01211071],
       [ 0.01776124,  0.01248514,  0.01207024]])

In [ ]: