Esempio n. 1
0
def omegas(pname="Omega.pkl", hname="Horizons.h5", equatorial=False):
    import cPickle as pickle
    import bbh_processing.combined_tools as ct
    f = open(pname)
    Om, OmMag = pickle.load(f)
    f.close()

    lab = ['Om_phi', 'Om_r']
    if equatorial == False:
        om_th_t, om_th = ct.omega_theta(hname)
        lab = ['Om_th', 'Om_phi', 'Om_r']
    om_r_t, om_r = ct.omega_r(pname)
    #om_phi_t, om_phi = omega_phi(pname)
    om_phi_t, om_phi = ct.omega_phi(pname)

    if equatorial:
        the_plot = plt.plot(om_phi_t, om_phi, om_r_t, om_r, OmMag[:, 0],
                            OmMag[:, 1])
    else:
        the_plot = plt.plot(om_th_t, om_th, om_phi_t, om_phi, om_r_t, om_r,
                            OmMag[:, 0], OmMag[:, 1])

    plt.legend(lab, loc='upper left', fontsize=8)
    plt.xlabel("Time(M)")
    plt.ylabel("Frequency (1/M)")
    plt.title("Omega")
    return the_plot
Esempio n. 2
0
def make_omega_phi(om_name, outname):
    #plot omega_phi
    t, om = omega_phi(om_name)
    out = file(outname, 'w')
    out.write("""#
    # [1] = t
    # [2] = omega_phi 
    """)
    np.savetxt(out, np.transpose([t, om]))
Esempio n. 3
0
def make_plot(om_name="Omega.pkl"):
    #plot omega_phi
    t, om = omega_phi(om_name)

    out = file("omega_phi.dat", 'w')
    out.write("""#
    # [1] = t
    # [2] = omega_phi 
    """)
    np.savetxt(out, np.transpose([t, om]))
Esempio n. 4
0
def gen_ks(pname="Omega.pkl", hname="Horizons.h5", equatorial=False):
    import cPickle as pickle
    import bbh_processing.utilities as bbh
    import numpy as np
    from bbh_processing.combined_tools import omega_theta, omega_r, omega_phi
    f = open(pname)
    Om, OmMag = pickle.load(f)
    f.close()

    om_r_t, om_r = omega_r(pname)
    om_phi_t, om_phi = omega_phi(pname)
    k_r_phi = np.divide(om_r, om_phi)

    if equatorial:
        return om_phi, om_r_t, k_r_phi

    else:
        #om_th has different shape from the others
        #(since it both starts and ends later)
        #we therefore need to trim om_phi and om_r from the left to match the
        #initial time of om_th, and om_th from the right to match the final time
        #of its counterparts

        om_th_t, om_th = omega_theta(hname)

        #first we get the values of the time extents we want
        initial_time = om_th_t[0]
        final_time = om_r_t[-1]

        #now the index of om_r and om_phi corresponding to the initial time
        initial_index_r = (np.where(om_r_t == initial_time)[0][0], -1)[0]
        initial_index_phi = (np.where(om_phi_t == initial_time)[0][0], -1)[0]
        #now the index of om_th corresponding to the final time
        final_index_th = (np.where(om_th_t == final_time)[0][0], -1)[0]
        om_r_trimmed = om_r[initial_index_r:-1]
        om_phi_trimmed = om_phi[initial_index_phi:-1]
        om_th_trimmed = om_th[0:final_index_th]

        k_r_th = np.divide(om_r_trimmed, om_th_trimmed)
        k_th_phi = np.divide(om_th_trimmed, om_phi_trimmed)
        trim_time = om_r_t[initial_index_r:-1]
        return (om_phi, om_phi_trimmed, om_r_t, k_r_phi, trim_time, k_r_th,
                trim_time, k_th_phi)
Esempio n. 5
0
def show_plot(om_name="Omega.pkl"):
    print "Pkl file: ", om_name
    sp1 = plt.subplot(1, 1, 1)
    t, om = omega_phi(om_name)
    return plt.plot(t, om)