Example #1
0
import matplotlib.pyplot as plt
import numpy as np

import chirpy_mk1 as cmk1

import phenom

# using the times array interface
t = np.linspace(-1000, 100, 1000)
mk1 = cmk1.Mk1(times=t, q=1)

# using the f_start interface
# srate_sec = 2**(-17)
# srate_M = phenom.StoM(srate_sec, 1)
# t_end = 100
# mk1 = cmk1.Mk1(q=1, f_start=0.06, srate=srate_M, t_end=t_end)

plt.figure()
plt.plot(mk1.times, np.real(mk1.h))
plt.xlabel('t/M')
plt.ylabel('Re(h)')
plt.savefig('wf-plot.png')
Example #2
0

def f_of_t_ins(t, eta=eta, params_freq_ins=params_freq_ins):
    return freq_ins_ansatz(t, eta, params_freq_ins)


def func_ins(t, eta, params_freq_ins, f0):
    return f_of_t_ins(t, eta, params_freq_ins) - f0


# we also try using the complete IMR of the mk1
# because there might be times where you
# want the f_of_t at a time close to the merger where the
# inspiral model isn't good enough

mk1 = chirpy_mk1.Mk1(np.array([-100]), q)


def f_of_t_imr(t, eta):
    return mk1.freq_func(np.array([t]), eta)


def func_imr(t, eta, f0):
    return f_of_t_imr(np.array([t]), eta) - f0


from scipy import optimize

# can't use a frequency too close to the merger with
# inspiral only.
# So maybe we first try the inspiral ansatz
Example #3
0
# compuate f(t)

toff = pn_t_of_f(freq_ins, params_freq_ins['tc'], eta)

#sc = (toff-toff[0])[1] / (times-times[0])[1]
#print(1./sc)

#plt.figure()
#plt.plot(freq_ins, (toff-toff[0])/sc, label='calculated')
#plt.plot(freq_ins, times-times[0], label='real', ls='--')
#plt.legend()
#plt.show()

# full imr
mk1 = chirpy_mk1.Mk1(times, q)
mk1_freq = mk1.freq_func(mk1.times)

plt.figure()
plt.plot(mk1_freq, mk1.times - mk1.times[0], label='imr')
plt.plot(freq_ins, (toff - toff[0]), label='estimated')
plt.plot(freq_ins, times - times[0], label='real', ls='--')
plt.legend()
plt.show()

#plt.figure()
#plt.plot(times, freq_ins, label='Mk1 ins model')
#plt.axhline(F0, c='k', ls='--')
#plt.axvline(t0 + times[0], c='k', ls='--')
#plt.xlabel('t/M')
#plt.ylabel(r'$M \omega_{22}(t)$')
Example #4
0
npts_time = 1000 * 10
npts_mass_ratio = len(nrfiles)

t1 = -3100
#t1=-500
t2 = 100

psi4s = {}
for k, v in list(nrfiles.items()):
    psi4s.update({k: Psi4(v, ell, mm, npts_time, t1=t1, t2=t2)})

for k in psi4s.keys():
    print("working: {}".format(k))
    # generate mk1 waveform
    mk1 = chirpy_mk1.Mk1(psi4s[k].times_hlm, psi4s[k].q)

    mk1_ts = pycbc.types.TimeSeries(np.real(mk1.h),
                                    delta_t=mk1.times[1] - mk1.times[0])
    nr_ts = pycbc.types.TimeSeries(np.real(psi4s[k].hlm),
                                   delta_t=psi4s[k].times_hlm[1] -
                                   psi4s[k].times_hlm[0])

    mk1_ts, nr_ts = pycbc.waveform.utils.coalign_waveforms(mk1_ts, nr_ts)

    _, mk1_idx = mk1_ts.abs_max_loc()
    mk1_shift = mk1_ts.sample_times[mk1_idx]

    fig, axes = plt.subplots(1, 2, figsize=(14, 4))
    axes[0].plot(nr_ts.sample_times - mk1_shift, nr_ts, label='NR')
    axes[0].plot(mk1_ts.sample_times - mk1_shift, mk1_ts, ls='--', label='Mk1')