Пример #1
0
def theta_t(hname="Horizons.h5"):
    import bbh_processing.hfile_tools as hf
    T = hf.t(hname)
    theta = hf.theta_r_chi(hname)

    the_plot = plt.plot(T, theta)
    plt.xlabel("Time(M)")
    plt.ylabel("Radians")
    plt.title("Theta (r and chi)")
Пример #2
0
def first_peak_before_t(hname="Horizons.h5", pname="Omega.pkl"):
    with open(pname) as f:
        Omega, OmegaMag = pickle.load(f)
    t = hf.t(hname)
    r = hf.r_mag(hname)
    turns, turn_vals = peaks.turning_points(OmegaMag[:, 1])

    peakt = t[turns]
    peakr = r[turns]
    peakom = OmegaMag[turns, 1]

    for a, b, c in zip(peakt, peakr, peakom):
        print a, b, c
Пример #3
0
def rhat_projected(hname="Horizons.h5"):
    import bbh_processing.hfile_tools as hf
    import bbh_processing.utilities as bbh
    T = hf.t(hname)
    chi_hat = hf.chi_hat(hname)
    r_vec = hf.r(hname)
    r_proj = bbh.projected_onto(r_vec, chi_hat)
    r_proj_hat = bbh.unit_vector_time_series(r_proj)
    lab = ['x', 'y', 'z']
    the_plot = plt.plot(T, r_proj_hat)
    plt.xlabel("Time(M)")
    plt.ylabel("Length(M)")
    plt.title("Separation vector projected onto spin axis")
    return the_plot
Пример #4
0
def s_t(hname="Horizons.h5", equatorial=False):
    import bbh_processing.utilities as bbh
    import bbh_processing.hfile_tools as hf
    t = hf.t(hname)
    S = hf.chi_inertial(hname)
    S_mag = la.norm(S, axis=1)

    lab = ['S_x', 'S_y', 'S_z', '|S|']
    if equatorial:
        lab = ['S_x', 'S_y', '|S|']
    the_plot = plt.plot(t, S, t, S_mag)
    plt.legend(lab, loc='upper left', fontsize=8)
    plt.xlabel("Time(M)")
    plt.ylabel("S")
    plt.title("ChiInertial")
    return the_plot
Пример #5
0
def L_dot_chi(hname="Horizons.h5", pname="Omega.pkl"):
    import cPickle as pickle
    import bbh_processing.hfile_tools as hf
    import bbh_processing.utilities as bbh
    f = open(pname)
    L, OmMag = pickle.load(f)
    f.close()

    time = hf.t(hname)
    chi = hf.chi_inertial(hname)
    #print time[10:-11] compensates for points lost to the omega finder
    #print L[:,0]
    ldotchi = bbh.timedot(L[:, 1:], chi[10:-11, :])
    the_plot = plt.plot(L[:, 0], ldotchi)
    plt.xlabel("Time(M)")
    plt.ylabel("L . chi")
    plt.title("L dot Chi")
    return the_plot
Пример #6
0
def ecc_vs_omphi():
    hname = "Horizons.h5"
    pname = "Omega.pkl"

    #We need the separation to get the eccentricity
    rmag = hfile.r_mag(hname)
    ht = hfile.t(hname)
    #And the orbital frequency to get omega phi
    with open(pname) as f:
        Omega, OmegaMag = pickle.load(f)
    #Get the eccentricity
    errode, peakt, peakecc = ecctools.ecc_peaks_from_data(ht, rmag)
    #Interpolate onto the orbital frequency times
    eccspline = interp.UnivariateSpline(peakt, peakecc, k=3, s=0)
    ecc = eccspline(OmegaMag[:, 0])

    #Get omega phi
    om_phi = omphi.omega_phi_from_time_averages(OmegaMag, 2)
    return om_phi[:, 1], ecc
Пример #7
0
def p_on_s(hname="Horizons.h5", fname="Fluxes.dat", equatorial=False):
    import bbh_processing.utilities as bbh
    import bbh_processing.ffile_tools as ff
    import bbh_processing.hfile_tools as hf
    t = hf.t(hname)
    S = hf.chi_inertial(hname)
    T = ff.t(fname)
    P = bbh.interp_onto(ff.p(fname), T, t, 'slinear')
    P_S = bbh.projected_onto(P, S)
    P_S_mag = la.norm(P_S, axis=1)

    lab = ['x', 'y', 'z', 'mag']
    if equatorial:
        lab = ['x', 'y', 'mag']
    the_plot = plt.plot(t, P_S, t, P_S_mag)
    plt.legend(lab, loc='upper left', fontsize=8)
    plt.xlabel("Time(M)")
    plt.ylabel("P")
    plt.title("P projected onto S")
    return the_plot
Пример #8
0
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import bbh_processing.utilites as bbh
import mpl_toolkits.mplot3d.axes3d as p3

fig = plt.figure()
ax = p3.Axes3D(fig)
ax.autoscale(enable=False)
ax.set_xlim3d([-1.0, 1.0])
ax.set_ylim3d([-1.0, 1.0])
ax.set_zlim3d([-1.0, 1.0])
#ax = fig.add_subplot(111,autoscale_on=False,projection='3d',
#    xlim=(-1,1),ylim=(-1,1),zlim=(-1,1))

import bbh_processing.hfile_tools as hf
time = hf.t("Horizons.h5")
rhat = hf.r_hat("Horizons.h5")
chi_hat = hf.chi_hat("Horizons.h5")

line, = ax.plot([], [], 'o-', lw=2)
time_template = 'time = %.1fM'
time_text = ax.text(0.05, 0.9, 0.9, '', transform=ax.transAxes)


def init():
    line.set_data([], [])
    line.set_3d_properties([])
    time_text.set_text('')
    return line,  #time_text