Exemplo n.º 1
0
def IMRtargetburstfreq(m1,m2,spin1z,spin2z):

    """
	IMRtargetburstfreq finds the peak amplitude of the waveform for a given source parameters and the source distance.
	usage: IMRtargetburstfreq(m1,m2,spin1z,spin2z)
	e.g.
	spawaveApp.IMRtargetburstfreq(30,40,0.45,0.5)

	"""
    chi = spawaveform.computechi(m1, m2, spin1z, spin2z)
    fFinal = spawaveform.ffinal(m1,m2,'schwarz_isco')   
    imrfFinal = spawaveform.imrffinal(m1, m2, chi, 'fcut')
    fLower = 40.0
    order = 7
    dur = 2**numpy.ceil(numpy.log2(spawaveform.chirptime(m1,m2,order,fFinal)))
    sr = 2**numpy.ceil(numpy.log2(imrfFinal*2))
    deltaF = 1.0 / dur
    deltaT = 1.0 / sr
    s = numpy.empty(sr * dur, 'complex128')	
    spawaveform.imrwaveform(m1, m2, deltaF, fFinal, s, spin1z, spin2z)
    #S = numpy.real(s)
    S = numpy.abs(s)
    x = scipy.linspace(fFinal, imrfFinal, numpy.size(S))
    N = interpolatation(x)
    #N = interpolate.splev(x,interpolatation)
    ratio = numpy.divide(numpy.square(S),numpy.square(N))
    #ratio = numpy.divide(S,N)
    maxindex = numpy.argmax(ratio)
    maxfreq = x[maxindex]
    return maxfreq
Exemplo n.º 2
0
def IMRsnr(m1,m2,spin1z,spin2z,d):

    """
    IMRsnr finds the SNR of the waveform with Initial LIGO SRD for a given source parameters and the source distance.
	usage: IMRsnr(m1,m2,spin1z,spin2z,distance)
	e.g.
	spawaveApp.IMRsnr(30,40,0.45,0.5,100)

	"""

    chi = spawaveform.computechi(m1, m2, spin1z, spin2z)   
    imrfFinal = spawaveform.imrffinal(m1, m2, chi, 'fcut')
    fLower = 10.0
    order = 7
    dur = 2**numpy.ceil(numpy.log2(spawaveform.chirptime(m1,m2,order,fLower)))
    sr = 2**numpy.ceil(numpy.log2(imrfFinal*2))
    deltaF = 1.0 / dur
    deltaT = 1.0 / sr
    s = numpy.empty(sr * dur, 'complex128')	
    spawaveform.imrwaveform(m1, m2, deltaF, fLower, s, spin1z, spin2z)
    S = numpy.abs(s)
    x = scipy.linspace(fLower, imrfFinal, numpy.size(S))
    N = interpolatation(x)
    #N = interpolate.splev(x,interpolatation)
    SNR = math.sqrt(numpy.sum(numpy.divide(numpy.square(S),numpy.square(N))))/d
    return SNR
Exemplo n.º 3
0
def IMRpeakAmp(m1,m2,spin1z,spin2z,d):

    """
	IMRpeakAmp finds the peak amplitude of the waveform for a given source parameters and the source distance.
	usage: IMRpeakAmp(m1,m2,spin1z,spin2z,distance)
	e.g.
	spawaveApp.IMRpeakAmp(30,40,0.45,0.5,100)

	"""

    chi = spawaveform.computechi(m1, m2, spin1z, spin2z)   
    imrfFinal = spawaveform.imrffinal(m1, m2, chi, 'fcut')
    fLower = 10.0
    order = 7
    dur = 2**numpy.ceil(numpy.log2(spawaveform.chirptime(m1,m2,order,fLower)))
    sr = 2**numpy.ceil(numpy.log2(imrfFinal*2))
    deltaF = 1.0 / dur
    deltaT = 1.0 / sr
    s = numpy.empty(sr * dur, 'complex128')	
    spawaveform.imrwaveform(m1, m2, deltaF, fLower, s, spin1z, spin2z)
    s = scipy.ifft(s)
    #s = numpy.abs(s)
    s = numpy.real(s)
    max = numpy.max(s)/d
    return max
def IMRsnr(m1, m2, spin1z, spin2z, d):
    """
    IMRsnr finds the SNR of the waveform with Initial LIGO SRD for a given source parameters and the source distance.
	usage: IMRsnr(m1,m2,spin1z,spin2z,distance)
	e.g.
	spawaveApp.IMRsnr(30,40,0.45,0.5,100)

	"""

    chi = spawaveform.computechi(m1, m2, spin1z, spin2z)
    imrfFinal = spawaveform.imrffinal(m1, m2, chi, 'fcut')
    fLower = 10.0
    order = 7
    dur = 2**numpy.ceil(
        numpy.log2(spawaveform.chirptime(m1, m2, order, fLower)))
    sr = 2**numpy.ceil(numpy.log2(imrfFinal * 2))
    deltaF = 1.0 / dur
    deltaT = 1.0 / sr
    s = numpy.empty(sr * dur, 'complex128')
    spawaveform.imrwaveform(m1, m2, deltaF, fLower, s, spin1z, spin2z)
    S = numpy.abs(s)
    x = scipy.linspace(fLower, imrfFinal, numpy.size(S))
    N = interpolatation(x)
    #N = interpolate.splev(x,interpolatation)
    SNR = math.sqrt(numpy.sum(numpy.divide(numpy.square(S),
                                           numpy.square(N)))) / d
    return SNR
def IMRtargetburstfreq(m1, m2, spin1z, spin2z):
    """
	IMRtargetburstfreq finds the peak amplitude of the waveform for a given source parameters and the source distance.
	usage: IMRtargetburstfreq(m1,m2,spin1z,spin2z)
	e.g.
	spawaveApp.IMRtargetburstfreq(30,40,0.45,0.5)

	"""
    chi = spawaveform.computechi(m1, m2, spin1z, spin2z)
    fFinal = spawaveform.ffinal(m1, m2, 'schwarz_isco')
    imrfFinal = spawaveform.imrffinal(m1, m2, chi, 'fcut')
    fLower = 40.0
    order = 7
    dur = 2**numpy.ceil(
        numpy.log2(spawaveform.chirptime(m1, m2, order, fFinal)))
    sr = 2**numpy.ceil(numpy.log2(imrfFinal * 2))
    deltaF = 1.0 / dur
    deltaT = 1.0 / sr
    s = numpy.empty(sr * dur, 'complex128')
    spawaveform.imrwaveform(m1, m2, deltaF, fFinal, s, spin1z, spin2z)
    #S = numpy.real(s)
    S = numpy.abs(s)
    x = scipy.linspace(fFinal, imrfFinal, numpy.size(S))
    N = interpolatation(x)
    #N = interpolate.splev(x,interpolatation)
    ratio = numpy.divide(numpy.square(S), numpy.square(N))
    #ratio = numpy.divide(S,N)
    maxindex = numpy.argmax(ratio)
    maxfreq = x[maxindex]
    return maxfreq
def IMRpeakAmp(m1, m2, spin1z, spin2z, d):
    """
	IMRpeakAmp finds the peak amplitude of the waveform for a given source parameters and the source distance.
	usage: IMRpeakAmp(m1,m2,spin1z,spin2z,distance)
	e.g.
	spawaveApp.IMRpeakAmp(30,40,0.45,0.5,100)

	"""

    chi = spawaveform.computechi(m1, m2, spin1z, spin2z)
    imrfFinal = spawaveform.imrffinal(m1, m2, chi, 'fcut')
    fLower = 10.0
    order = 7
    dur = 2**numpy.ceil(
        numpy.log2(spawaveform.chirptime(m1, m2, order, fLower)))
    sr = 2**numpy.ceil(numpy.log2(imrfFinal * 2))
    deltaF = 1.0 / dur
    deltaT = 1.0 / sr
    s = numpy.empty(sr * dur, 'complex128')
    spawaveform.imrwaveform(m1, m2, deltaF, fLower, s, spin1z, spin2z)
    s = scipy.ifft(s)
    #s = numpy.abs(s)
    s = numpy.real(s)
    max = numpy.max(s) / d
    return max
Exemplo n.º 7
0
def IMRhrss(m1,m2,spin1z,spin2z,d):

    """
	IMRhrss finds the SNR of the waveform for a given source parameters and the source distance.
	usage: IMRhrss(m1,m2,spin1z,spin2z,distance)
	e.g.
	spawaveApp.IMRhrss(30,40,0.45,0.5,100)

	"""

    chi = spawaveform.computechi(m1, m2, spin1z, spin2z)   
    imrfFinal = spawaveform.imrffinal(m1, m2, chi, 'fcut')
    fLower = 10.0
    order = 7
    dur = 2**numpy.ceil(numpy.log2(spawaveform.chirptime(m1,m2,order,fLower)))
    sr = 2**numpy.ceil(numpy.log2(imrfFinal*2))
    deltaF = 1.0 / dur
    deltaT = 1.0 / sr
    s = numpy.empty(sr * dur, 'complex128')	
    spawaveform.imrwaveform(m1, m2, deltaF, fLower, s, spin1z, spin2z)
    s = numpy.abs(s)
    s = numpy.square(s)
    hrss = math.sqrt(numpy.sum(s))/d
    return hrss
def IMRhrss(m1, m2, spin1z, spin2z, d):
    """
	IMRhrss finds the SNR of the waveform for a given source parameters and the source distance.
	usage: IMRhrss(m1,m2,spin1z,spin2z,distance)
	e.g.
	spawaveApp.IMRhrss(30,40,0.45,0.5,100)

	"""

    chi = spawaveform.computechi(m1, m2, spin1z, spin2z)
    imrfFinal = spawaveform.imrffinal(m1, m2, chi, 'fcut')
    fLower = 10.0
    order = 7
    dur = 2**numpy.ceil(
        numpy.log2(spawaveform.chirptime(m1, m2, order, fLower)))
    sr = 2**numpy.ceil(numpy.log2(imrfFinal * 2))
    deltaF = 1.0 / dur
    deltaT = 1.0 / sr
    s = numpy.empty(sr * dur, 'complex128')
    spawaveform.imrwaveform(m1, m2, deltaF, fLower, s, spin1z, spin2z)
    s = numpy.abs(s)
    s = numpy.square(s)
    hrss = math.sqrt(numpy.sum(s)) / d
    return hrss
Exemplo n.º 9
0
    fignum = fignum + 1
    pylab.figure(fignum)
    pylab.semilogy([f.mass1 + f.mass2 for f in found],
                   [f.eff_dist_l for f in found], '.')
    pylab.semilogy([m.mass1 + m.mass2 for m in missed],
                   [m.eff_dist_l for m in missed], 'k.')
    pylab.xlabel('Total Mass ($M_\odot$)')
    pylab.ylabel('Effective Distance (Mpc): L1')
    pylab.title('Missed-Found:L1 Effective Distance vs Total Mass')
    pylab.savefig('L1effdist_mass.png')

    fignum = fignum + 1
    pylab.figure(fignum)
    pylab.semilogy([
        spawaveform.computechi(f.mass1, f.mass2, f.spin1z, f.spin2z)
        for f in found
    ], [f.eff_dist_l for f in found], '.')
    pylab.semilogy([
        spawaveform.computechi(m.mass1, m.mass2, m.spin1z, f.spin2z)
        for m in missed
    ], [m.eff_dist_l for m in missed], 'k.')
    pylab.xlabel('Mass Weighted Spin')
    pylab.ylabel('Effective Distance (Mpc): L1')
    pylab.title('Missed-Found:L1 Effective Distance vs Mass Weighted Spin')
    pylab.savefig('L1effdist_massweightedspin.png')

    fignum = fignum + 1
    pylab.figure(fignum)
    pylab.semilogy(
        [finalspin(f.mass1, f.mass2, f.spin1z, f.spin2z) for f in found],
Exemplo n.º 10
0
    else: theta1L[s]=sim['th1L']

    if np.isnan(sim['th2L']): theta2L[s]=0.0
    else: theta2L[s]=sim['th2L']

    if np.isnan(sim['thSL']): theta1L[s]=0.0
    else: thetaSL[s]=sim['thSL']


    for n in xrange(nsamples):

        mass1, mass2 = bwave.component_masses(total_masses[s, n], mass_ratios[s])

        chirp_masses[s, n] = spawaveform.chirpmass(mass1, mass2) \
                / lal.MTSUN_SI
        chis[s, n] = spawaveform.computechi(mass1, mass2, spin1z, spin2z)

median_mchirps = np.median(chirp_masses, axis=1)
std_mchirps = np.std(chirp_masses, axis=1)

median_chis = np.median(chis, axis=1)
std_chis = np.std(chis, axis=1)


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# SCATTER PLOTS

# --- Mass vs thSL Scatter plot
f, ax = pl.subplots()

err = ax.errorbar(median_total_masses, thetaSL, xerr=std_total_masses, color='k',
Exemplo n.º 11
0
    pylab.ylabel('Effective Distance (Mpc): L1')
    pylab.title('Missed-Found:L1 Effective Distance vs Chirp Mass')
    pylab.savefig('L1effdist_chirpmass.png')

    fignum = fignum + 1
    pylab.figure(fignum)
    pylab.semilogy([f.mass1+f.mass2 for f in found], [f.eff_dist_l for f in found],'.')
    pylab.semilogy([m.mass1+m.mass2 for m in missed], [m.eff_dist_l for m in missed],'k.')
    pylab.xlabel('Total Mass ($M_\odot$)')
    pylab.ylabel('Effective Distance (Mpc): L1')
    pylab.title('Missed-Found:L1 Effective Distance vs Total Mass')
    pylab.savefig('L1effdist_mass.png')

    fignum = fignum + 1
    pylab.figure(fignum)
    pylab.semilogy([spawaveform.computechi(f.mass1, f.mass2, f.spin1z, f.spin2z) for f in found], [f.eff_dist_l for f in found],'.')
    pylab.semilogy([spawaveform.computechi(m.mass1, m.mass2, m.spin1z, f.spin2z) for m in missed], [m.eff_dist_l for m in missed],'k.')
    pylab.xlabel('Mass Weighted Spin')
    pylab.ylabel('Effective Distance (Mpc): L1')
    pylab.title('Missed-Found:L1 Effective Distance vs Mass Weighted Spin')
    pylab.savefig('L1effdist_massweightedspin.png')

    fignum = fignum + 1
    pylab.figure(fignum)
    pylab.semilogy([finalspin(f.mass1, f.mass2, f.spin1z, f.spin2z) for f in found], [f.eff_dist_l for f in found],'.')
    pylab.semilogy([finalspin(m.mass1, m.mass2, m.spin1z, f.spin2z) for m in missed], [m.eff_dist_l for m in missed],'k.')
    pylab.xlabel('Final Spin')
    pylab.ylabel('Effective Distance (Mpc): L1')
    pylab.title('Missed-Found:L1 Effective Distance vs Final Spin')
    pylab.savefig('L1effdist_finalspin.png')
    hplus_NR.data = bwave.window_wave(hplus_NR.data)

    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #
    # --- Generate approximant with this NR waveform's parameters ---
    #
    mass_ratios[s] = simulation['q']
    spin_magnitudes.append((simulation['a1'], simulation['a2']))
    spin_angles.append((simulation['th1L'], simulation['th2L']))

    mass1, mass2 = component_masses(total_mass, mass_ratios[s])

    spin1z = cartesian_spins(simulation['a1'], simulation['th1L'])
    spin2z = cartesian_spins(simulation['a2'], simulation['th2L'])

    effective_spins[s] = spawaveform.computechi(mass1, mass2, spin1z, spin2z)


    print "Generating EOBNR"
    hplus_EOBNR, _ = get_td_waveform(approximant="SEOBNRv2",
            distance=distance,
            mass1=mass1,
            mass2=mass2,
            spin1z=spin1z,
            spin2z=spin2z,
            f_lower=f_low,
            delta_t=SI_deltaT)

    # divide out the spherical harmonic (2,2) amplitude (this is just for nice
    # plots / sanity - it does not affect match)
    sY22 = lal.SpinWeightedSphericalHarmonic(0,0,-2,2,2)