Package pylal :: Module upper_limit_utils
[hide private]
[frames] | no frames]

Module upper_limit_utils

source code

Functions [hide private]
 
margLikelihoodMonteCarlo(VTs, lambs, mu, mcerrs=None)
This function marginalizes the loudest event likelihood over unknown Monte Carlo errors, assumed to be independent between each experiment.
source code
 
margLikelihood(VTs, lambs, mu, calerr=0, mcerrs=None)
This function marginalizes the loudest event likelihood over unknown Monte Carlo and calibration errors.
source code
 
integral_element(mu, pdf)
Returns an array of elements of the integrand dP = p(mu) dmu for a density p(mu) defined at sample values mu ; samples need not be equally spaced.
source code
 
normalize_pdf(mu, pofmu)
Takes a function pofmu defined at rate sample values mu and normalizes it to be a suitable pdf.
source code
 
compute_upper_limit(mu_in, post, alpha=0.9)
Returns the upper limit mu_high of confidence level alpha for a posterior distribution post on the given parameter mu.
source code
 
compute_lower_limit(mu_in, post, alpha=0.9)
Returns the lower limit mu_low of confidence level alpha for a posterior distribution post on the given parameter mu.
source code
 
confidence_interval_min_width(mu, post, alpha=0.9)
Returns the minimal-width confidence interval [mu_low, mu_high] of confidence level alpha for a posterior distribution post on the parameter mu.
source code
 
hpd_coverage(mu, pdf, thresh)
Integrates a pdf over mu taking only bins where the mean over the bin is above a given threshold This gives the coverage of the HPD interval for the given threshold.
source code
 
hpd_threshold(mu_in, post, alpha, tol)
For a PDF post over samples mu_in, find a density threshold such that the region having higher density has coverage of at least alpha, and less than alpha plus a given tolerance.
source code
 
hpd_credible_interval(mu_in, post, alpha=0.9, tolerance=1e-3)
Returns the minimum and maximum rate values of the HPD (Highest Posterior Density) credible interval for a posterior post defined at the sample values mu_in.
source code
 
integrate_efficiency(dbins, eff, err=0, logbins=False) source code
 
compute_efficiency(f_dist, m_dist, dbins)
Compute the efficiency as a function of distance for the given sets of found and missed injection distances.
source code
 
mean_efficiency_volume(found, missed, dbins) source code
 
volume_montecarlo(found, missed, distribution_param, distribution, limits_param, max_param=None, min_param=None)
Compute the sensitive volume and standard error using a direct Monte Carlo integral
source code
 
filter_injections_by_mass(injs, mbins, bin_num, bin_type, bin_num2=None)
For a given set of injections (sim_inspiral rows), return the subset of injections that fall within the given mass range.
source code
 
compute_volume_vs_mass(found, missed, mass_bins, bin_type, dbins=None, distribution_param=None, distribution=None, limits_param=None, max_param=None, min_param=None)
Compute the average luminosity an experiment was sensitive to given the sets of found and missed injections and assuming luminosity is uniformly distributed in space.
source code
 
log_volume_derivative_fit(x, vols)
Performs a linear least squares to log(vols) as a function of x.
source code
 
get_loudest_event(connection, coinc_table="coinc_inspiral", datatype="exclude_play") source code
Function Details [hide private]

margLikelihood(VTs, lambs, mu, calerr=0, mcerrs=None)

source code 

This function marginalizes the loudest event likelihood over unknown Monte Carlo and calibration errors. The vector VTs is the sensitive volumes for independent searches and lambs is the vector of loudest event likelihood. The statistical errors are assumed to be independent between each experiment while the calibration errors are applied the same in each experiment.

integral_element(mu, pdf)

source code 

Returns an array of elements of the integrand dP = p(mu) dmu for a density p(mu) defined at sample values mu ; samples need not be equally spaced. Uses a simple trapezium rule. Number of dP elements is 1 - (number of mu samples).

normalize_pdf(mu, pofmu)

source code 

Takes a function pofmu defined at rate sample values mu and normalizes it to be a suitable pdf. Both mu and pofmu must be arrays or lists of the same length.

compute_upper_limit(mu_in, post, alpha=0.9)

source code 

Returns the upper limit mu_high of confidence level alpha for a posterior distribution post on the given parameter mu. The posterior need not be normalized.

compute_lower_limit(mu_in, post, alpha=0.9)

source code 

Returns the lower limit mu_low of confidence level alpha for a posterior distribution post on the given parameter mu. The posterior need not be normalized.

hpd_credible_interval(mu_in, post, alpha=0.9, tolerance=1e-3)

source code 

Returns the minimum and maximum rate values of the HPD (Highest Posterior Density) credible interval for a posterior post defined at the sample values mu_in. Samples need not be uniformly spaced and posterior need not be normalized.

Will not return a correct credible interval if the posterior is multimodal and the correct interval is not contiguous; in this case will over-cover by including the whole range from minimum to maximum mu.

compute_efficiency(f_dist, m_dist, dbins)

source code 

Compute the efficiency as a function of distance for the given sets of found and missed injection distances. Note that injections that do not fit into any dbin get lost :(.

volume_montecarlo(found, missed, distribution_param, distribution, limits_param, max_param=None, min_param=None)

source code 

Compute the sensitive volume and standard error using a direct Monte Carlo integral

* distribution_param, D: parameter of the injections used to generate a distribution over distance
  - may be 'distance', 'chirp_distance"
* distribution: form of the distribution over the parameter
  - 'log' (uniform in log D), 'uniform' (uniform in D), 'distancesquared' (uniform in D**2),
    'volume' (uniform in D***3)
  - It is assumed that injections were carried out over a range of D such that sensitive
    volume due to signals at distances < D_min is negligible and efficiency at distances
    > D_max is negligibly small
* limits_param, Dlim: parameter specifying limits in which injections were made
  - may be 'distance', 'chirp_distance'
* max_param: maximum value of Dlim out to which injections were made, if None the maximum 
  value among all found and missed injections will be used
* min_param: minimum value of Dlim at which injections were made - needed to normalize
  the log distance integral correctly.  If None, for the log distribution the minimum
  value among all found and missed injections will be used

compute_volume_vs_mass(found, missed, mass_bins, bin_type, dbins=None, distribution_param=None, distribution=None, limits_param=None, max_param=None, min_param=None)

source code 

Compute the average luminosity an experiment was sensitive to given the sets of found and missed injections and assuming luminosity is uniformly distributed in space.

If distance_param and distance_distribution are not None, use an unbinned Monte Carlo integral (which optionally takes max_distance and min_distance parameters) for the volume and error Otherwise use a simple efficiency * distance**2 binned integral In either case use distance bins to return the efficiency in each bin