def finalize_as_template(self): if not self.bank.use_metric: return df, PSD = get_neighborhood_PSD([self], self.flow, self.bank.noise_model) curr_len = (len(PSD) - self.flow // df) length_check = curr_len > self.bank._moments[df][0].length if df not in self.bank._moments or length_check: real8vector_psd = CreateREAL8Vector(len(PSD)) real8vector_psd.data[:] = PSD self.bank._moments[df] = create_moments(df, self.flow, len(PSD)) lalsim.SimInspiralTaylorF2RedSpinComputeNoiseMoments( *(self.bank._moments[df] + (real8vector_psd, self.flow, df)) ) self._metric = lalsim.SimInspiralTaylorF2RedSpinMetricChirpTimes( self._theta0, self._theta3, self._theta3s, self.flow, df, *self.bank._moments[df] ) if isnan(self._metric[0]): raise ValueError("g00 is nan")
# Transform to chirp times. thetas_0 = lalsimulation.SimInspiralTaylorF2RedSpinChirpTimesFromMchirpEtaChi( mchirp0, eta0, chi0, f_low) # Sampled PSD. f_high = 2048 df = 0.1 S = lal.CreateREAL8Vector(int(f_high // df)) S.data = [lalsimulation.SimNoisePSDaLIGOZeroDetHighPower(i * df) for i in range(len(S.data))] # Allocate noise moments. moments = [lal.CreateREAL8Vector(int((f_high - f_low) // df)) for _ in range(29)] # Compute noise moments. lalsimulation.SimInspiralTaylorF2RedSpinComputeNoiseMoments( *(moments + [S, f_low, df])) # Compute Fisher information matrix. Note factor of 2: # The function SimInspiralTaylorF2RedSpinFisherMatrixChirpTimes # returns the Fisher matrix for an SNR of 1/sqrt(2). The factor # of 2 makes this the Fisher matrix at unit SNR. I = lalsimulation.SimInspiralTaylorF2RedSpinFisherMatrixChirpTimes( *(thetas_0 + [f_low, df] + moments)).data * 2 # Now amplify to the requested SNR. I *= np.square(opts.snr) # Blockwise separation of Fisher matrix. Parameters are in the following order: # theta0, theta3, theta3S, t0, phi0 IA = I[0:3, 0:3] # intrinsic block IB = I[0:3, 3:5] # cross block