popsynth.distributions.bpl_distribution module

class popsynth.distributions.bpl_distribution.BPLDistribution(seed: int = 1234, name: str = 'bpl')[source]

Bases: popsynth.distribution.LuminosityDistribution

Lbreak
Lmax
Lmin
__init__(seed: int = 1234, name: str = 'bpl')[source]

A broken power law luminosity distribution.

L ~ L^``alpha`` for L <= Lbreak L ~ L^``beta`` for L > Lbreak

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • Lmin (DistributionParameter) – Minimum value of the luminosity
  • alpha (DistributionParameter) – Index of the lower power law
  • Lbreak (DistributionParameter) – Luminosity of the power law break
  • beta (DistributionParameter) – Index of the upper power law
  • Lmax (DistributionParameter) – Maximum value of the luminosity
alpha
beta
draw_luminosity(size=1)[source]

function to draw the luminosity via an alternative method must be implemented in child class

Parameters:size
Returns:
phi(L)[source]

The functional form of the distribution. not required for sampling :param luminosity: Luminosity

popsynth.distributions.bpl_distribution.bpl(x, x0, x1, x2, a1, a2)[source]

Broken power law between bounds.

Parameters:
  • x – The domain of the function
  • x0 – Lower bound
  • x1 – Break point
  • x2 – Upper bound
  • a1 – Lower power law index
  • a2 – Upper power low index
popsynth.distributions.bpl_distribution.integrate_pl(x0, x1, x2, a1, a2)[source]

Integrate a broken power law between bounds.

Parameters:
  • x0 – Lower bound
  • x1 – Break point
  • x2 – Upper bound
  • a1 – Lower power law index
  • a2 – Upper power low index
popsynth.distributions.bpl_distribution.sample_bpl(u, x0, x1, x2, a1, a2)[source]

Sample from a broken power law between bounds.

Parameters:
  • u – Uniform random number on {0,1}
  • x0 – Lower bound
  • x1 – Break point
  • x2 – Upper bound
  • a1 – Lower power law index
  • a2 – Upper power low index