det = str(sngl_row.ifo) print(det, rhoExpected[det]) m1 = m1 * lal.LAL_MSUN_SI m2 = m2 * lal.LAL_MSUN_SI rho2Net = 0 for det in rhoExpected: rho2Net += rhoExpected[det]**2 if rosDebugMessagesDictionary["DebugMessages"]: print(" Network :", np.sqrt(rho2Net)) # Create a 'best recovered signal' Psig = lalsimutils.ChooseWaveformParams( m1=m1, m2=m2, approx=approxSignal, fmin=fminWavesSignal, dist=factored_likelihood.distMpcRef * 1e6 * lal.LAL_PC_SI, # default distance fref=fref, tref=event_time_gps, ampO=ampO ) # FIXME: Parameter mapping from trigger space to search space if rosDebugMessagesDictionary["DebugMessages"]: print( " === Coinc table : estimated signal [overridden if injection] ===" ) Psig.print_params() # Read in *injection* XML if opts.inj: print("Loading injection XML:", opts.inj) Psig = lalsimutils.xml_to_ChooseWaveformParams_array(str(opts.inj))[
sngl_insp_table.sync_next_id() for (m1, m2) in itertools.chain(*grid): sngl_insp = sngl_insp_table.RowType() sngl_insp.event_id = sngl_insp_table.get_next_id() #sngl_insp.mass1, sngl_insp.mass2 = m1/lal.LAL_MSUN_SI, m2/lal.LAL_MSUN_SI sngl_insp.mass1, sngl_insp.mass2 = m1, m2 sngl_insp.process_id = proc_id sngl_insp_table.append(sngl_insp) return sngl_insp_table # Setup signal and IP class m1 = 1.5 * lal.LAL_MSUN_SI m2 = 1.35 * lal.LAL_MSUN_SI PSIG = lsu.ChooseWaveformParams(m1=m1, m2=m2, approx=lalsim.TaylorT1) PTEST = PSIG.copy() # find deltaF for lower end of range we're looking in PTEST.m1 *= 0.9 PTEST.m2 *= 0.9 PSIG.deltaF = lsu.findDeltaF(PTEST) IP = lsu.Overlap(fLow=40., deltaF=PSIG.deltaF, psd=lal.LIGOIPsd) PTMPLT = PSIG.copy() hfSIG = lsu.norm_hoff(PSIG, IP) McSIG = lsu.mchirp(m1, m2) etaSIG = lsu.symRatio(m1, m2) NMcs = 11 NEtas = 11 param_names = ['Mc', 'eta'] # Find appropriate parameter ranges param_ranges = eff.find_effective_Fisher_region(
# Generate an inner product using the original discrete PSD # Perform an inner product using it *and* using an analytic PSD # # Populate signal m1 = 10*lal.LAL_MSUN_SI m2 = 10*lal.LAL_MSUN_SI df = psd_dict[detectors[0]].deltaF fSample = df * 2 *( len(psd_dict[detectors[0]].data.data)-1) # rescale print("To construct a signal, we reconstruct the sampling rate and time window, consistent with the default PSD sampling: (fSample, 1/df) = ", fSample, 1/df) Psig = lalsimutils.ChooseWaveformParams( m1 = m1,m2 =m2, fmin = 30, fref=100, ampO=0, tref = lal.GPSTimeNow(), # factored_likelihood requires GPS be assigned radec=True, theta=1.2, phi=2.4, detector='H1', dist=25.*1.e6*lal.LAL_PC_SI, deltaT=1./fSample, deltaF = df ) data_dict={} data_dict['H1'] = lalsimutils.non_herm_hoff(Psig) Psig.detector = 'L1' data_dict['L1'] = lalsimutils.non_herm_hoff(Psig) Psig.detector = 'V1' data_dict['V1'] = lalsimutils.non_herm_hoff(Psig) psd_analytic_dict = {} psd_analytic_dict['H1'] = lalsim.SimNoisePSDaLIGOZeroDetHighPower# lal.LIGOIPsd psd_analytic_dict['L1'] = lalsim.SimNoisePSDaLIGOZeroDetHighPower #lal.LIGOIPsd psd_analytic_dict['V1'] = lalsim.SimNoisePSDaLIGOZeroDetHighPower # lal.LIGOIPsd
print(" ======= Template specified: precomputing all quantities ==========") # Struct to hold template parameters # Fiducial distance provided but will not be used m1 = 4 * lal.MSUN_SI m2 = 4 * lal.MSUN_SI ampO = opts.amporder # sets which modes to include in the physical signal Lmax = opts.Lmax # sets which modes to include fref = opts.fref P = lalsimutils.ChooseWaveformParams( fmin=fminWaves, radec=False, m1=m1, m2=m2, ampO=ampO, approx=approxTemplate, fref=fref, deltaT=1. / fSample, tref=theEpochFiducial, dist=100 * 1.e6 * lal.PC_SI, # critical that this is fiducial (will be reset later) deltaF=df) tStartPrecompute = lal.GPSTimeNow() rholms_intp, crossTerms, crossTermsV, rholms, rest = factored_likelihood.PrecomputeLikelihoodTerms( theEpochFiducial, 0.1, P, data_dict, psd_dict, Lmax, 2000,
# Create artificial "signal". Needed to minimize duplicate code when I # - consistently test waveform duration # - copy template parameters # - [test code] : generate plots vs time [test code], expected SNR, etc # WARNING: Test code plots will not look perfect, because we don't know the true sky location (or phase, polarization, ...) if not Psig and opts.channel_name: # If data loaded but no signal generated if (not opts.template_mass1) or (not opts.template_mass2) or ( not opts.force_gps_time): print( " CANCEL: For frame-file reading, arguments --mass1 --mass2 --event-time all required " ) # print opts.template_mass1, opts.template_mass2,opts.force_gps_time sys.exit(0) Psig = lalsimutils.ChooseWaveformParams( approx=approxSignal, fmin=fminWavesSignal, dist=factored_likelihood.distMpcRef * 1e6 * lalsimutils.lsu_PC, # default distance fref=fref) Psig.m1 = lalsimutils.lsu_MSUN * opts.template_mass1 Psig.m2 = lalsimutils.lsu_MSUN * opts.template_mass2 Psig.tref = lal.LIGOTimeGPS(0.000000000) # Initialize as GPSTime object Psig.tref += opts.force_gps_time # Pass value of float into it # TEST THE SEGMENT LENGTH TARGET if Psig: f_temp = Psig.fmin if Psig.fmin < 1e-2: Psig.fmin = opts.fmin_SNR # necessary for duration estimate print(" Min frequency for duration ... ", Psig.fmin) Psig.print_params() timeSegmentLength = lalsimutils.estimateWaveformDuration(
if rosUseRandomEventTime: print(" --- Generating a random event (barycenter) time ---- ") tEventFiducial += 0.05 * np.random.random_sample() ampO = 0 # sets which modes to include in the physical signal Lmax = 2 # sets which modes to include in the output fref = 100 Psig = lalsimutils.ChooseWaveformParams(fmin=fminWaves, radec=True, incl=0.0, phiref=0.0, theta=0.2, phi=0, psi=0.0, m1=m1, m2=m2, ampO=ampO, approx=approxSignal, fref=fref, tref=theEpochFiducial + tEventFiducial, deltaT=1. / fSample, detector='H1', dist=distanceFiducial * 1.e6 * lal.LAL_PC_SI) if rosUseRandomSkyLocation: print(" --- Generating a random sky location ---- ") Psig.theta = np.arccos(2 * (np.random.random_sample()) - 1) Psig.phi = (np.random.random_sample()) * 2 * lal.LAL_PI Psig.psi = (np.random.random_sample()) * lal.LAL_PI if rosUseRandomSourceOrientation: print(" --- Generating a random source orientation ---- ")
m1 = 4 * lal.LAL_MSUN_SI m2 = 4 * lal.LAL_MSUN_SI ampO = 0 # sets which modes to include in the physical signal Lmax = 2 # sets which modes to include in the output fref = 100 # Struct to hold template parameters P = lsu.ChooseWaveformParams(fmin=fminWavesTemplate, radec=False, incl=0.0, phiref=0.0, theta=0.0, phi=0, psi=0.0, m1=m1, m2=m2, ampO=ampO, fref=fref, tref=theEpochFiducial, deltaT=1. / fSample, dist=100 * 1.e6 * lal.LAL_PC_SI, deltaF=df) # # Perform the Precompute stage # rholms_intp, crossTerms, rholms, epoch_post = factored_likelihood.PrecomputeLikelihoodTerms( theEpochFiducial, P, data_dict, psd_dict, Lmax, analyticPSD_Q) print("Finished Precomputation...") print("====Generating metadata from precomputed results =====")