# if opts.fmin_template2:
#     fmin = np.min([fmin, opts.fmin_template2])
fmaxSNR = 1700
analyticPSD_Q = True

psd_dict = {}
ifo_list = []

psd = lalsim.SimNoisePSDaLIGOZeroDetHighPower
if opts.psd_file:
    analyticPSD_Q = False

    for inst, psdf in map(lambda c: c.split("="), opts.psd_file):
        if opts.verbose:
            print("Reading PSD for instrument %s from %s" % (inst, psdf))
        psd_dict[inst] = lalsimutils.load_resample_and_clean_psd(
            psdf, inst, df)

    ifo_list = psd_dict.keys()

elif opts.psd and hasattr(lalsim, opts.psd):
    ifo_list = ['H1', 'L1']
    psd = getattr(lalsim, opts.psd)

fNyq = opts.srate / 2.
IP = None
IP_list = {}
if opts.maximize:
    for ifo in ifo_list:
        IP_list[ifo] = lalsimutils.ComplexOverlap(fNyq=fNyq,
                                                  deltaF=df,
                                                  analyticPSD_Q=analyticPSD_Q,
    print(" Fisher in matrix form is ", mtx)

    # make distance function
    dist_here = make_distance_for_fisher(mtx, param_names)
elif opts.approx:

    if not opts.psd_file:
        #eff_fisher_psd = eval(opts.fisher_psd)
        eff_fisher_psd = getattr(
            lalsim, opts.fisher_psd
        )  # --fisher-psd SimNoisePSDaLIGOZeroDetHighPower   now
        analyticPSD_Q = True
    else:
        print(" Importing PSD file ", opts.psd_file)
        eff_fisher_psd = lalsimutils.load_resample_and_clean_psd(
            opts.psd_file, 'H1', 1. / opts.seglen)
        analyticPSD_Q = False

    ###
    ###  Create the  inner product function, etc needed (distance =match)
    ###
    P = lalsimutils.ChooseWaveformParams()
    P.m1 = P.m2 = 50 * lal.MSUN_SI
    P.approx = lalsim.GetApproximantFromString(opts.approx)
    P.deltaT = 1. / srate
    P.deltaF = 1. / opts.seglen
    hfBase = lalsimutils.complex_hoff(P)
    IP = lalsimutils.CreateCompatibleComplexOverlap(
        hfBase,
        analyticPSD_Q=analyticPSD_Q,
        psd=eff_fisher_psd,
Exemple #3
0
for ifo in ifo_list:
    try:
        channel = ifo + ":FAKE-STRAIN"
        data_dict[ifo] = lalsimutils.frame_data_to_non_herm_hoff(
            opts.cache, channel)
        fSample = len(data_dict[ifo].data.data) * data_dict[ifo].deltaF
        df = data_dict[ifo].deltaF
        if not (ifo in psd_name):
            print(ifo, " analytic psd ", opts.psd)
            analyticPSD_Q = True
            psd_dict[ifo] = eval(opts.psd)
        else:
            analyticPSD_Q = False
            print("Reading PSD for instrument %s from %s" %
                  (ifo, psd_name[ifo]))
            psd_dict[ifo] = lalsimutils.load_resample_and_clean_psd(
                psd_name[ifo], ifo, df)
        IP = lalsimutils.ComplexIP(fLow=fminSNR,
                                   fNyq=fSample / 2,
                                   deltaF=df,
                                   psd=psd_dict[ifo],
                                   fMax=fmaxSNR,
                                   analyticPSD_Q=analyticPSD_Q)
        rhoDet = rho_dict[ifo] = IP.norm(data_dict[ifo])
        print(ifo, rho_dict[ifo])
        rho2Net += rhoDet * rhoDet
        if opts.plot_sanity:
            fvals = lalsimutils.evaluate_fvals(data_dict[ifo])
            plt.plot(
                fvals,
                np.power(np.abs(data_dict[ifo].data.data), 2) *
                IP.weights2side)