Beispiel #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
Beispiel #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
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
Beispiel #4
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 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
Beispiel #7
0
    def __init__(self, m1, m2, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, theta, phi, iota, psi, bank):

        PrecessingTemplate.__init__(self, m1, m2, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, theta, phi, iota, psi, bank)
        # derived quantities
        self.chieff, self.chipre = SimIMRPhenomPCalculateModelParameters(self.m1, self.m2, self.bank.flow, np.sin(self.iota), float(0), np.cos(self.iota), float(self.spin1x), float(self.spin1y), float(self.spin1z), float(self.spin2x), float(self.spin2y), float(self.spin2z))[:2] # FIXME are the other four parameters informative?

        self._f_final = spawaveform.imrffinal(m1, m2, self.chieff)
        self._dur = self._imrdur()
Beispiel #8
0
    def __init__(self, m1, m2, bank):
        Template.__init__(self, m1, m2, bank)
        self.m1 = float(m1)
        self.m2 = float(m2)
        self.bank = bank

        # derived quantities
        # we'll just use the imrphenomb ffinal estimate for f_final
        self._f_final = spawaveform.imrffinal(m1, m2, 0)
        self._dur = self._imrdur()
        self._mchirp = compute_mchirp(m1, m2)
Beispiel #9
0
    def __init__(self, m1, m2, spin1z, spin2z, bank):
        Template.__init__(self, m1, m2, bank)
        self.m1 = m1
        self.m2 = m2
        self.spin1z = spin1z
        self.spin2z = spin2z
        chi = lalsim.SimIMRPhenomBComputeChi( self.m1, self.m2, self.spin1z, self.spin2z )
        self.chi = chi
        self.bank = bank

        # derived quantities
        self._f_final = spawaveform.imrffinal(m1, m2, chi)
        self._dur = self._imrdur()
        self._mchirp = compute_mchirp(m1, m2)
Beispiel #10
0
    def __init__(self, m1, m2, spin1z, spin2z, bank):
        Template.__init__(self)
        self.m1 = float(m1)
        self.m2 = float(m2)
        self.spin1z = float(spin1z)
        self.spin2z = float(spin2z)
        self.bank = bank

        # derived quantities
        self._chi = lalsim.SimIMRPhenomBComputeChi(m1, m2, spin1z, spin2z)
        # we'll just use the imrphenomb ffinal estimate for f_final
        self._f_final = spawaveform.imrffinal(m1, m2, self._chi)
        self._dur = self._imrdur()
        self._mchirp = compute_mchirp(m1, m2)
Beispiel #11
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
Beispiel #13
0
 def _get_f_final(self):
     return spawaveform.imrffinal(self.m1, self.m2, self.chieff)
        # --- Scale the NR waveform at this mass

        # Scale the NR waveform to the mass we want
        hplus_NR_new = pycbc.types.TimeSeries(bnru.scale_wave(hplus_NR, mass,
            init_total_mass), delta_t=deltaT)
        hplus_NR_new.data[:] = bnru.taper(hplus_NR_new.data[:],
                delta_t=hplus_NR_new.delta_t)

        # --- Generate the SEOBNR waveform to this mass

        mass1, mass2 = bwave.component_masses(mass, simulations.simulations[w]['q'])

        # Estimate ffinal
        chi = spawaveform.computechi(mass1, mass2, spin1z, spin2z)
        ffinal = spawaveform.imrffinal(mass1, mass2, chi)

        Hf = hplus_NR_new.to_frequencyseries()
        f_lower = 0.8*Hf.sample_frequencies.data[ np.argmax(abs(Hf)) ]

        hplus_SEOBNR, _ = get_td_waveform(approximant="SEOBNRv2",
                distance=distance,
                mass1=mass1,
                mass2=mass2,
                spin1z=spin1z,
                spin2z=spin2z,
                f_lower=f_lower,
                delta_t=deltaT)

        hplus_SEOBNR.data = bnru.taper(hplus_SEOBNR.data,
                delta_t=hplus_SEOBNR.delta_t)
Beispiel #15
0
 def _get_f_final(self):
     return spawaveform.imrffinal(self.m1, self.m2, self.chieff)