Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
amp0 = -4. * mass1 * mass2 / (1.0e+06 * float(distance) * lal.PC_SI )* \
lal.MRSUN_SI * lal.MTSUN_SI * sqrt(lal.PI/12.0)
m_sec = M * lal.MTSUN_SI;
piM = lal.PI * m_sec;
kmin = int(kwds['f_lower'] / float(delta_f))
vISCO = 1. / sqrt(6.)
fISCO = vISCO * vISCO * vISCO / piM;
kmax = int(fISCO / delta_f)
f_max = fISCO
n = int(f_max / delta_f) + 1;
htilde = FrequencySeries(zeros(n,dtype=numpy.complex128), delta_f=delta_f, copy=False)
taylorf2_kernel(htilde.data[kmin:kmax], kmin, phase_order,
amplitude_order, delta_f, piM, pfaN,
pfa2, pfa3, pfa4, pfa5, pfl5,
pfa6, pfl6, pfa7, FTaN, FTa2,
FTa3, FTa4, FTa5, FTa6,
FTl6, FTa7, dETaN, dETa1, dETa2, dETa3,
amp0, tC, phi0)
hp = htilde
hc = htilde * 1j
return hp, hc
Parameters
----------
length : int
Length of output Frequencyseries.
delta_f : float
Frequency step for output FrequencySeries.
low_freq_cutoff : int
Low-frequency cutoff for output FrequencySeries.
Returns
-------
FrequencySeries
Returns a FrequencySeries containing the unity PSD model.
"""
fseries = FrequencySeries(numpy.ones(length), delta_f=delta_f)
kmin = int(low_freq_cutoff / fseries.delta_f)
fseries.data[:kmin] = 0
return fseries
def make_padded_frequency_series(vec,filter_N=None):
"""Pad a TimeSeries with a length of zeros greater than its length, such
that the total length is the closest power of 2. This prevents the effects
of wraparound.
"""
if filter_N is None:
power = ceil(log(len(vec),2))+1
N = 2 ** power
else:
N = filter_N
n = N/2+1
if isinstance(vec,FrequencySeries):
vectilde = FrequencySeries(zeros(n, dtype=complex_same_precision_as(vec)),
delta_f=1.0,copy=False)
if len(vectilde) < len(vec):
cplen = len(vectilde)
else:
cplen = len(vec)
vectilde[0:cplen] = vec[0:cplen]
delta_f = vec.delta_f
if isinstance(vec,TimeSeries):
vec_pad = TimeSeries(zeros(N),delta_t=vec.delta_t,
dtype=real_same_precision_as(vec))
vec_pad[0:len(vec)] = vec
delta_f = 1.0/(vec.delta_t*N)
vectilde = FrequencySeries(zeros(n),delta_f=1.0,
dtype=complex_same_precision_as(vec))
else:
cplen = len(vec)
vectilde[0:cplen] = vec[0:cplen]
delta_f = vec.delta_f
if isinstance(vec,TimeSeries):
vec_pad = TimeSeries(zeros(N),delta_t=vec.delta_t,
dtype=real_same_precision_as(vec))
vec_pad[0:len(vec)] = vec
delta_f = 1.0/(vec.delta_t*N)
vectilde = FrequencySeries(zeros(n),delta_f=1.0,
dtype=complex_same_precision_as(vec))
fft(vec_pad,vectilde)
vectilde = FrequencySeries(vectilde * DYN_RANGE_FAC,delta_f=delta_f,dtype=complex64)
return vectilde
load_now=True)
# Get the interpolation method to be used to decompress the waveform
if self.waveform_decompression_method is not None :
decompression_method = self.waveform_decompression_method
else :
decompression_method = compressed_waveform.interpolation
logging.info("Decompressing waveform using %s", decompression_method)
if df is not None :
delta_f = df
else :
delta_f = self.delta_f
# Create memory space for writing the decompressed waveform
decomp_scratch = FrequencySeries(tempout[0:self.filter_length], delta_f=delta_f, copy=False)
# Get the decompressed waveform
hdecomp = compressed_waveform.decompress(out=decomp_scratch, f_lower=f_lower, interpolation=decompression_method)
p = props(self.table[index])
p.pop('approximant')
try:
tmpltdur = self.table[index].template_duration
except AttributeError:
tmpltdur = None
if tmpltdur is None or tmpltdur==0.0 :
tmpltdur = get_waveform_filter_length_in_time(approximant, **p)
hdecomp.chirp_length = tmpltdur
hdecomp.length_in_time = hdecomp.chirp_length
return hdecomp
freq_data = freq_data[data_start:]
noise_data = noise_data[data_start:]
flog = numpy.log(freq_data)
slog = numpy.log(noise_data)
psd_interp = scipy.interpolate.interp1d(flog, slog)
kmin = int(low_freq_cutoff / delta_f)
psd = numpy.zeros(length, dtype=numpy.float64)
vals = numpy.log(numpy.arange(kmin, length) * delta_f)
psd[kmin:] = numpy.exp(psd_interp(vals))
return FrequencySeries(psd, delta_f=delta_f)
----------
copy : `bool`, optional, default: `True`
if `True`, copy these data to a new array
Returns
-------
frequencyseries : `pycbc.types.frequencyseries.FrequencySeries`
a PyCBC representation of this `FrequencySeries`
"""
from pycbc import types
if self.epoch is None:
epoch = None
else:
epoch = self.epoch.gps
return types.FrequencySeries(self.value,
delta_f=self.df.to('Hz').value,
epoch=epoch, copy=copy)
def logv_lookup(vmax, delta):
vec = numpy.arange(0, vmax*1.2, delta)
vec[1:len(vec)] = numpy.log(vec[1:len(vec)])
return FrequencySeries(vec, delta_f=delta).astype(float32)