astromodels.functions.priors module

class astromodels.functions.priors.Cauchy(**kwargs)[source]

Bases: Function1D

description :

The Cauchy distribution

latex : $ K frac{1}{ gamma pi} left[ frac{gamma^2}{(x-x_0)^2 + gamma^2} right] $

parameters :

K :

desc : Integral between -inf and +inf. Fix this to 1 to obtain a Cauchy distribution initial value : 1

x0 :

desc : Central value initial value : 0.0

gamma :

desc : standard deviation initial value : 1.0 min : 1e-12

tests :
  • { x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}

  • { x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}

evaluate(x, K, x0, gamma)[source]
from_unit_cube(x)[source]

Used by multinest

Parameters
  • x – 0 < x < 1

  • lower_bound

  • upper_bound

Returns

static info()
class astromodels.functions.priors.Cosine_Prior(**kwargs)[source]

Bases: Function1D

description :

A function which is constant on the interval angular interval of cosine

latex : $cos(x)$

parameters :

lower_bound :

desc : Lower bound for the interval initial value : -90 min : -np.inf max : np.inf

upper_bound :

desc : Upper bound for the interval initial value : 90 min : -np.inf max : np.inf

value :

desc : Value in the interval initial value : 1.0

evaluate(x, lower_bound, upper_bound, value)[source]
from_unit_cube(x)[source]

Used by multinest

Parameters
  • x – 0 < x < 1

  • lower_bound

  • upper_bound

Returns

has_fixed_units()[source]

Returns True if this function cannot change units, which is the case only for very specific functions (like models from foreign libraries like Xspec)

Returns

True or False

static info()
class astromodels.functions.priors.Gaussian(**kwargs)[source]

Bases: Function1D

description :

A Gaussian function

latex : $ K frac{1}{sigma sqrt{2 pi}}exp{frac{(x-mu)^2}{2~(sigma)^2}} $

parameters :

F :

desc : Integral between -inf and +inf. Fix this to 1 to obtain a Normal distribution initial value : 1

mu :

desc : Central value initial value : 0.0

sigma :

desc : standard deviation initial value : 1.0 min : 1e-12

tests :
  • { x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}

  • { x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}

evaluate(x, F, mu, sigma)[source]
from_unit_cube(x)[source]

Used by multinest

Parameters
  • x – 0 < x < 1

  • lower_bound

  • upper_bound

Returns

static info()
class astromodels.functions.priors.Log_normal(**kwargs)[source]

Bases: Function1D

description :

A log normal function

latex : $ K frac{1}{ x sigma sqrt{2 pi}}exp{frac{(log x/piv - mu/piv)^2}{2~(sigma)^2}} $

parameters :

F :

desc : Integral between 0and +inf. Fix this to 1 to obtain a log Normal distribution initial value : 1

mu :

desc : Central value initial value : 0.0

sigma :

desc : standard deviation initial value : 1.0 min : 1e-12

piv :

desc : pivot. Leave this to 1 for a proper log normal distribution initial value : 1.0 fix : yes

tests :
  • { x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}

  • { x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}

evaluate(x, F, mu, sigma, piv)[source]
from_unit_cube(x)[source]

Used by multinest

Parameters
  • x – 0 < x < 1

  • lower_bound

  • upper_bound

Returns

static info()
class astromodels.functions.priors.Log_uniform_prior(**kwargs)[source]

Bases: Function1D

description :

A function which is K/x on the interval lower_bound - upper_bound and 0 outside the interval. The extremes of the interval are NOT counted as part of the interval. Lower_bound must be >= 0.

latex : $ f(x)=K~begin{cases}0 & x le text{lower_bound} \frac{1}{x} & text{lower_bound} < x < text{upper_bound} \ 0 & x ge text{upper_bound} end{cases}$

parameters :

lower_bound :

desc : Lower bound for the interval initial value : 1e-20 min : 1e-30 max : np.inf

upper_bound :

desc : Upper bound for the interval initial value : 100 min : 1e-30 max : np.inf

K :

desc : Normalization initial value : 1 fix : yes

evaluate(x, lower_bound, upper_bound, K)[source]
from_unit_cube(x)[source]

Used by multinest

Parameters
  • x – 0 < x < 1

  • lower_bound

  • upper_bound

Returns

static info()
class astromodels.functions.priors.Truncated_gaussian(**kwargs)[source]

Bases: Function1D

description :

A truncated Gaussian function defined on the interval between the lower_bound (a) and upper_bound (b)

latex : $begin{split}f(x;mu,sigma,a,b)=frac{frac{1}{sigma} phileft( frac{x-mu}{sigma} right)}{Phileft( frac{b-mu}{sigma} right) - Phileft( frac{a-mu}{sigma} right)}\phileft(zright)=frac{1}{sqrt{2 pi}}expleft(-frac{1}{2}z^2right)\Phileft(zright)=frac{1}{2}left(1+erfleft(frac{z}{sqrt(2)}right)right)end{split}$

parameters :

F :

desc : Integral between -inf and +inf. Fix this to 1 to obtain a Normal distribution initial value : 1

mu :

desc : Central value initial value : 0.0

sigma :

desc : standard deviation initial value : 1.0 min : 1e-12

lower_bound :

desc: lower bound of gaussian, setting to -np.inf results in half normal distribution initial value : -1.

upper_bound :

desc: upper bound of gaussian setting to np.inf results in half normal distribution initial value : 1.

tests :
  • { x : 0.0, function value: 0.3989422804014327, tolerance: 1e-10}

  • { x : -1.0, function value: 0.24197072451914337, tolerance: 1e-9}

evaluate(x, F, mu, sigma, lower_bound, upper_bound)[source]
from_unit_cube(x)[source]
static info()
class astromodels.functions.priors.Uniform_prior(**kwargs)[source]

Bases: Function1D

description :

A function which is constant on the interval lower_bound - upper_bound and 0 outside the interval. The extremes of the interval are counted as part of the interval.

latex : $ f(x)=begin{cases}0 & x < text{lower_bound} \text{value} & text{lower_bound} le x le text{upper_bound} \ 0 & x > text{upper_bound} end{cases}$

parameters :

lower_bound :

desc : Lower bound for the interval initial value : 0 min : -np.inf max : np.inf

upper_bound :

desc : Upper bound for the interval initial value : 1 min : -np.inf max : np.inf

value :

desc : Value in the interval initial value : 1.0

tests :
  • { x : 0.5, function value: 1.0, tolerance: 1e-20}

  • { x : -0.5, function value: 0, tolerance: 1e-20}

evaluate(x, lower_bound, upper_bound, value)[source]
from_unit_cube(x)[source]

Used by multinest

Parameters
  • x – 0 < x < 1

  • lower_bound

  • upper_bound

Returns

static info()