コード例 #1
0
def reference_psds_for_filename(filename):
    xmldoc = ligolw_utils.load_filename(
        filename, contenthandler=lal.series.PSDContentHandler)
    psds = lal.series.read_psd_xmldoc(xmldoc)
    return dict(
        (key, timing.InterpolatedPSD(filter.abscissa(psd), psd.data.data))
        for key, psd in psds.iteritems() if psd is not None)
コード例 #2
0
 def reference_psds_for_filename(filename):
     xmldoc = ligolw_utils.load_filename(
         filename, contenthandler=lal.series.PSDContentHandler)
     psds = lal.series.read_psd_xmldoc(xmldoc, root_name=None)
     return {
         key: timing.InterpolatedPSD(filter.abscissa(psd), psd.data.data,
             f_high_truncate=opts.f_high_truncate)
         for key, psd in psds.items() if psd is not None}
コード例 #3
0
    def reference_psd_for_sngl(sngl):
        psd = psdseglistdict[sngl.ifo]
        try:
            psd = psd[psd.find(sngl.get_end())].psd
        except ValueError:
            raise ValueError(
                'No PSD found for detector {0} at GPS time {1}'.format(
                sngl.ifo, sngl.get_end()))

        flow = psd.file.attrs['low_frequency_cutoff']
        df = psd.attrs['delta_f']
        kmin = int(flow / df)

        fseries = lal.CreateREAL8FrequencySeries(
            'psd', psd.attrs['epoch'], kmin * df, df,
            lal.StrainUnit**2 / lal.HertzUnit, len(psd.value) - kmin)
        fseries.data.data = psd.value[kmin:] / np.square(DYN_RANGE_FAC)

        return timing.InterpolatedPSD(
            filter.abscissa(fseries), fseries.data.data,
            f_high_truncate=opts.f_high_truncate)
コード例 #4
0
    ['LIGO-T1100338-v13-L1-SPECTRA-951280082-MODE.txt', "L1\nS6", False],
    ['LIGO-T1100338-v13-V1-SPECTRA-935662133-MODE.txt', "V1\nVSR2-3", False],
    ['LIGO-T0900288-v3-ZERO_DET_high_P.txt', "aLIGO\ndesign", True]
]

mass1 = mass2 = 1.4

fig = plt.figure(figsize=(11, 8.5))
gridspec = mgridspec.GridSpec(len(data), 3, wspace=0.1, hspace=0.1)

for i, (filename, label, need_square) in enumerate(data):
    path = os.path.join('psds', filename)
    f, S = np.loadtxt(path).T
    if need_square:
        S *= S
    S = timing.InterpolatedPSD(f, S)

    ax = fig.add_subplot(gridspec[i, 0])
    f = np.logspace(0, 4, 1000)
    ax.loglog(f, np.sqrt(S(f)), color='k')
    ax.set_ylabel(label, rotation='horizontal', ha='right', labelpad=20)
    ax.set_xlim(10, 1e4)
    ax.set_ylim(1e-24, 1e-21)
    if i == len(data) - 1:
        ax.set_xlabel('frequency (Hz)')
    else:
        plt.setp(ax.get_xticklabels(), visible=False)
    if i == 0:
        ax.set_title('Noise amp. spectral density')

    duration = lalsimulation.SimInspiralTaylorF2ReducedSpinChirpTime(
コード例 #5
0
    [glue.lal.LIGOTimeGPS(0),
     glue.lal.LIGOTimeGPS(2e9)])
search_summary_table = lsctables.New(lsctables.SearchSummaryTable)
out_xmldoc.childNodes[0].appendChild(search_summary_table)
summary = ligolw_search_summary.append_search_summary(out_xmldoc,
                                                      process,
                                                      inseg=all_time,
                                                      outseg=all_time)

# Read PSDs.
progress.update(-1, 'reading ' + opts.reference_psd.name)
xmldoc, _ = ligolw_utils.load_fileobj(
    opts.reference_psd, contenthandler=lal.series.PSDContentHandler)
psds = lal.series.read_psd_xmldoc(xmldoc, root_name=None)
psds = {
    key: timing.InterpolatedPSD(filter.abscissa(psd), psd.data.data)
    for key, psd in psds.items() if psd is not None
}

# Read injection file.
progress.update(-1, 'reading ' + opts.input.name)
xmldoc, _ = ligolw_utils.load_fileobj(
    opts.input, contenthandler=ligolw_bayestar.LSCTablesContentHandler)

# Extract simulation table from injection file.
sim_inspiral_table = ligolw_table.get_table(
    xmldoc, lsctables.SimInspiralTable.tableName)

# Create a SnglInspiral table and initialize its row ID counter.
sngl_inspiral_table = lsctables.New(lsctables.SnglInspiralTable)
out_xmldoc.childNodes[0].appendChild(sngl_inspiral_table)