One-dimensional Distribution Functions

Class providing probability distribution functions of a single continuous variable—the probability density \(p(x)\), the cumulative distribution function \(P(x) = \int_{-\infty}^x p(x')\,\mathrm{d}x'\), and its inverse \(x(P)\) (the quantile function). These distributions are used throughout Galacticus for drawing random variates (via the inverse CDF method), defining priors over model parameters, and computing likelihoods. Implementations include uniform, Gaussian, log-normal, Poisson, and truncated variants, with a numerical inverse-CDF fallback for arbitrary densities.

Default implementation: distributionFunction1DUniform

Methods

densitydouble precision

Return the probability density function \(p(x)\) evaluated at the given value x, representing the relative likelihood of the random variable taking that value.

  • double precision, intent(in ) :: x

cumulativedouble precision

Return the cumulative distribution function \(P(x) = \int_{-\infty}^x p(x')\,\mathrm{d}x'\), giving the probability that the random variable takes a value less than or equal to x.

  • double precision, intent(in ) :: x

inversedouble precision

Return the value of the independent variable corresponding to cumulative probability p.

  • double precision, intent(in ) :: p

sampledouble precision

Return a random deviate drawn from this probability distribution, using the inverse CDF method by default (drawing a uniform random number and applying the quantile function).

  • class(randomNumberGeneratorClass), intent(inout), optional :: randomNumberGenerator_

minimumdouble precision

Returns the minimum possible value (lower bound) of the support of this distribution, i.e., the smallest value \(x\) for which the probability density is non-zero. Returns \(-\infty\) by default.

maximumdouble precision

Returns the maximum possible value (upper bound) of the support of this distribution, i.e., the largest value \(x\) for which the probability density is non-zero. Returns \(+\infty\) by default.

distributionFunction1DBeta

A 1D beta distribution function class, implementing the beta distribution \(p(x) \propto x^{\alpha-1}(1-x)^{\beta-1}\) with support on \([0,1]\), parameterized by shape parameters \(\alpha > 0\) and \(\beta > 0\).

Parameters

  • [alpha] — The first shape parameter \(\alpha > 0\) of the beta distribution; when \(\alpha > 1\) the density rises towards 1, when \(\alpha < 1\) it diverges towards 0, and when \(\alpha = 1\) it is uniform along that axis.

  • [beta] — The second shape parameter \(\beta > 0\) of the beta distribution; when \(\beta > 1\) the density rises towards 0, when \(\beta < 1\) it diverges towards 1, and when \(\beta = 1\) it is uniform along that axis.

distributionFunction1DCauchy

A Cauchy distribution:

\[P(x) \propto \left[1+{x-x_0\over\gamma}\right]^{-1}.\]

Specified using:

[median]

The median, \(x_0\);

[scale]

The scale, \(\gamma\);

Parameters

  • [median] — The location parameter (median) \(x_0\) of the Cauchy distribution, which determines the peak position of the distribution. Unlike the mean, the median is well-defined for the Cauchy distribution.

  • [scale] — The scale parameter \(\gamma > 0\) of the Cauchy distribution, which controls the width (half-width at half-maximum) of the distribution; larger values give a broader, heavier-tailed distribution.

distributionFunction1DGamma

A 1D gamma distribution function class, implementing the gamma distribution \(p(x) \propto x^{k-1} \mathrm{e}^{-\lambda x}\) with shape parameter \(k\) and rate parameter \(\lambda\), optionally truncated to a finite interval \([x_\mathrm{min}, x_\mathrm{max}]\).

Parameters

  • [shape] — The shape parameter \(k > 0\) of the gamma distribution, controlling the skewness and peakedness; for \(k=1\) it reduces to an exponential distribution, and for large \(k\) it approaches a Gaussian.

  • [rate] — The rate parameter \(\lambda > 0\) of the gamma distribution (the inverse of the scale parameter \(\theta = 1/\lambda\)), which determines the horizontal scale; larger values give a more concentrated distribution near zero.

  • [limitLower] — The lower truncation limit of the gamma distribution; when set, the distribution is renormalized to integrate to unity over \([\mathrm{limitLower}, \mathrm{limitUpper}]\) rather than \([0, \infty)\).

  • [limitUpper] — The upper truncation limit of the gamma distribution; when set, the distribution is renormalized to integrate to unity over \([\mathrm{limitLower}, \mathrm{limitUpper}]\) rather than \([0, \infty)\).

distributionFunction1DLogNormal

A log-normal 1D distribution function class, implementing the distribution \(p(x) \propto x^{-1}\exp(-[\ln x - \ln x_0]^2 / 2\sigma^2)\) parameterized by the median \(x_0\) and logarithmic width \(\sigma\), or equivalently by the mean and variance, optionally truncated to a finite interval.

Parameters

  • [median] (default 0.03687d0) — The median value of the dimensionless Bullock spin parameter \(\lambda\) in the log-normal distribution, representing the typical angular momentum content of dark matter halos at the present day.

  • [sigma] (default 0.5102d0) — The standard deviation \(\sigma\) of \(\ln\lambda\) in the log-normal spin distribution, controlling the spread of spin parameters across the halo population; larger values produce a broader distribution of angular momenta.

  • [mean] — The mean of the log-normal distribution (ignoring any imposed upper and lower limits).

  • [variance] — The variance of the log-normal distribution (ignoring any imposed upper and lower limits).

  • [x0] — The median (geometric mean) \(x_0 > 0\) of the log-normal distribution; the distribution peaks at \(x_0 \exp(-\sigma^2)\) and has median \(x_0\).

  • [sigma] — The logarithmic width (standard deviation of \(\ln x\)) \(\sigma > 0\) of the log-normal distribution; the distribution becomes more skewed and broader as \(\sigma\) increases.

  • [limitLower] — The lower truncation limit \(x_\mathrm{min}\) of the log-normal distribution; when set, the distribution is renormalized over \([x_\mathrm{min}, x_\mathrm{max}]\) rather than \((0, \infty)\).

  • [limitUpper] — The upper truncation limit \(x_\mathrm{max}\) of the log-normal distribution; when set, the distribution is renormalized over \([x_\mathrm{min}, x_\mathrm{max}]\) rather than \((0, \infty)\).

  • [radiusEnvironment] (default 7.0d0) — The radius of the sphere used to determine the variance in the environmental density.

distributionFunction1DLogUniform

A distribution uniform in the logarithm of \(x\) over a finite range

\[\begin{split}P(x) \propto \left\{ \begin{array}{ll} x^{-1} & \hbox{ if } x_\mathrm{l} \leq x \leq x_\mathrm{u} \\ 0 & \hbox{ otherwise.} \end{array} \right.\end{split}\]

Specified using:

[minimum]

The lower limit of the range, \(x_\mathrm{l}\);

[maximum]

The upper limit of the range, \(x_\mathrm{u}\).

Parameters

  • [limitLower] — The lower bound \(x_\mathrm{l} > 0\) of the log-uniform distribution, below which the probability density is zero; must be positive and strictly less than the upper limit.

  • [limitUpper] — The upper bound \(x_\mathrm{u} > 0\) of the log-uniform distribution, above which the probability density is zero; must be positive and strictly greater than the lower limit.

distributionFunction1DNegativeExponential

A 1D negative (or decaying) exponential distribution function class, implementing \(p(x) \propto e^{-\lambda x}\) for \(x \ge 0\), parameterized by the rate \(\lambda > 0\) (the inverse of the mean \(1/\lambda\)).

Parameters

  • [rate] — The rate parameter \(\lambda > 0\) of the negative exponential distribution, equal to the inverse of the mean \(1/\lambda\); larger values give a more steeply decaying distribution concentrated near zero.

distributionFunction1DNonCentralChiDegree3

A non-central \(\chi^2\) distribution with 3 degrees of freedom, parameterized by the non-centrality parameter \(\lambda \ge 0\). The density is evaluated using the modified Bessel function of the first kind \(I_{1/2}\), and the CDF is computed analytically using complementary error functions. When \(\lambda = 0\) the distribution reduces to the central \(\chi^2_3\) distribution. This distribution arises naturally when computing the distribution of the modulus of a 3D vector whose components are independent Gaussians with non-zero means.

Parameters

  • [lambda] — The non-centrality parameter \(\lambda \ge 0\) of the non-central \(\chi^2\) distribution with 3 degrees of freedom, equal to the sum of squares of the non-central normal means; when \(\lambda = 0\) the distribution reduces to a central \(\chi^2_3\).

distributionFunction1DNormal

A normal distribution, optionally with lower and upper limits:

\[\begin{split}P(x) \propto \left\{ \begin{array}{ll} \exp[-(x-\mu)^2/2S] & \hbox{ if } x_\mathrm{l} \leq x \leq x_\mathrm{u} \\ 0 & \hbox{ otherwise.} \end{array} \right.\end{split}\]

Specified using:

[mean]

The mean, \(\mu\);

[variance]

The variance, \(S\);

[minimum]

The lower limit of the range, \(x_\mathrm{l}\);

[maximum]

The upper limit of the range, \(x_\mathrm{u}\).

Methods

  • calculationReset — Reset memoized calculations.

Parameters

  • [rangeLower] — Lower integration limit for the normal distribution weight operator.

  • [rangeUpper] — Upper integration limit for the normal distribution weight operator.

  • [rootVariance] — Root variance for the normal distribution weight operator.

  • [extentLower] (default -huge(0.0d0)) — Lower extent for the normal distribution weight operator.

  • [extentUpper] (default +huge(0.0d0)) — Upper extent for the normal distribution weight operator.

  • [rangeLower] — Lower integration limit for the normal distribution weight operator.

  • [rangeUpper] — Upper integration limit for the normal distribution weight operator.

  • [rootVariance] — Root variance for the normal distribution weight operator.

  • [mean] — The mean \(\mu\) of the normal (Gaussian) distribution, specifying the location of the peak of the probability density function; optionally constrained within \([x_\mathrm{l}, x_\mathrm{u}]\).

  • [variance] — The variance \(S = \sigma^2 > 0\) of the normal distribution, controlling the width of the Gaussian bell curve; the standard deviation is \(\sigma = \sqrt{S}\) and the FWHM is \(2\sqrt{2\ln 2}\,\sigma\).

  • [limitLower] — The lower truncation limit \(x_\mathrm{l}\) of the normal distribution; when set, the distribution is renormalized over \([x_\mathrm{l}, x_\mathrm{u}]\) rather than \((-\infty, +\infty)\).

  • [limitUpper] — The upper truncation limit \(x_\mathrm{u}\) of the normal distribution; when set, the distribution is renormalized over \([x_\mathrm{l}, x_\mathrm{u}]\) rather than \((-\infty, +\infty)\).

  • [massEnvironment] (default 1.0d15) — The mass within the sphere sphere used to determine the variance in the environmental density.

  • [radiusEnvironment] (default 7.0d0) — The radius of the sphere used to determine the variance in the environmental density.

  • [redshift] (default 0.0d0) — The redshift at which the large-scale environmental overdensity is defined; the linear density variance and growth factor are evaluated at the corresponding cosmic time to normalize the Gaussian environmental PDF.

distributionFunction1DPeakBackground

A 1D peak-background split distribution function class that describes the distribution of density fluctuations in the peak-background split formalism, parameterized by the background variance and collapse threshold, used for modeling conditional halo mass functions and large-scale bias.

Parameters

  • [varianceBackground] — The variance \(\sigma_\mathrm{bg}^2\) of the background density field on large scales in the peak-background split formalism, which sets the width of the environmental distribution and controls the large-scale clustering bias.

  • [thresholdCollapse] — The linear overdensity threshold \(\delta_\mathrm{c}\) above which density perturbations collapse to form halos in the peak-background split formalism; sets the minimum background density for halo formation.

distributionFunction1DStudentT

Student’s t-distribution:

\[P(x) \propto \left(1 + {x^2\over \nu}\right)^{-(\nu+1)/2}\]

Specified using:

degreesOfFreedom

The number of degrees of freedom, \(\nu\).

Methods

  • cumulativeUpper — The upper-tail cumulative distribution function.

  • inverseUpper — The upper-tail inverse cumulative distribution function.

Parameters

  • [degreesOfFreedom] — The degrees of freedom of the Student-t distribution function.

distributionFunction1DUniform

A uniform distribution over a finite range

\[\begin{split}P(x) \propto \left\{ \begin{array}{ll} 1 & \hbox{ if } x_\mathrm{l} \leq x \leq x_\mathrm{u} \\ 0 & \hbox{ otherwise.} \end{array} \right.\end{split}\]

Specified using:

[minimum]

The lower limit of the range, \(x_\mathrm{l}\);

[maximum]

The upper limit of the range, \(x_\mathrm{u}\).

(Default implementation)

Parameters

  • [massTreeMinimum] (default 1.0d10) — The minimum mass of merger tree base halos to consider when sampled masses from a distribution, in units of \(M_\odot\).

  • [massTreeMaximum] (default 1.0d15) — The maximum mass of merger tree base halos to consider when sampled masses from a distribution, in units of \(M_\odot\).

  • [treesPerDecade] (default 10.0d0) — The number of merger trees masses to sample per decade of base halo mass.

  • [limitLower] — The lower bound \(x_\mathrm{l}\) of the uniform distribution, below which the probability density is zero; the distribution has constant density \(1/(x_\mathrm{u} - x_\mathrm{l})\) over \([x_\mathrm{l}, x_\mathrm{u}]\).

  • [limitUpper] — The upper bound \(x_\mathrm{u}\) of the uniform distribution, above which the probability density is zero; the distribution has constant density \(1/(x_\mathrm{u} - x_\mathrm{l})\) over \([x_\mathrm{l}, x_\mathrm{u}]\).

distributionFunction1DVoight

A 1D distribution function class for Voigt profiles, which are convolutions of a Lorentzian (Cauchy) distribution with a Gaussian distribution, parameterized by the Lorentzian half-width \(\gamma\), location \(\mu\), and Gaussian width \(\sigma\), optionally truncated to a finite interval.

Parameters

  • [gamma] — The Lorentzian half-width at half-maximum \(\gamma > 0\) of the Voigt profile, controlling the width of the Cauchy (Lorentzian) component; larger values give broader, heavier tails.

  • [mu] — The location parameter \(\mu\) of the Voigt profile, specifying the center (peak position) of the combined Lorentzian-Gaussian distribution.

  • [sigma] — The Gaussian standard deviation \(\sigma > 0\) of the Voigt profile, controlling the width of the Gaussian component; the overall profile width is determined by the combination of \(\gamma\) and \(\sigma\).

  • [limitLower] (default -huge(0.0d0)) — The lower truncation limit of the Voigt distribution; when specified, the distribution is renormalized over the restricted interval \([\mathrm{limitLower}, \mathrm{limitUpper}]\).

  • [limitUpper] (default +huge(0.0d0)) — The upper truncation limit of the Voigt distribution; when specified, the distribution is renormalized over the restricted interval \([\mathrm{limitLower}, \mathrm{limitUpper}]\).