bilby.core.prior.analytical.FermiDirac

class bilby.core.prior.analytical.FermiDirac(sigma, mu=None, r=None, name=None, latex_label=None, unit=None)[source]

Bases: Prior

__init__(sigma, mu=None, r=None, name=None, latex_label=None, unit=None)[source]

A Fermi-Dirac type prior, with a fixed lower boundary at zero (see, e.g. Section 2.3.5 of [1]). The probability distribution is defined by Equation 22 of [1].

Parameters:
sigma: float (required)

The range over which the attenuation of the distribution happens

mu: float

The point at which the distribution falls to 50% of its maximum value

r: float

A value giving mu/sigma. This can be used instead of specifying mu.

name: str

See superclass

latex_label: str

See superclass

unit: str

See superclass

References

[1] (1,2,3)

M. Pitkin, M. Isi, J. Veitch & G. Woan, arXiv:1705.08978v1, 2017.

__call__()[source]

Overrides the __call__ special method. Calls the sample method.

Returns:
float: The return value of the sample method.

Methods

__init__(sigma[, mu, r, name, latex_label, unit])

A Fermi-Dirac type prior, with a fixed lower boundary at zero (see, e.g. Section 2.3.5 of [1]).

cdf(val)

Generic method to calculate CDF, can be overwritten in subclass

from_json(dct)

from_repr(string)

Generate the prior from its __repr__

get_instantiation_dict()

is_in_prior_range(val)

Returns True if val is in the prior boundaries, zero otherwise

ln_prob(val)

Return the log prior probability of val.

prob(val)

Return the prior probability of val.

rescale(val)

'Rescale' a sample from the unit line element to the appropriate Fermi-Dirac prior.

sample([size])

Draw a sample from the prior

to_json()

Attributes

boundary

is_fixed

Returns True if the prior is fixed and should not be used in the sampler.

latex_label

Latex label that can be used for plots.

latex_label_with_unit

If a unit is specified, returns a string of the latex label and unit

maximum

minimum

unit

width

cdf(val)[source]

Generic method to calculate CDF, can be overwritten in subclass

classmethod from_repr(string)[source]

Generate the prior from its __repr__

property is_fixed

Returns True if the prior is fixed and should not be used in the sampler. Does this by checking if this instance is an instance of DeltaFunction.

Returns:
bool: Whether it’s fixed or not!
is_in_prior_range(val)[source]

Returns True if val is in the prior boundaries, zero otherwise

Parameters:
val: Union[float, int, array_like]
Returns:
np.nan
property latex_label

Latex label that can be used for plots.

Draws from a set of default labels if no label is given

Returns:
str: A latex representation for this prior
property latex_label_with_unit

If a unit is specified, returns a string of the latex label and unit

ln_prob(val)[source]

Return the log prior probability of val.

Parameters:
val: Union[float, int, array_like]
Returns:
Union[float, array_like]: Log prior probability of val
prob(val)[source]

Return the prior probability of val.

Parameters:
val: Union[float, int, array_like]
Returns:
float: Prior probability of val
rescale(val)[source]

‘Rescale’ a sample from the unit line element to the appropriate Fermi-Dirac prior.

Parameters:
val: Union[float, int, array_like]
This maps to the inverse CDF. This has been analytically solved for this case,
see Equation 24 of [Re282ecdc1327-1]_.

References

[1]

M. Pitkin, M. Isi, J. Veitch & G. Woan, arXiv:1705.08978v1, 2017.

sample(size=None)[source]

Draw a sample from the prior

Parameters:
size: int or tuple of ints, optional

See numpy.random.uniform docs

Returns:
float: A random number between 0 and 1, rescaled to match the distribution of this Prior