In [1]:
%pylab --no-import-all inline
#%pylab --no-import-all osx
%config InlineBackend.figure_format='png' # SVG plots can get really slow if the evolutions are long
import PNEvolution
import Quaternions


Populating the interactive namespace from numpy and matplotlib

The following calculates a PN evolution with initial velocity $v=0.15$, and a starting velocity $v$ of either $0.15$ or $90\%$ of that. The two evolutions have the same "initial" conditions, and so should be identical after that point. But the evolution starting at $v=0.9 \times 0.15$ calculates the portion of the evolution that came before the "initial" velocity. This distinction is important with precessing systems because we want to give the spins and binary orientation at the "initial" time, but we also want to know data from before that time.


In [2]:
v_i = 0.15
m1 = 0.4
m2 = 0.6
chi1_i = [0.1,0.2,0.3]
chi2_i = [0.2,0.3,0.4]
R_frame_i = Quaternions.Quaternion(1,0,0,0)
ForwardInTime = True

v_0 = 0.9*v_i
tA,vA,chi1A,chi2A,R_frameA,PhiA = \
    PNEvolution.EvolvePN("TaylorT1", 4.0, v_0, v_i, m1, m2, chi1_i, chi2_i, R_frame_i, ForwardInTime)
plot(tA, vA, label='v_0 = {0}'.format(v_0))

v_0 = v_i
tB,vB,chi1B,chi2B,R_frameB,PhiB = \
    PNEvolution.EvolvePN("TaylorT1", 4.0, v_0, v_i, m1, m2, chi1_i, chi2_i, R_frame_i, ForwardInTime)
plot(tB, vB, label='v_0 = {0}'.format(v_0))

legend()


Out[2]:
<matplotlib.legend.Legend at 0x1005659d0>

Now, to show that the times that both waveforms calculated are identical:


In [3]:
max(tA[tA.size-tB.size:]-tB)


Out[3]:
0.0

And the velocities:


In [4]:
max(vA[tA.size-tB.size:]-vB)


Out[4]:
0.0

And the spins:


In [5]:
norm(chi1A[tA.size-tB.size:]-chi1B), norm(chi2A[tA.size-tB.size:]-chi2B)


Out[5]:
(0.0, 0.0)

Quaternion evolution system


In [6]:
v_i = 0.15
m1 = 0.4
m2 = 0.6
chi1_i = [0.1,0.2,0.3]
chi2_i = [0.2,0.3,0.4]
R_frame_i = Quaternions.Quaternion(1,0,0,0)
ForwardInTime = True

v_0 = 0.9*v_i
tC,vC,chi1C,chi2C,R_frameC,PhiC = \
    PNEvolution.EvolvePN_Q("TaylorT1", 4.0, v_0, v_i, m1, m2, chi1_i, chi2_i, R_frame_i, ForwardInTime)
plot(tC, vC, label='v_0 = {0}'.format(v_0))

v_0 = v_i
tD,vD,chi1D,chi2D,R_frameD,PhiD = \
    PNEvolution.EvolvePN_Q("TaylorT1", 4.0, v_0, v_i, m1, m2, chi1_i, chi2_i, R_frame_i, ForwardInTime)
plot(tD, vD, label='v_0 = {0}'.format(v_0))

legend()


Out[6]:
<matplotlib.legend.Legend at 0x10a50ac90>

In [7]:
max(tA[tA.size-tB.size:]-tB)


Out[7]:
0.0

In [8]:
max(vA[tA.size-tB.size:]-vB)


Out[8]:
0.0

In [9]:
norm(chi1A[tA.size-tB.size:]-chi1B), norm(chi2A[tA.size-tB.size:]-chi2B)


Out[9]:
(0.0, 0.0)