svd_bank_snr module¶
Short cutting gstlal inspiral pipeline to produce SNR for gstlal_svd_bank. A gstlal-based direct matched filter in time domain is also implemented.
- class svd_bank_snr.Bank(bank_xmldoc, psd, rate, f_low, f_high=None, autocorrelation_length=None, verbose=False)[source]¶
Bases:
object
FIXME: This is a class used to mimic the behavior of the svd bank object.
- class svd_bank_snr.Bank_SNR(start, end, instrument, bank, bank_number=0, method='LLOID')[source]¶
Bases:
object
An data interface between the SNRPipelineHandler and the SNR pipeline.
This is a class that defines the approximate start time and end time for which the SNR should be collected.
- property duration¶
float: The approximate duration of all SNRs timeseries.
- property end¶
float: The end time of all SNRs timeseries calculated from buffer timestamp and data.
- finish(COMPLEX=False)[source]¶
Settling down the collected SNRs and parse them to LAL series.
- Note:
This method can only be called once.
- Args:
COMPLEX (bool): True if required complex SNR, False otherwise.
- property instrument¶
str: The instrument of the SNR.
- property start¶
float: The approximate start time of all SNRs timeseries based on the buffer timestamp.
- class svd_bank_snr.ContentHandler(document, start_handlers={})[source]¶
Bases:
LIGOLWContentHandler
- startArray(parent, attrs)¶
- startColumn(parent, attrs)¶
- startParam(parent, attrs)¶
- startStream(parent, attrs, __orig_startStream=<function use_in.<locals>.startStream>)¶
- startTable(parent, attrs, __orig_startTable=<function use_in.<locals>.startTable>)¶
- class svd_bank_snr.SNRContentHandler(document, start_handlers={})[source]¶
Bases:
LIGOLWContentHandler
- startArray(parent, attrs)¶
- startParam(parent, attrs)¶
- startStream(parent, attrs, __orig_startStream=<function LIGOLWContentHandler.startStream>)¶
- class svd_bank_snr.SignalNoiseRatioDocument(bank_snrs_dict, verbose=False)[source]¶
Bases:
object
LIGO_LW xml document for Signal to Noise Ratio.
This xml document contains the SNRs timeseries and their corresponding templates autocorrelation. Some meta data are recorded in the xml document for
- write_output_url(outdir, row_number=None, counts=1, root_name='gstlal_inspiral_bank_SNRs')[source]¶
Writing the LIGO_LW xmldoc to disk.
- Args:
outdir (str): The output diretory. row_number (int, default=None): The row number of the SNR to be outputed. Default=None is to output all. root_name (str, default=”gstlal_inspiral_bank_SNRs”): The root name of the xml document.
- Return:
xmldoc: The file object representing the xmldoc.
- class svd_bank_snr.SimpleSNRTracker(snr_document, verbose=False)[source]¶
Bases:
SNRTrackerMixin
Simple SNR pipeline handler.
This is the SNR pipeline handler, which only implements the controls for collecting SNR timeseries.
- class svd_bank_snr.Tracker(snr_document, verbose=False)[source]¶
Bases:
SNRTrackerMixin
,LLOIDTracker
Simplified version of lloidhandler.LLOIDTracker.
This is the SNR pipeline handler derived from LLOIDTracker. In addition to the control for collecting SNR timeseries, it implements controls for trigger generator.
- init(stream, coincs_document, rankingstat, horizon_distance_func, gracedbwrapper, zerolag_rankingstatpdf_url=None, rankingstatpdf_url=None, ranking_stat_output_url=None, ranking_stat_input_url=None, likelihood_snapshot_interval=None, sngls_snr_threshold=None, FAR_trialsfactor=1.0, verbose=False)[source]¶
- svd_bank_snr.build_bank(bank_url, psd_file, sample_rate, f_low, f_high=None, autocorrelation_length=None, verbose=False)[source]¶
Return an instance of a Bank class.
- svd_bank_snr.framecache_from_event(gid, observatories, frame_types, time_span=500, outdir='.', filename='frame.cache', verbose=False)[source]¶
Get the frame cache for an event given the gracedb event id.
- Args:
gid (str): The gracedb event id. observatories (list): See gwdatafind. frame_type (list): See gwdatafind. time_span (float): The time span before and after the trigger time. outdir (str, default=”.”): The output directory. filename (str, default=”frame.cache”): The output filename. verbose (bool): Be verbose.
- Returns:
Dictionary of instruments, trigger_times, gps_start_time, gps_end_time, channels_name.
- svd_bank_snr.generate_templates(table, approximant, psd, f_low, time_slice, autocorrelation_length=None, f_high=None, verbose=False)[source]¶
Generate whiten templates from sngl_inspiral_table.
- svd_bank_snr.parse_bank_files(bank_urls, verbose=False)[source]¶
Parse a dictionary of bank urls key by instrument into a dictionary of bank instance key by instrument.
- svd_bank_snr.psd_from_event(gid, outdir='.', save=False, filename='psd.xml.gz', verbose=False)[source]¶
Get the psd.xml.gz given a gracedb event id.
- Args:
gid (str): The gracedb event id. outdir (str, default=”.”): The output directory. filename (str, default=”psd.xml.gz”): The output filename. save (bool, default=False): True if want to save the file, False otherwise. verbose (bool, default=False): Be verbose.
- Returns:
A dictionary of complex LAL Series key by instrument.
- svd_bank_snr.read_url(filename, contenthandler=<class 'svd_bank_snr.SNRContentHandler'>, verbose=False)[source]¶
- svd_bank_snr.scan_svd_banks_for_row(coinc_xmldoc, banks_dict)[source]¶
Scan the sub bank id and row number of an event template from coinc.xml file.
- Args:
coinc_xmldoc (:obj: xmldoc): The coinc.xml file from gracedb. banks_dict (dict): A dictionary of SVD banks key by instrument containing the event template.
- Returns:
bank_number (int) row_number (int)
- svd_bank_snr.svd_banks_from_event(gid, outdir='.', save=False, verbose=False)[source]¶
Find location of the SVD banks from gracedb event id.
- Args:
gid (str): The gracedb event id. outdir (str, default=”.”): The output directory. save (bool, default=False): True if want to save the file, False otherwise. verbose (bool, default=False): Be verbose.
- Returns:
banks_dict (dict of :obj: Bank): The SVD banks for an event key by instrument. bank_number (int) row_number (int)
- svd_bank_snr.write_bank(filename, banks, verbose=False)[source]¶
Write template bank to LIGO_LW xml file.
- svd_bank_snr.write_simplified_sngl_inspiral_table(m1, m2, s1x, s1y, s1z, s2x, s2y, s2z, instrument, approximant, filename=None)[source]¶
Writing a simplified sngl_inspiral_table containing only one template.
- Args:
m1 (float): mass1. m2 (float): mass2. s1x (float): spin 1 x-axis. s1y (float): spin 1 y-axis. s1z (float): spin 1 z-axis. s2x (float): spin 2 x-axis. s2y (float): spin 2 y-axis. s2z (float): spin 2 z-axis. instrument (str): The instrument for the template. approximant (str): The approximant used to simulate the waveform. filename (str, default=None): The output filename.
- Return:
The file object representing the xmldoc.