threeML.utils.statistics.likelihood_functions module

threeML.utils.statistics.likelihood_functions.half_chi2(y, yerr, expectation)[source]
threeML.utils.statistics.likelihood_functions.poisson_log_likelihood_ideal_bkg(observed_counts, expected_bkg_counts, expected_model_counts)[source]

Poisson log-likelihood for the case where the background has no uncertainties:

L = sum_{i=0}^{N}~o_i~log{(m_i + b_i)} - (m_i + b_i) - log{o_i!}

Parameters:
  • observed_counts

  • expected_bkg_counts

  • expected_model_counts

Returns:

(log_like vector, background vector)

threeML.utils.statistics.likelihood_functions.poisson_observed_gaussian_background(observed_counts, background_counts, background_error, expected_model_counts)[source]
threeML.utils.statistics.likelihood_functions.poisson_observed_poisson_background(observed_counts, background_counts, exposure_ratio, expected_model_counts)[source]
threeML.utils.statistics.likelihood_functions.poisson_observed_poisson_background_xs(observed_counts, background_counts, exposure_ratio, expected_model_counts)[source]

Profile log-likelihood for the case when the observed counts are Poisson distributed, and the background counts are Poisson distributed as well (typical for X-ray analysis with aperture photometry). This has been derived by Keith Arnaud (see the Xspec manual, Wstat statistic)

threeML.utils.statistics.likelihood_functions.regularized_log(vector)[source]

A function which is log(vector) where vector > 0, and zero otherwise.

Parameters:

vector

Returns:

threeML.utils.statistics.likelihood_functions.xlogy(x, y)[source]

A function which is 0 if x is 0, and x * log(y) otherwise. This is to fix the fact that for a machine 0 * log(inf) is nan, instead of 0.

Parameters:
  • x

  • y

Returns:

threeML.utils.statistics.likelihood_functions.xlogy_one(x, y)[source]

A function which is 0 if x is 0, and x * log(y) otherwise. This is to fix the fact that for a machine 0 * log(inf) is nan, instead of 0.

Parameters:
  • x

  • y

Returns: