LALInference  4.1.6.1-89842e6
lalinference.bayespputils.PosteriorOneDPDF Class Reference

Detailed Description

A data structure representing one parameter in a chain of posterior samples.

The Posterior class generates instances of this class for pivoting onto a given parameter (the Posterior class is per-Sampler oriented whereas this class represents the same one parameter in successive samples in the chain).

Definition at line 670 of file bayespputils.py.

Inherits object.

Public Member Functions

def __init__ (self, name, posterior_samples, injected_value=None, injFref=None, trigger_values=None, prior=None)
 Create an instance of PosteriorOneDPDF based on a table of posterior_samples. More...
 
def __len__ (self)
 Container method. More...
 
def __getitem__ (self, idx)
 Container method . More...
 
def name (self)
 Return the string literal name of the parameter. More...
 
def mean (self)
 Return the arithmetic mean for the marginal PDF on the parameter. More...
 
def median (self)
 Return the median value for the marginal PDF on the parameter. More...
 
def stdev (self)
 Return the standard deviation of the marginal PDF on the parameter. More...
 
def stacc (self)
 Return the 'standard accuracy statistic' (stacc) of the marginal posterior of the parameter. More...
 
def injval (self)
 Return the injected value set at construction . More...
 
def trigvals (self)
 Return the trigger values set at construction. More...
 
def set_injval (self, new_injval)
 Set the injected/real value of the parameter. More...
 
def set_trigvals (self, new_trigvals)
 Set the trigger values of the parameter. More...
 
def samples (self)
 Return a 1D numpy.array of the samples. More...
 
def delete_samples_by_idx (self, samples)
 Remove samples from posterior, analagous to numpy.delete but opperates in place. More...
 
def gaussian_kde (self)
 Return a SciPy gaussian_kde (representing a Gaussian KDE) of the samples. More...
 
def KL (self)
 Returns the KL divergence between the prior and the posterior. More...
 
def prob_interval (self, intervals)
 Evaluate probability intervals. More...
 

Constructor & Destructor Documentation

◆ __init__()

def lalinference.bayespputils.PosteriorOneDPDF.__init__ (   self,
  name,
  posterior_samples,
  injected_value = None,
  injFref = None,
  trigger_values = None,
  prior = None 
)

Create an instance of PosteriorOneDPDF based on a table of posterior_samples.

Parameters
nameA literal string name for the parameter.
posterior_samplesA 1D array of the samples.
injected_valueThe injected or real value of the parameter.
injFrefreference frequency for injection
trigger_valuesThe trigger values of the parameter (dictionary w/ IFOs as keys).
priorThe prior value corresponding to each sample.

Definition at line 681 of file bayespputils.py.

Member Function Documentation

◆ __len__()

def lalinference.bayespputils.PosteriorOneDPDF.__len__ (   self)

Container method.

Defined as number of samples.

Definition at line 695 of file bayespputils.py.

◆ __getitem__()

def lalinference.bayespputils.PosteriorOneDPDF.__getitem__ (   self,
  idx 
)

Container method .

Returns posterior containing sample idx (allows slicing).

Definition at line 701 of file bayespputils.py.

◆ name()

def lalinference.bayespputils.PosteriorOneDPDF.name (   self)

Return the string literal name of the parameter.

Definition at line 709 of file bayespputils.py.

◆ mean()

def lalinference.bayespputils.PosteriorOneDPDF.mean (   self)

Return the arithmetic mean for the marginal PDF on the parameter.

Definition at line 717 of file bayespputils.py.

◆ median()

def lalinference.bayespputils.PosteriorOneDPDF.median (   self)

Return the median value for the marginal PDF on the parameter.

Definition at line 725 of file bayespputils.py.

◆ stdev()

def lalinference.bayespputils.PosteriorOneDPDF.stdev (   self)

Return the standard deviation of the marginal PDF on the parameter.

Definition at line 733 of file bayespputils.py.

◆ stacc()

def lalinference.bayespputils.PosteriorOneDPDF.stacc (   self)

Return the 'standard accuracy statistic' (stacc) of the marginal posterior of the parameter.

stacc is a standard deviant incorporating information about the accuracy of the waveform recovery. Defined as the mean of the sum of the squared differences between the points in the PDF (x_i - sampled according to the posterior) and the true value ( \(x_{true}\)). So for a marginalized one-dimensional PDF: \(stacc = \sqrt{\frac{1}{N}\sum_{i=1}^N (x_i-x_{\rm true})2}\)

Definition at line 756 of file bayespputils.py.

◆ injval()

def lalinference.bayespputils.PosteriorOneDPDF.injval (   self)

Return the injected value set at construction .

If no value was set will return None .

Definition at line 768 of file bayespputils.py.

◆ trigvals()

def lalinference.bayespputils.PosteriorOneDPDF.trigvals (   self)

Return the trigger values set at construction.

If no value was set will return None .

Definition at line 777 of file bayespputils.py.

◆ set_injval()

def lalinference.bayespputils.PosteriorOneDPDF.set_injval (   self,
  new_injval 
)

Set the injected/real value of the parameter.

Parameters
new_injvalThe injected/real value to set.

Definition at line 786 of file bayespputils.py.

◆ set_trigvals()

def lalinference.bayespputils.PosteriorOneDPDF.set_trigvals (   self,
  new_trigvals 
)

Set the trigger values of the parameter.

Parameters
new_trigvalsDictionary containing trigger values with IFO keys.

Definition at line 795 of file bayespputils.py.

◆ samples()

def lalinference.bayespputils.PosteriorOneDPDF.samples (   self)

Return a 1D numpy.array of the samples.

Definition at line 804 of file bayespputils.py.

◆ delete_samples_by_idx()

def lalinference.bayespputils.PosteriorOneDPDF.delete_samples_by_idx (   self,
  samples 
)

Remove samples from posterior, analagous to numpy.delete but opperates in place.

Parameters
samplesA list containing the indexes of the samples to be removed.

Definition at line 812 of file bayespputils.py.

◆ gaussian_kde()

def lalinference.bayespputils.PosteriorOneDPDF.gaussian_kde (   self)

Return a SciPy gaussian_kde (representing a Gaussian KDE) of the samples.

Definition at line 820 of file bayespputils.py.

◆ KL()

def lalinference.bayespputils.PosteriorOneDPDF.KL (   self)

Returns the KL divergence between the prior and the posterior.

It measures the relative information content in nats. The prior is evaluated at run time. It defaults to None. If None is passed, it just returns the information content of the posterior."

Definition at line 842 of file bayespputils.py.

◆ prob_interval()

def lalinference.bayespputils.PosteriorOneDPDF.prob_interval (   self,
  intervals 
)

Evaluate probability intervals.

Parameters
intervalsA list of the probability intervals [0-1]

Definition at line 875 of file bayespputils.py.