cherenkov.rankingstat module

class cherenkov.rankingstat.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>)
class cherenkov.rankingstat.LnNoiseDensity(instruments, delta_t, min_instruments)[source]

Bases: LnLRDensity

finish()[source]

Ensure all internal densities are normalized, and initialize interpolator objects as needed for smooth evaluation. Must be invoked before .__call__() will yield sensible results.

NOTE: for some implementations this operation will irreversibly alter the contents of the counts array, for example often this operation will involve the convolution of the counts with a density estimation kernel. If it is necessary to preserve a pristine copy of the counts data, use the .copy() method to obtain a copy of the data, first, and then .finish() the copy.

classmethod from_xml(xml, name)[source]

In the XML document tree rooted at xml, search for the serialized LnLRDensity object named name, and deserialize it. The return value is the deserialized LnLRDensity object.

increment(event)[source]

Increment the counts defining this density at the given parameters.

random_params(snr_min)[source]

Generator that yields an endless sequence of randomly generated candidate parameters. NOTE: the parameters will be within the domain of the repsective binnings but are not drawn from the PDF stored in those binnings — this is not an MCMC style sampler. Each value in the sequence is a three-element tuple. The first two elements of each tuple provide the *args and **kwargs values for calls to this PDF or the numerator PDF or the ranking statistic object. The final is the natural logarithm (up to an arbitrary constant) of the PDF from which the parameters have been drawn evaluated at the point described by the *args and **kwargs.

The sequence is suitable for input to the .ln_lr_samples() log likelihood ratio generator.

property segmentlists
snr_chisq_binning = (<lal.rate.ATanLogarithmicBins object>, <lal.rate.ATanLogarithmicBins object>)
to_xml(name)[source]

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

Subclasses must chain to this method, then customize the return value as needed.

class cherenkov.rankingstat.LnSignalDensity(instruments, delta_t, min_instruments)[source]

Bases: LnLRDensity

finish()[source]

Ensure all internal densities are normalized, and initialize interpolator objects as needed for smooth evaluation. Must be invoked before .__call__() will yield sensible results.

NOTE: for some implementations this operation will irreversibly alter the contents of the counts array, for example often this operation will involve the convolution of the counts with a density estimation kernel. If it is necessary to preserve a pristine copy of the counts data, use the .copy() method to obtain a copy of the data, first, and then .finish() the copy.

classmethod from_xml(xml, name)[source]

In the XML document tree rooted at xml, search for the serialized LnLRDensity object named name, and deserialize it. The return value is the deserialized LnLRDensity object.

increment(event)[source]

Increment the counts defining this density at the given parameters.

ln_chisq_const = {'H1': -1.9, 'L1': -2.0}
ln_matching = {'H1': -9.5, 'L1': -9.5}
threshold = {'H1': 120.0, 'L1': 100.0}
to_xml(name)[source]

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

Subclasses must chain to this method, then customize the return value as needed.

width = {'H1': 1.0, 'L1': 1.5}
class cherenkov.rankingstat.RankingStat(instruments, delta_t, min_instruments=2)[source]

Bases: LnLikelihoodRatioMixin

property delta_t
finish()[source]
classmethod from_xml(xml, name)[source]
classmethod get_xml_root(xml, name)[source]
property instruments
kwargs_from_triggers(events, offsetvector)[source]
ligo_lw_name_suffix = 'gstlal_cherenkov_rankingstat'
ln_lr_from_triggers(events, offsetvector)[source]
property min_instruments
property segmentlists
to_xml(name)[source]
class cherenkov.rankingstat.RankingStatPDF(rankingstat, nsamples=16777216, nthreads=8, verbose=False)[source]

Bases: object

static binned_log_likelihood_ratio_rates_from_samples_wrapper(queue, noise_lr_lnpdf, ln_lr_samples, nsamples)[source]

For internal use only.

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.

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.

ligo_lw_name_suffix = 'gstlal_cherenkov_rankingstatpdf'
to_xml(name)[source]
cherenkov.rankingstat.binned_log_likelihood_ratio_rates_from_samples(noise_lr_lnpdf, ln_lr_samples, nsamples)[source]
cherenkov.rankingstat.marginalize_rankingstat_urls(urls, 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.