stats.inspiral_lr module

class stats.inspiral_lr.DatalessLnNoiseDensity(*args, **kwargs)[source]

Bases: LnNoiseDensity

Stripped-down version of LnNoiseDensity for use in estimating ranking statistics when no data has been collected from an instrument with which to define the ranking statistic.

Used, for example, to implement low-significance candidate culls, etc.

Assumes all available instruments are on and have the same horizon distance, and assess candidates based only on SNR and chi^2 distributions.

DEFAULT_FILENAME = '/usr/share/gstlal/inspiral_datalesslndensity.xml.gz'
class LIGOLWContentHandler(document, start_handlers={})[source]

Bases: LIGOLWContentHandler

startArray(parent, attrs)
startParam(parent, attrs)
startStream(parent, attrs, __orig_startStream=<function LIGOLWContentHandler.startStream>)
copy()[source]

Return a duplicate copy of this object.

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(*args, **kwargs)[source]

Increment the counts defining this density at the given parameters.

random_params()[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.

See also:

random_sim_params()

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

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 stats.inspiral_lr.DatalessLnSignalDensity(*args, **kwargs)[source]

Bases: LnSignalDensity

Stripped-down version of LnSignalDensity for use in estimating ranking statistics when no data has been collected from an instrument with which to define the ranking statistic.

Used, for example, to implement low-significance candidate culls, etc.

Assumes all available instruments are on and have the same horizon distance, and assess candidates based only on SNR and chi^2 distributions.

copy()[source]

Return a duplicate copy of this object.

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(*args, **kwargs)[source]

Increment the counts defining this density at the given parameters.

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 stats.inspiral_lr.LnNoiseDensity(*args, **kwargs)[source]

Bases: LnLRDensity

add_noise_model(number_of_events=1)[source]
candidate_count_model()[source]

Compute and return a prediction for the total number of noise candidates expected for each instrument combination.

copy()[source]

Return a duplicate copy of this object.

classmethod from_xml(xml, name, convert=False)[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.

mkinterps()[source]
random_params()[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.

See also:

random_sim_params()

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

property segmentlists
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 stats.inspiral_lr.LnSignalDensity(*args, **kwargs)[source]

Bases: LnLRDensity

add_signal_model(prefactors_range=(0.001, 0.3), df=100, inv_snr_pow=4.0, verbose=False)[source]
add_signal_model_analytic(lambda_sum, lambdasq_sum, lambda_etasq_sum, lambdasq_etasq_sum, mismatch_range=(0.001, 0.3), verbose=False)[source]
candidate_count_model(rate=1000.0)[source]

Compute and return a prediction for the total number of above-threshold signal candidates expected. The rate parameter sets the nominal signal rate in units of Gpc^-3 a^-1.

copy()[source]

Return a duplicate copy of this object.

classmethod from_xml(xml, name, convert=False)[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(*args, **kwargs)[source]

Increment the counts defining this density at the given parameters.

local_mean_horizon_distance(segs, template_id=None)[source]

Compute the volume-weighted mean horizon distance for each of the detectors within its respective time interval. segs is a dictionary mapping instrument–>GPS segment. If template_id is None then the calculation is for the canonical template for this template bank bin, otherwise it is for the given template.

random_sim_params(sim, template_id=None, snr_efficiency=1.0, f_low=15.0)[source]

Generator that yields an endless sequence of randomly generated parameter dictionaries drawn from the distribution of parameters expected for the given injection, which is an instance of a SimInspiral table row object (see ligo.lw.lsctables.SimInspiral for more information). Each value in the sequence is a tuple, the first element of which is the random parameter dictionary and the second is 0.

See also:

LnNoiseDensity.random_params()

The parameters do not necessarily represent valid candidates, for example the number of detectors reporting a trigger might be less than the .min_instruments parameter configured for the ranking statistic. It is the job of the calling code to check the parameters for validity before using them to compute ranking statistic values. This is done to allow the calling code to measure the frequency with which the injection is expected to be undetectable. Otherwise, the sequence is suitable for input to the .ln_lr_samples() log likelihood ratio generator.

Bugs:

The second element in each tuple in the sequence is merely a placeholder, not the natural logarithm of the PDF from which the sample has been drawn, as in the case of random_params(). Therefore, when used in combination with .ln_lr_samples(), the two probability densities computed and returned by that generator along with each log likelihood ratio value will simply be the probability densities of the signal and noise populations at that point in parameter space. They cannot be used to form an importance weighted sampler of the log likelihood ratios.

set_horizon_factors(horizon_factors)[source]
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 stats.inspiral_lr.OnlineFrankensteinLnNoiseDensity(*args, **kwargs)[source]

Bases: LnNoiseDensity

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

increment(*args, **kwargs)[source]

Increment the counts defining this density at the given parameters.

classmethod splice(src, rates_donor)[source]
class stats.inspiral_lr.OnlineFrankensteinLnSignalDensity(*args, **kwargs)[source]

Bases: LnSignalDensity

Version of LnSignalDensity with horizon distance 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 horizon history is not copied from the donor, instances of this class hold a reference to the donor’s data, so as it is modified those modifications are immediately reflected here.

increment(*args, **kwargs)[source]

Increment the counts defining this density at the given parameters.

classmethod splice(src, Dh_donor)[source]