def sigma_cached(self, psd): """ Cache sigma calculate for use in tandem with the FilterBank class """ key = id(psd) if key not in self._sigmasq: # If possible, we precalculate the sigmasq vector for all possible waveforms if pycbc.waveform.waveform_norm_exists(self.approximant): if not hasattr(psd, 'sigmasq_vec'): psd.sigmasq_vec = {} if self.approximant not in psd.sigmasq_vec: psd.sigmasq_vec[ self. approximant] = pycbc.waveform.get_waveform_filter_norm( self.approximant, psd, len(psd), psd.delta_f, self.f_lower) # Get an amplitude normalization (mass dependant constant norm) amp_norm = pycbc.waveform.get_template_amplitude_norm( self.params, approximant=self.approximant) amp_norm = 1 if amp_norm is None else amp_norm scale = DYN_RANGE_FAC * amp_norm self._sigmasq[key] = psd.sigmasq_vec[self.approximant][ self.end_idx] * (scale)**2 else: self._sigmasq[key] = sigmasq(self, psd, low_frequency_cutoff=self.f_lower) return self._sigmasq[key]
def sigma_cached(self, psd): """ Cache sigma calculate for use in tandem with the FilterBank class """ key = id(psd) if key not in self._sigmasq or not hasattr(psd, '_sigma_cached_key'): psd._sigma_cached_key = True # If possible, we precalculate the sigmasq vector for all possible waveforms if pycbc.waveform.waveform_norm_exists(self.approximant): if not hasattr(psd, 'sigmasq_vec'): psd.sigmasq_vec = {} if self.approximant not in psd.sigmasq_vec: psd.sigmasq_vec[self.approximant] = pycbc.waveform.get_waveform_filter_norm( self.approximant, psd, len(psd), psd.delta_f, self.f_lower) # Get an amplitude normalization (mass dependant constant norm) amp_norm = pycbc.waveform.get_template_amplitude_norm( self.params, approximant=self.approximant) amp_norm = 1 if amp_norm is None else amp_norm scale = DYN_RANGE_FAC * amp_norm self._sigmasq[key] = psd.sigmasq_vec[self.approximant][self.end_idx] * (scale) **2 else: if not hasattr(psd, 'invsqrt'): psd.invsqrt = 1.0 / psd ** 0.5 self._sigmasq[key] = sigmasq(self * psd.invsqrt, low_frequency_cutoff=self.f_lower, high_frequency_cutoff=self.end_frequency) return self._sigmasq[key]
def rescale_to_snr(sig_list, snr, psd, f_lower): """Rescale the list of signals by the total detector SNR. Parameters ---------- sig_list : list List of the strain data (as TimeSeries object) for every detector snr : float The desiered SNR over all detectors psd : FrequencySeries The PSD that is used in all detectors f_lower : float Low frequency cutoff of the signals and the PSD Returns ------- list A list of the rescaled strain data in the order it was given in sig_list """ #for strain in sig_list: #print(strain.delta_f) #print("Length: {}".format(len(strain))) #print("Length PSD: {}".format(len(psd))) #print(psd.delta_f) snrsq_list = [ sigmasq(strain, psd=psd, low_frequency_cutoff=f_lower) for strain in sig_list ] div = np.sqrt(sum(snrsq_list)) return ([pt / div * snr for pt in sig_list])
def inner(vec1, vec2, psd=None, low_frequency_cutoff=None, high_frequency_cutoff=None, v1_norm=None, v2_norm=None): htilde = pf.make_frequency_series(vec1) stilde = pf.make_frequency_series(vec2) N = (len(htilde) - 1) * 2 global _snr _snr = None if _snr is None or _snr.dtype != htilde.dtype or len(_snr) != N: _snr = pt.zeros(N, dtype=pt.complex_same_precision_as(vec1)) snr, corr, snr_norm = pf.matched_filter_core(htilde, stilde, psd, low_frequency_cutoff, high_frequency_cutoff, v1_norm, out=_snr) if v2_norm is None: v2_norm = pf.sigmasq(stilde, psd, low_frequency_cutoff, high_frequency_cutoff) snr.data = snr.data * snr_norm / np.sqrt(v2_norm) return snr
def __init__(self, data, psds, low_frequency_cutoff=None, high_frequency_cutoff=None, sample_rate=32768, **kwargs): super(SingleTemplate, self).__init__(data=data, **kwargs) if low_frequency_cutoff is not None: low_frequency_cutoff = float(low_frequency_cutoff) if high_frequency_cutoff is not None: high_frequency_cutoff = float(high_frequency_cutoff) # Generate template waveforms df = data[tuple(data.keys())[0]].delta_f p = self.static_params.copy() if 'distance' in p: p.pop('distance') if 'inclination' in p: p.pop('inclination') hp, _ = get_fd_waveform(delta_f=df, distance=1, inclination=0, **p) if high_frequency_cutoff is None: high_frequency_cutoff = len(data[tuple(data.keys())[0]] - 1) * df # Extend data and template to high sample rate flen = int(sample_rate / df) / 2 + 1 hp.resize(flen) for ifo in data: data[ifo].resize(flen) # Calculate high sample rate SNR time series self.sh = {} self.hh = {} self.det = {} for ifo in data: self.det[ifo] = Detector(ifo) snr, _, _ = pyfilter.matched_filter_core( hp, data[ifo], psd=psds[ifo], low_frequency_cutoff=low_frequency_cutoff, high_frequency_cutoff=high_frequency_cutoff) self.sh[ifo] = 4 * df * snr self.hh[ifo] = -0.5 * pyfilter.sigmasq( hp, psd=psds[ifo], low_frequency_cutoff=low_frequency_cutoff, high_frequency_cutoff=high_frequency_cutoff) self.time = None
def __init__(self, variable_params, data, low_frequency_cutoff, sample_rate=32768, polarization_samples=None, **kwargs): variable_params, kwargs = self.setup_distance_marginalization( variable_params, marginalize_phase=True, **kwargs) super(SingleTemplate, self).__init__(variable_params, data, low_frequency_cutoff, **kwargs) # Generate template waveforms df = data[self.detectors[0]].delta_f p = self.static_params.copy() if 'distance' in p: _ = p.pop('distance') if 'inclination' in p: _ = p.pop('inclination') hp, _ = get_fd_waveform(delta_f=df, distance=1, inclination=0, **p) # Extend template to high sample rate flen = int(int(sample_rate) / df) / 2 + 1 hp.resize(flen) #polarization array to marginalize over if num_samples given self.pflag = 0 if polarization_samples is not None: self.polarization = numpy.linspace(0, 2 * numpy.pi, int(polarization_samples)) self.pflag = 1 # Calculate high sample rate SNR time series self.sh = {} self.hh = {} self.det = {} for ifo in self.data: flow = self.kmin[ifo] * df fhigh = self.kmax[ifo] * df # Extend data to high sample rate self.data[ifo].resize(flen) self.det[ifo] = Detector(ifo) snr, _, _ = pyfilter.matched_filter_core( hp, self.data[ifo], psd=self.psds[ifo], low_frequency_cutoff=flow, high_frequency_cutoff=fhigh) self.sh[ifo] = 4 * df * snr self.hh[ifo] = pyfilter.sigmasq(hp, psd=self.psds[ifo], low_frequency_cutoff=flow, high_frequency_cutoff=fhigh) self.time = None
def __init__(self, data, psds, low_frequency_cutoff=None, high_frequency_cutoff=None, sample_rate=32768, **kwargs): super(SingleTemplate, self).__init__(data=data, **kwargs) if low_frequency_cutoff is not None: low_frequency_cutoff = float(low_frequency_cutoff) if high_frequency_cutoff is not None: high_frequency_cutoff = float(high_frequency_cutoff) # Generate template waveforms df = data[data.keys()[0]].delta_f p = self.static_params.copy() if 'distance' in p: p.pop('distance') if 'inclination' in p: p.pop('inclination') hp, _ = get_fd_waveform(delta_f=df, distance=1, inclination=0, **p) if high_frequency_cutoff is None: high_frequency_cutoff = len(data[data.keys()[0]]-1) * df # Extend data and template to high sample rate flen = int(sample_rate / df) / 2 + 1 hp.resize(flen) for ifo in data: data[ifo].resize(flen) # Calculate high sample rate SNR time series self.sh = {} self.hh = {} self.det = {} for ifo in data: self.det[ifo] = Detector(ifo) snr, _, _ = pyfilter.matched_filter_core( hp, data[ifo], psd=psds[ifo], low_frequency_cutoff=low_frequency_cutoff, high_frequency_cutoff=high_frequency_cutoff) self.sh[ifo] = 4 * df * snr self.hh[ifo] = -0.5 * pyfilter.sigmasq( hp, psd=psds[ifo], low_frequency_cutoff=low_frequency_cutoff, high_frequency_cutoff=high_frequency_cutoff) self.time = None
def fmoment(n, htilde, psd, frange): """ Compute the n-th moment of frequency """ # Get frequency series of waveform f = htilde.get_sample_frequencies() fhtilde = types.FrequencySeries(initial_array=htilde.data * f.data**n, delta_f=htilde.delta_f) snrsq = sigmasq(htilde=htilde, psd=psd, low_frequency_cutoff=frange[0], high_frequency_cutoff=frange[1]) return (1.0/snrsq) * overlap(fhtilde, htilde, psd=psd, low_frequency_cutoff=frange[0], high_frequency_cutoff=frange[1], normalized=False)
def __init__(self, variable_params, data, low_frequency_cutoff, sample_rate=32768, **kwargs): super(SingleTemplate, self).__init__(variable_params, data, low_frequency_cutoff, **kwargs) # Generate template waveforms df = data[self.detectors[0]].delta_f p = self.static_params.copy() if 'distance' in p: _ = p.pop('distance') if 'inclination' in p: _ = p.pop('inclination') hp, _ = get_fd_waveform(delta_f=df, distance=1, inclination=0, **p) # Extend template to high sample rate flen = int(int(sample_rate) / df) / 2 + 1 hp.resize(flen) # Calculate high sample rate SNR time series self.sh = {} self.hh = {} self.det = {} for ifo in self.data: flow = self.kmin[ifo] * df fhigh = self.kmax[ifo] * df # Extend data to high sample rate self.data[ifo].resize(flen) self.det[ifo] = Detector(ifo) snr, _, _ = pyfilter.matched_filter_core( hp, self.data[ifo], psd=self.psds[ifo], low_frequency_cutoff=flow, high_frequency_cutoff=fhigh) self.sh[ifo] = 4 * df * snr self.hh[ifo] = -0.5 * pyfilter.sigmasq(hp, psd=self.psds[ifo], low_frequency_cutoff=flow, high_frequency_cutoff=fhigh) self.time = None
def test_filtering(self): idx = self.idx jdx = self.jdx #w1 = self.wps_list[idx] #w2 = self.wps_list[jdx] #stilde = get_waveform(w1, self.low_freq_filter-1, # self.sample_rate, self.filter_N, # self.sample_rate) #try: # stilde.save('data/skymaxtest_stilde_%d.hdf' % idx) #except: # pass stilde = load_frequencyseries(self.dataDir + \ 'skymaxtest_stilde_%d.hdf' % idx) s_norm = sigmasq(stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) stilde /= sqrt(float(s_norm)) stilde *= 100 #hplus, hcross = get_waveform(w2, self.low_freq_filter-1, # self.sample_rate, self.filter_N, # self.sample_rate, sky_max_template=True) #try: # hplus.save('data/skymaxtest_hplus_%d.hdf' % jdx) # hcross.save('data/skymaxtest_hcross_%d.hdf' % jdx) #except: # pass hplus = load_frequencyseries(self.dataDir + \ 'skymaxtest_hplus_%d.hdf' % jdx) hcross = load_frequencyseries(self.dataDir + \ 'skymaxtest_hcross_%d.hdf' % jdx) hplus.f_lower = self.low_freq_filter hplus.params = random.randint(0,100000000000) hcross.f_lower = self.low_freq_filter hcross.params = random.randint(0,100000000000) hp_norm = sigmasq(hplus, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) hc_norm = sigmasq(hcross, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) hplus /= sqrt(float(hp_norm)) hcross /= sqrt(float(hc_norm)) hpc_corr = overlap_cplx(hplus, hcross, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, normalized=False) hpc_corr_R = real(hpc_corr) I_plus, corr_plus, n_plus = matched_filter_core\ (hplus, stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, h_norm=1.) # FIXME: Remove the deepcopies before merging with master I_plus = copy.deepcopy(I_plus) corr_plus = copy.deepcopy(corr_plus) I_cross, corr_cross, n_cross = matched_filter_core\ (hcross, stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, h_norm=1.) I_cross = copy.deepcopy(I_cross) corr_cross = copy.deepcopy(corr_cross) I_plus = I_plus * n_plus I_cross = I_cross * n_cross IPM = abs(I_plus.data).argmax() ICM = abs(I_cross.data).argmax() self.assertAlmostEqual(abs(I_plus[IPM]), expected_results[idx][jdx]['Ip_snr']) self.assertAlmostEqual(angle(I_plus[IPM]), expected_results[idx][jdx]['Ip_angle']) self.assertEqual(IPM, expected_results[idx][jdx]['Ip_argmax']) self.assertAlmostEqual(abs(I_cross[ICM]), expected_results[idx][jdx]['Ic_snr']) self.assertAlmostEqual(angle(I_cross[ICM]), expected_results[idx][jdx]['Ic_angle']) self.assertEqual(ICM, expected_results[idx][jdx]['Ic_argmax']) #print "expected_results[{}][{}]['Ip_snr'] = {}" .format(idx,jdx,abs(I_plus[IPM])) #print "expected_results[{}][{}]['Ip_angle'] = {}".format(idx,jdx,angle(I_plus[IPM])) #print "expected_results[{}][{}]['Ip_argmax'] = {}".format(idx,jdx, IPM) #print "expected_results[{}][{}]['Ic_snr'] = {}" .format(idx,jdx,abs(I_cross[ICM])) #print "expected_results[{}][{}]['Ic_angle'] = {}".format(idx,jdx,angle(I_cross[ICM])) #print "expected_results[{}][{}]['Ic_argmax'] = {}".format(idx,jdx, ICM) det_stat_prec = compute_max_snr_over_sky_loc_stat\ (I_plus, I_cross, hpc_corr_R, hpnorm=1., hcnorm=1., thresh=0.1, analyse_slice=slice(0,len(I_plus.data))) det_stat_hom = compute_max_snr_over_sky_loc_stat_no_phase\ (I_plus, I_cross, hpc_corr_R, hpnorm=1., hcnorm=1., thresh=0.1, analyse_slice=slice(0,len(I_plus.data))) idx_max_prec = argmax(det_stat_prec.data) idx_max_hom = argmax(det_stat_hom.data) max_ds_prec = det_stat_prec[idx_max_prec] max_ds_hom = det_stat_hom[idx_max_hom] uvals_prec, _ = compute_u_val_for_sky_loc_stat\ (I_plus.data, I_cross.data, hpc_corr_R, indices=[idx_max_prec], hpnorm=1., hcnorm=1.) uvals_hom, _ = compute_u_val_for_sky_loc_stat_no_phase\ (I_plus.data, I_cross.data, hpc_corr_R, indices=[idx_max_hom], hpnorm=1., hcnorm=1.) ht = hplus * uvals_hom[0] + hcross ht_norm = sigmasq(ht, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) ht /= sqrt(float(ht_norm)) ht.f_lower = self.low_freq_filter ht.params = random.randint(0,100000000000) I_t, corr_t, n_t = matched_filter_core\ (ht, stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, h_norm=1.) I_t = I_t * n_t self.assertAlmostEqual(abs(real(I_t.data[idx_max_hom])), max_ds_hom) self.assertEqual(abs(real(I_t.data[idx_max_hom])), max(abs(real(I_t.data)))) chisq, _ = self.power_chisq.values\ (corr_t, array([max_ds_hom]) / n_plus, n_t, self.psd, array([idx_max_hom]), ht) ht = hplus * uvals_prec[0] + hcross ht_norm = sigmasq(ht, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) ht /= sqrt(float(ht_norm)) ht.f_lower = self.low_freq_filter ht.params = random.randint(0,100000000000) I_t, corr_t, n_t = matched_filter_core\ (ht, stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, h_norm=1.) I_t = I_t * n_t chisq, _ = self.power_chisq.values\ (corr_t, array([max_ds_prec]) / n_plus, n_t, self.psd, array([idx_max_prec]), ht) self.assertAlmostEqual(abs(I_t.data[idx_max_prec]), max_ds_prec) self.assertEqual(idx_max_prec, abs(I_t.data).argmax()) self.assertTrue(chisq < 1E-4)
def test_filtering(self): idx = self.idx jdx = self.jdx #w1 = self.wps_list[idx] #w2 = self.wps_list[jdx] #stilde = get_waveform(w1, self.low_freq_filter-1, # self.sample_rate, self.filter_N, # self.sample_rate) #try: # stilde.save('data/skymaxtest_stilde_%d.hdf' % idx) #except: # pass stilde = load_frequencyseries(self.dataDir + \ 'skymaxtest_stilde_%d.hdf' % idx) s_norm = sigmasq(stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) stilde /= sqrt(float(s_norm)) stilde *= 100 #hplus, hcross = get_waveform(w2, self.low_freq_filter-1, # self.sample_rate, self.filter_N, # self.sample_rate, sky_max_template=True) #try: # hplus.save('data/skymaxtest_hplus_%d.hdf' % jdx) # hcross.save('data/skymaxtest_hcross_%d.hdf' % jdx) #except: # pass hplus = load_frequencyseries(self.dataDir + \ 'skymaxtest_hplus_%d.hdf' % jdx) hcross = load_frequencyseries(self.dataDir + \ 'skymaxtest_hcross_%d.hdf' % jdx) hplus.f_lower = self.low_freq_filter hplus.params = random.randint(0, 100000000000) hcross.f_lower = self.low_freq_filter hcross.params = random.randint(0, 100000000000) hp_norm = sigmasq(hplus, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) hc_norm = sigmasq(hcross, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) hplus /= sqrt(float(hp_norm)) hcross /= sqrt(float(hc_norm)) hpc_corr = overlap_cplx(hplus, hcross, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, normalized=False) hpc_corr_R = real(hpc_corr) I_plus, corr_plus, n_plus = matched_filter_core\ (hplus, stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, h_norm=1.) # FIXME: Remove the deepcopies before merging with master I_plus = copy.deepcopy(I_plus) corr_plus = copy.deepcopy(corr_plus) I_cross, corr_cross, n_cross = matched_filter_core\ (hcross, stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, h_norm=1.) I_cross = copy.deepcopy(I_cross) corr_cross = copy.deepcopy(corr_cross) I_plus = I_plus * n_plus I_cross = I_cross * n_cross IPM = abs(I_plus.data).argmax() ICM = abs(I_cross.data).argmax() self.assertAlmostEqual(abs(I_plus[IPM]), expected_results[idx][jdx]['Ip_snr']) self.assertAlmostEqual(angle(I_plus[IPM]), expected_results[idx][jdx]['Ip_angle']) self.assertEqual(IPM, expected_results[idx][jdx]['Ip_argmax']) self.assertAlmostEqual(abs(I_cross[ICM]), expected_results[idx][jdx]['Ic_snr']) self.assertAlmostEqual(angle(I_cross[ICM]), expected_results[idx][jdx]['Ic_angle']) self.assertEqual(ICM, expected_results[idx][jdx]['Ic_argmax']) #print "expected_results[{}][{}]['Ip_snr'] = {}" .format(idx,jdx,abs(I_plus[IPM])) #print "expected_results[{}][{}]['Ip_angle'] = {}".format(idx,jdx,angle(I_plus[IPM])) #print "expected_results[{}][{}]['Ip_argmax'] = {}".format(idx,jdx, IPM) #print "expected_results[{}][{}]['Ic_snr'] = {}" .format(idx,jdx,abs(I_cross[ICM])) #print "expected_results[{}][{}]['Ic_angle'] = {}".format(idx,jdx,angle(I_cross[ICM])) #print "expected_results[{}][{}]['Ic_argmax'] = {}".format(idx,jdx, ICM) det_stat_prec = compute_max_snr_over_sky_loc_stat\ (I_plus, I_cross, hpc_corr_R, hpnorm=1., hcnorm=1., thresh=0.1, analyse_slice=slice(0,len(I_plus.data))) det_stat_hom = compute_max_snr_over_sky_loc_stat_no_phase\ (I_plus, I_cross, hpc_corr_R, hpnorm=1., hcnorm=1., thresh=0.1, analyse_slice=slice(0,len(I_plus.data))) idx_max_prec = argmax(det_stat_prec.data) idx_max_hom = argmax(det_stat_hom.data) max_ds_prec = det_stat_prec[idx_max_prec] max_ds_hom = det_stat_hom[idx_max_hom] uvals_prec, _ = compute_u_val_for_sky_loc_stat\ (I_plus.data, I_cross.data, hpc_corr_R, indices=[idx_max_prec], hpnorm=1., hcnorm=1.) uvals_hom, _ = compute_u_val_for_sky_loc_stat_no_phase\ (I_plus.data, I_cross.data, hpc_corr_R, indices=[idx_max_hom], hpnorm=1., hcnorm=1.) ht = hplus * uvals_hom[0] + hcross ht_norm = sigmasq(ht, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) ht /= sqrt(float(ht_norm)) ht.f_lower = self.low_freq_filter ht.params = random.randint(0, 100000000000) I_t, corr_t, n_t = matched_filter_core\ (ht, stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, h_norm=1.) I_t = I_t * n_t self.assertAlmostEqual(abs(real(I_t.data[idx_max_hom])), max_ds_hom) self.assertEqual(abs(real(I_t.data[idx_max_hom])), max(abs(real(I_t.data)))) chisq, _ = self.power_chisq.values\ (corr_t, array([max_ds_hom]) / n_plus, n_t, self.psd, array([idx_max_hom]), ht) ht = hplus * uvals_prec[0] + hcross ht_norm = sigmasq(ht, psd=self.psd, low_frequency_cutoff=self.low_freq_filter) ht /= sqrt(float(ht_norm)) ht.f_lower = self.low_freq_filter ht.params = random.randint(0, 100000000000) I_t, corr_t, n_t = matched_filter_core\ (ht, stilde, psd=self.psd, low_frequency_cutoff=self.low_freq_filter, h_norm=1.) I_t = I_t * n_t chisq, _ = self.power_chisq.values\ (corr_t, array([max_ds_prec]) / n_plus, n_t, self.psd, array([idx_max_prec]), ht) self.assertAlmostEqual(abs(I_t.data[idx_max_prec]), max_ds_prec) self.assertEqual(idx_max_prec, abs(I_t.data).argmax()) self.assertTrue(chisq < 1E-4)
psd = FrequencySeries(psd, delta_f=psd.delta_f, dtype=float32) with ctx: print("Pregenerating Signals") signals = [] index = 0 for signal_params in signal_table: index += 1 update_progress(index / len(signal_table)) stilde = get_waveform(options.signal_approximant, options.signal_phase_order, options.signal_amplitude_order, signal_params, options.signal_start_frequency, options.filter_sample_rate, filter_N) s_norm = sigmasq( stilde, psd=psd, low_frequency_cutoff=options.filter_low_frequency_cutoff) stilde /= psd signals.append((stilde, s_norm, [], signal_params)) print("Calculating Overlaps") index = 0 # Calculate the overlaps for template_params in template_table: index += 1 update_progress(float(index) / len(template_table)) h_norm = htilde = None for stilde, s_norm, matches, signal_params in signals: # Check if we need to look at this template if options.mchirp_window and outside_mchirp_window( template_params, signal_params, options.mchirp_window):
with ctx: print("Pregenerating Signals") signals = [] index = 0 for signal_params in signal_table: index += 1 update_progress(index/len(signal_table)) stilde = get_waveform(options.signal_approximant, options.signal_phase_order, options.signal_amplitude_order, signal_params, options.signal_start_frequency, options.filter_sample_rate, filter_N) s_norm = sigmasq(stilde, psd=psd, low_frequency_cutoff=options.filter_low_frequency_cutoff) stilde /= psd signals.append( (stilde, s_norm, [], signal_params) ) print("Calculating Overlaps") index = 0 # Calculate the overlaps for template_params in template_table: index += 1 update_progress(float(index)/len(template_table)) h_norm = htilde = None for stilde, s_norm, matches, signal_params in signals: # Check if we need to look at this template if options.mchirp_window and outside_mchirp_window(template_params, signal_params, options.mchirp_window): matches.append(-1)