far module

class far.DatalessRankingStat(*args, **kwargs)[source]

Bases: RankingStat

finish()[source]
is_healthy(verbose=False)[source]
class far.FAPFAR(rankingstatpdf)[source]

Bases: object

assign_fapfars(connection)[source]
ccdf_from_rank(**kwargs)
fap_from_rank(rank)[source]
far_from_rank(rank)[source]
rank_from_fap(p, tolerance=1e-06)[source]

Inverts .fap_from_rank(). This function is sensitive to numerical noise for probabilities that are close to 1. The tolerance sets the absolute error of the result.

rank_from_far(rate, tolerance=1e-06)[source]

Inverts .far_from_rank() using a bisection search. The tolerance sets the absolute error of the result.

class far.OnlineFrankensteinRankingStat(src, donor)[source]

Bases: RankingStat

Version of RankingStat with horizon distance history and trigger rate history spliced in from another instance. Used to solve a chicken-or-egg problem and assign ranking statistic values in an aonline anlysis. NOTE: the donor data is not copied, instances of this class hold references to the donor’s data, so as it is modified those modifications are immediately reflected here.

copy()[source]
finish()[source]
class far.RankingStat(template_ids=None, instruments=frozenset({'H1', 'L1', 'V1'}), population_model_file=None, dtdphi_file=None, min_instruments=1, delta_t=0.005, horizon_factors=None, idq_file=None)[source]

Bases: LnLikelihoodRatioMixin

class LIGOLWContentHandler(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>)
copy()[source]
property delta_t
property dtdphi_file
fast_path_cut(snrs, chi2s_over_snr2s, **kwargs)[source]

Return True if the candidate described by kwargs should be cut, False otherwise. Used to fast-path out of the full likelihood evaluation, and to drop coincs from the coincidence engine to reduce data rate.

NOTE: surviving this cut is not an endorsement of the candidate, many candidates that survive this cut will subsequently be discarded for other reasons. This code is only intended to achieve a computationally efficient data rate reduction that does not negatively impact the search sensitivity.

fast_path_cut_from_triggers(events, offsetvector)[source]

Evaluate the ranking statistic’s fast-path cut for a sequence of single-detector triggers constituting a coincident candidate collected with the given offset vector.

finish()[source]
classmethod from_xml(xml, name, convert=False)[source]

In the XML document tree rooted at xml, search for the serialized RankingStat object named name, and deserialize it. The return value is a two-element tuple. The first element is the deserialized RankingStat object, the second is the process ID recorded when it was written to XML.

classmethod get_xml_root(xml, name)[source]

Sub-classes can use this in their overrides of the .from_xml() method to find the root element of the XML serialization.

property horizon_factors
property idq_file
property instruments
is_healthy(verbose=False)[source]
kwargs_from_triggers(events, offsetvector)[source]

Constructs the key-word arguments to be passed to .__call__() from a sequence of single-detector triggers constituting a coincident candidate collected with the given offset vector. For internal use by the *_from_triggers() methods.

ligo_lw_name_suffix = 'gstlal_inspiral_rankingstat'
ln_lr_from_triggers(events, offsetvector)[source]

Evaluate the ranking statistic for a sequence of single-detector triggers constituting a coincident candidate collected with the given offset vector.

property min_instruments
network_snrsq_threshold = 49.0
property population_model_file
property segmentlists
property snr_min
property template_ids
to_xml(name)[source]

Serialize this RankingStat object to an XML fragment and return the root element of the resulting XML tree.

class far.RankingStatPDF(rankingstat, signal_noise_pdfs=None, nsamples=16777216, nthreads=8, verbose=False)[source]

Bases: object

static binned_log_likelihood_ratio_rates_from_samples_wrapper(queue, signal_lr_lnpdf, noise_lr_lnpdf, samples, nsamples)[source]

For internal use only.

collect_zero_lag_rates(connection, coinc_def_id)[source]
copy()[source]
static density_estimate(lnpdf, name, kernel=array([3.84729931e-23, 5.0389677e-21, 5.13988679e-19, 4.08311782e-17, 2.52613554e-15, 1.21716027e-13, 4.5673602e-12, 1.33477831e-10, 3.03794142e-09, 5.38488002e-08, 7.43359757e-07, 7.99187055e-06, 6.69151129e-05, 0.000436341348, 0.00221592421, 0.00876415025, 0.0269954833, 0.0647587978, 0.120985362, 0.176032663, 0.19947114, 0.176032663, 0.120985362, 0.0647587978, 0.0269954833, 0.00876415025, 0.00221592421, 0.000436341348, 6.69151129e-05, 7.99187055e-06, 7.43359757e-07, 5.38488002e-08, 3.03794142e-09, 1.33477831e-10, 4.5673602e-12, 1.21716027e-13, 2.52613554e-15, 4.08311782e-17, 5.13988679e-19, 5.0389677e-21, 3.84729931e-23]))[source]

For internal use only.

density_estimate_zero_lag_rates()[source]
classmethod from_xml(xml, name)[source]
classmethod get_xml_root(xml, name)[source]

Sub-classes can use this in their overrides of the .from_xml() method to find the root element of the XML serialization.

is_healthy(verbose=False)[source]
ligo_lw_name_suffix = 'gstlal_inspiral_rankingstatpdf'
new_with_extinction()[source]
to_xml(name)[source]
far.binned_log_likelihood_ratio_rates_from_samples(signal_lr_lnpdf, noise_lr_lnpdf, samples, nsamples)[source]

Populate signal and noise BinnedLnPDF densities from a sequence of samples (which can be a generator). The first nsamples elements from the sequence are used. The samples must be a sequence of three-element tuples (or sequences) in which the first element is a value of the ranking statistic (likelihood ratio) and the second and third elements the logs of the probabilities of obtaining that value of the ranking statistic in the signal and noise populations respectively.

far.gen_likelihood_control_doc(xmldoc, rankingstat, rankingstatpdf)[source]
far.kwarggen(segments, snrs, chi2s_over_snr2s, phase, dt, template_id, min_instruments)[source]
far.kwarggeniter(d, min_instruments)[source]
far.marginalize_pdf_urls(urls, which, ignore_missing_files=False, verbose=False)[source]

Implements marginalization of PDFs in ranking statistic data files. The marginalization is over the degree of freedom represented by the file collection. One or both of the candidate parameter PDFs and ranking statistic PDFs can be processed, with errors thrown if one or more files is missing the required component.

far.parse_likelihood_control_doc(xmldoc, convert=False)[source]