u = np.cos(inc) u2 = np.square(u) # Signal models for each detector. H = filter.sngl_inspiral_psd(waveform, mass1=sim_inspiral.mass1, mass2=sim_inspiral.mass2, spin1x=sim_inspiral.spin1x, spin1y=sim_inspiral.spin1y, spin1z=sim_inspiral.spin1z, spin2x=sim_inspiral.spin2x, spin2y=sim_inspiral.spin2y, spin2z=sim_inspiral.spin2z, f_min=f_low) W = [filter.signal_psd_series(H, psds[ifo]) for ifo in opts.detector] signal_models = [timing.SignalModel(_) for _ in W] # Get SNR=1 horizon distances for each detector. horizons = np.asarray([ signal_model.get_horizon_distance() for signal_model in signal_models ]) # Get antenna factors for each detector. Fplus, Fcross = np.asarray([ lal.ComputeDetAMResponse(response, ra, dec, psi, gmst) for response in responses ]).T # Compute TOAs at each detector. toas = np.asarray([ lal.TimeDelayFromEarthCenter(location, ra, dec, epoch)
phi = sim_inspiral.coa_phase psi = sim_inspiral.polarization epoch = lal.LIGOTimeGPS( sim_inspiral.geocent_end_time, sim_inspiral.geocent_end_time_ns) gmst = lal.GreenwichMeanSiderealTime(epoch) waveform = sim_inspiral.waveform if opts.waveform is None else opts.waveform approximant, amplitude_order, phase_order = \ timing.get_approximant_and_orders_from_string(waveform) # Pre-evaluate some trigonometric functions that we will need. u = np.cos(inc) u2 = np.square(u) # Signal models for each detector. signal_models = [ timing.SignalModel(m1, m2, psds[ifo], f_low, approximant, amplitude_order, phase_order) for ifo in opts.detector] # Get SNR=1 horizon distances for each detector. horizons = np.asarray([signal_model.get_horizon_distance() for signal_model in signal_models]) # Get antenna factors for each detector. Fplus, Fcross = np.asarray([ lal.ComputeDetAMResponse(response, ra, dec, psi, gmst) for response in responses]).T # Compute TOAs at each detector. toas = np.asarray([lal.TimeDelayFromEarthCenter(location, ra, dec, epoch) for location in locations])
_f = np.atleast_1d(f) ret = np.empty(_f.shape, dtype=float) cond = (5 <= _f) & (_f <= 1800) ret[cond] = self.func(_f[cond]) ret[~cond] = 0. if np.isscalar(f): ret = np.asscalar(ret) return ret psdfuncs = [psdfunc(psds[ifo]) for ifo in opts.detector] # Compute horizon distances for each template, for each detector progress.update(-1, 'computing signal models') horizons_bank = [ [ timing.SignalModel(sngl.mass1, sngl.mass2, S, template_bank_f_low, template_approximant, template_amplitude_order, template_phase_order).get_horizon_distance() for S in psdfuncs ] for sngl in template_bank] # Generate templates for each unique set of intrinsic parameters # FIXME: Get template_duration, template_approximant, template_amplitude_order, and template_phase_order from sngl_inspiral table. progress.update(-1, 'computing template bank') template_bank = [ [ filter.generate_template(sngl.mass1, sngl.mass2, S, template_bank_f_low, sample_rate, template_duration, template_approximant, template_amplitude_order, template_phase_order) for S in psdfuncs ] for sngl in template_bank] # Generate PSDs for data coloring progress.update(-1, 'computing PSDs') def generate_psd(S):
from lalinference.bayestar import filter from lalinference.bayestar import timing def abs2(x): return np.square(np.real(x)) + np.square(np.imag(x)) mass1 = 1.4 mass2 = 1.4 f_low = 40 S = timing.get_noise_psd_func('H1') # Compute Fisher matrix elements for full signal (for comparison). signal_model = timing.SignalModel( mass1, mass2, S, f_low, *timing.get_approximant_and_orders_from_string('TaylorF2threePointFivePN')) w1 = signal_model.get_sn_moment(1) w2 = signal_model.get_sn_moment(2) # Compute 1 second of autocorrelation sequence. # FIXME: make this the longest lag that we are going to integrate over. acor_series, sample_rate = filter.autocorrelation( mass1, mass2, S, f_low, 1, *timing.get_approximant_and_orders_from_string('TaylorF2threePointFivePN')) # Augment autocorrelation sequence with negative time lags. n = len(acor_series) t = np.arange(1 - n, n) / sample_rate acor_series = np.concatenate((np.conj(acor_series[:0:-1]), acor_series))