svd_bank module

class svd_bank.Bank(bank_xmldoc, psd, time_slices, gate_fap, snr_threshold, tolerance, clipleft=None, clipright=None, flow=40.0, autocorrelation_length=None, logname=None, identity_transform=False, bank_type='signal_model', verbose=False, bank_id=None, fhigh=None)[source]

Bases: object

get_rates()[source]
set_template_bank_filename(name)[source]
class svd_bank.BankFragment(rate, start, end)[source]

Bases: object

set_template_bank(template_bank, tolerance, snr_thresh, identity_transform=False, verbose=False)[source]
class svd_bank.DefaultContentHandler(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>)
svd_bank.build_bank(template_bank_url, psd, flow, max_duration, ortho_gate_fap, snr_threshold, svd_tolerance, clipleft=None, clipright=None, padding=1.5, identity_transform=False, bank_type='signal_model', verbose=False, autocorrelation_length=201, samples_min=1024, samples_max_256=1024, samples_max_64=2048, samples_max=4096, bank_id=None, contenthandler=None, sample_rate=None, instrument_override=None)[source]

! Return an instance of a Bank class.

@param template_bank_url The template bank filename or url containing a subbank of templates to decompose in a single inpsiral table. @param psd A class instance of a psd. @param flow The lower frequency cutoff. @param ortho_gate_fap The FAP threshold for the sum of squares threshold, see http://arxiv.org/abs/1101.0584 @param snr_threshold The SNR threshold for the search @param svd_tolerance The target SNR loss of the SVD, see http://arxiv.org/abs/1005.0012 @param clipleft The number of N poorly reconstructed templates from the left edge of each sub-bank to be removed @param cliptright The number of N poorly reconstructed templates from the right edge of each sub-bank to be removed @param padding The padding from Nyquist for any template time slice, e.g., if a time slice has a Nyquist of 256 Hz and the padding is set to 2, only allow the template frequency to extend to 128 Hz. @param identity_transform Don’t do the SVD, just do time slices and keep the raw waveforms @param bank_type Define the type of the template bank, is it for producing signal candidates (“signal_model”) or for producing noise candidates (“noise_model”) @param verbose Be verbose @param autocorrelation_length The number of autocorrelation samples to use in the chisquared test. Must be odd @param samples_min The minimum number of samples to use in any time slice @param samples_max_256 The maximum number of samples to have in any time slice greater than or equal to 256 Hz @param samples_max_64 The maximum number of samples to have in any time slice greater than or equal to 64 Hz @param samples_max The maximum number of samples in any time slice below 64 Hz @param bank_id The id of the bank in question @param contenthandler The ligolw content handler for file I/O @param max_duration The maximum time duration of waveform to set the lower frequency cutoff

svd_bank.cal_higher_f_low(template_bank_url, bank_xmldoc, flow, max_duration)[source]

This function takes a target low frequency starting point, flow, and a maximum time duration, max_duration, and determines if the flow needs to be increased in order to satisfy the target maximum duration. It also overwrites the template_duration in Single Inspiral Table if the flow is increased.

return the higher value of lower frequency bound between f_low and time_constrained_f_low

@param template_bank_url The template bank filename or url containing a subbank of templates to decompose in a single inpsiral table. @param flow The lower frequency cutoff. @param max_duration The maximum time duration of waveform to set the lower frequency cutoff. @param fhigh The maximum frequency cutoff

svd_bank.calc_lambda_eta_sum(auto_correlation)[source]
svd_bank.check_ffinal_and_find_max_ffinal(xmldoc)[source]
svd_bank.group(inlist, parts)[source]

! group a list roughly according to the distribution in parts, e.g.

>>> A = list(range(12))
>>> B = [2,3]
>>> for g in group(A,B):
...     print(g)
...
[0, 1]
[2, 3]
[4, 5]
[6, 7, 8]
[9, 10, 11]
svd_bank.horizon_distance_func(banks)[source]

Takes a dictionary of objects returned by read_banks keyed by instrument

svd_bank.preferred_horizon_distance_template(banks)[source]
svd_bank.read_approximant(xmldoc, programs=('gstlal_bank_splitter',))[source]
svd_bank.read_banks(filename, contenthandler, verbose=False)[source]

Read SVD banks from a LIGO_LW xml file.

svd_bank.sum_of_squares_threshold_from_fap(fap, coefficients)[source]
svd_bank.svdbank_templates_mapping(filenames, contenthandler, verbose=False)[source]

From a list of the names of files containing SVD bank objects, construct a dictionary mapping filename to list of sngl_inspiral templates in that file. Typically this mapping is inverted through the use of some sort of “template identity” function to map each template to the filename that contains that template.

Example:

Assuming the (mass1, mass2) tuple is known to uniquely identify the templates

>>> def template_id(row):
...     return row.mass1, row.mass2
...
>>> mapping = svdbank_templates_mapping([], DefaultContentHandler)
>>> template_to_filename = dict((template_id(tempate), filename) for filename, templates in mapping.items() for template in templates)
svd_bank.write_bank(filename, banks, psd_input, process_param_dict=None, verbose=False)[source]

Write SVD banks to a LIGO_LW xml file.