In [1]:
from centralms import util as UT

In [10]:
import matplotlib as mpl 
import matplotlib.pyplot as pl 
mpl.rcParams['text.usetex'] = True
mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['axes.linewidth'] = 1.5
mpl.rcParams['axes.xmargin'] = 1
mpl.rcParams['xtick.labelsize'] = 'x-large'
mpl.rcParams['xtick.major.size'] = 5
mpl.rcParams['xtick.major.width'] = 1.5
mpl.rcParams['ytick.labelsize'] = 'x-large'
mpl.rcParams['ytick.major.size'] = 5
mpl.rcParams['ytick.major.width'] = 1.5
mpl.rcParams['legend.frameon'] = False
%matplotlib inline

In [2]:
zt = UT.zt_table()

In [9]:
for isnap in np.arange(len(zt[0])): 
    print UT.t_nsnap(isnap), UT.tdyn_nsnap(isnap)


13.8099 2.6631122173
13.1328 2.47446574482
12.4724 2.29955780354
11.8271 2.13683197904
11.198 1.985555214
10.5893 1.84523681006
9.9988 1.71454603329
9.4289 1.59314091018
8.8783 1.48014779015
8.3525 1.37564525218
7.8464 1.27817027286
7.3635 1.18761963276
6.9048 1.10377088531
6.4665 1.02550570353
6.0513 0.952892988371
5.6597 0.885649223486
5.2873 0.822733055177
4.9378 0.764576823747
4.608 0.710438498129
4.298 0.660127974037
4.0079 0.613510719294
3.7343 0.569954328777
3.4802 0.529825304669
3.2408 0.49227063441
3.0172 0.457442421147
2.8078 0.424974351751
2.6136 0.394991634723
2.4315 0.367005618418
2.2611 0.340911259181
2.1035 0.316846939752
1.9569 0.294516644444
1.8198 0.27367950655
1.6918 0.254269533204

In [17]:
tnsnaps = np.array([UT.t_nsnap(isnap) for isnap in np.arange(len(zt[0]))])
tdyns = np.array([UT.tdyn_nsnap(isnap) for isnap in np.arange(len(zt[0]))])

In [19]:
fig = plt.figure()
sub = fig.add_subplot(111)
sub.scatter(tnsnaps, tdyns, s=10)
sub.set_xlim([0., 14.])


Out[19]:
(0.0, 14.0)

In [22]:
coeff = np.polyfit(tnsnaps, tdyns, 6)

In [25]:
print coeff


[ 9.29206984e-09 -3.11237220e-07  6.89619438e-06  1.49737134e-04
  2.60164944e-04  1.49149975e-01  4.31546682e-04]

In [24]:
fig = plt.figure()
sub = fig.add_subplot(111)
sub.scatter(tnsnaps, tdyns, s=10)
tarr = np.linspace(0., 14., 100.)
tdyn_t = np.poly1d(coeff)
sub.plot(tarr, tdyn_t(tarr), c='k', ls='--')
sub.set_xlim([0., 14.])


/Users/chang/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py:4: DeprecationWarning: object of type <type 'float'> cannot be safely interpreted as an integer.
  after removing the cwd from sys.path.
Out[24]:
(0.0, 14.0)

In [ ]: