popsynth.distributions package

Module contents

class popsynth.distributions.SphericalDistribution(seed: int = 1234, name: str = 'sphere', form: str = None)[source]

Bases: popsynth.distribution.SpatialDistribution

__init__(seed: int = 1234, name: str = 'sphere', form: str = None)[source]

A generic spherical distribution. Can be inherited to form more complex spherical distributions

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • form (str) – Mathematical description of distribution
differential_volume(r)[source]

The differential volume

Parameters:distance – Distance
transform(L, r)[source]

The transform from luminosity to flux for the

Parameters:
  • flux
  • distance
Returns:

class popsynth.distributions.CosmologicalDistribution(seed: int = 1234, name: str = 'cosmo', form: str = None, truth: Dict[str, Any] = {}, is_rate: bool = True)[source]

Bases: popsynth.distribution.SpatialDistribution

__init__(seed: int = 1234, name: str = 'cosmo', form: str = None, truth: Dict[str, Any] = {}, is_rate: bool = True)[source]

Base class for cosmological spatial distributions.

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • form (str) – Mathematical description of distribution
  • truth (dict[str, Any]) – True values of parameters
  • is_rate (bool) – True if modelling a population of transient events, False if modelling a population of steady-state objects. Affects the time_adjustment method used in cosmo calculations. Default is True.
differential_volume(z)[source]

Differential comoving volume in Gpc^3 sr^-1.

dV/dzdOmega

Parameters:z – Redshift
Returns:The differential comoving volume in Gpc^-3 sr^-1.
time_adjustment(z)[source]

Time adjustment factor to handle both transient and steady-state populations.

Parameters:z – Redshift
Returns:Appropriate factor depending on is_rate
transform(L, z)[source]

Transformation from luminosity to energy flux.

L / 4 pi dL^2

dL is in cm. Therefore for L in erg s^-1 returns flux in erg cm^-2 s^-1.

Parameters:
  • L – Luminosity
  • z – Redshift
Returns:

Flux

class popsynth.distributions.SFRDistribution(seed: int = 1234, name: str = 'sfr', is_rate: bool = True)[source]

Bases: popsynth.distributions.cosmological_distribution.CosmologicalDistribution

__init__(seed: int = 1234, name: str = 'sfr', is_rate: bool = True)[source]

A star-formation like distribution of the form presented in Cole et al. 2001.

r0``(``a``+``rise``z)/(1 + (z/``peak)^``decay``)

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • is_rate (bool) – True if modelling a population of transient events, False if modelling a population of steady-state objects. Affects the time_adjustment method used in cosmo calculations. Default is True.
  • r0 (DistributionParameter) – The local density in units of Gpc^-3
  • a (DistributionParameter) – Offset at z=0
  • rise (DistributionParameter) – Rise at low z
  • decay (DistributionParameter) – Decay at high z
  • peak (DistributionParameter) – Peak of z distribution
a
dNdV(z)[source]

The differential number of objects per volume element

Parameters:distance
Returns:
decay
peak
r0
rise
class popsynth.distributions.ZPowerCosmoDistribution(seed: int = 1234, name: str = 'zpow_cosmo', is_rate: bool = True)[source]

Bases: popsynth.distributions.cosmological_distribution.CosmologicalDistribution

Lambda
__init__(seed: int = 1234, name: str = 'zpow_cosmo', is_rate: bool = True)[source]

A cosmological distribution where the density evolves as a power law.

Lambda (1+z)^``delta``

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • is_rate (bool) – True if modelling a population of transient events, False if modelling a population of steady-state objects. Affects the time_adjustment method used in cosmo calculations. Default is True.
  • Lambda (DistributionParameter) – The local density in units of Gpc^-3
  • delta (DistributionParameter) – The index of the power law
dNdV(distance)[source]

The differential number of objects per volume element

Parameters:distance
Returns:
delta
class popsynth.distributions.ParetoDistribution(seed: int = 1234, name: str = 'pareto')[source]

Bases: popsynth.distribution.LuminosityDistribution

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

A Pareto luminosity function.

alpha``*``Lmin``^``alpha / L^(``alpha``+1)

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • Lmin (DistributionParameter) – Minimum value of the luminosity
  • alpha (DistributionParameter) – Index of the pareto distribution
alpha
draw_luminosity(size: int = 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

class popsynth.distributions.Log10NormalDistribution(seed: int = 1234, name: str = 'log10norm')[source]

Bases: popsynth.distribution.LuminosityDistribution

__init__(seed: int = 1234, name: str = 'log10norm')[source]

A log10-normal luminosity function

Log10Normal(mu, tau)

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • mu (DistributionParameter) – Mean of the log10 normal
  • tau (DistributionParameter) – Standard deviation of the log10 normal
draw_luminosity(size=1)[source]

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

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

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

tau
class popsynth.distributions.LogNormalDistribution(seed: int = 1234, name: str = 'lognorm')[source]

Bases: popsynth.distribution.LuminosityDistribution

__init__(seed: int = 1234, name: str = 'lognorm')[source]

A log-normal luminosity distribution.

LogNormal(mu, tau)

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • mu (DistributionParameter) – Mean of the log normal
  • tau (DistributionParameter) – Standard deviation of the log normal
draw_luminosity(size=1)[source]

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

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

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

tau
class popsynth.distributions.SchechterDistribution(seed: int = 1234, name: str = 'schechter')[source]

Bases: popsynth.distribution.LuminosityDistribution

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

A Schechter luminosity function as in Schechter, Astrophysical Journal, Vol. 203, p. 297-306 (1976).

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • Lmin (DistributionParameter) – Minimum value of the luminosity
  • alpha (DistributionParameter) – Index of the distribution
alpha
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

class popsynth.distributions.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

class popsynth.distributions.SphericalDistribution(seed: int = 1234, name: str = 'sphere', form: str = None)[source]

Bases: popsynth.distribution.SpatialDistribution

__init__(seed: int = 1234, name: str = 'sphere', form: str = None)[source]

A generic spherical distribution. Can be inherited to form more complex spherical distributions

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • form (str) – Mathematical description of distribution
differential_volume(r)[source]

The differential volume

Parameters:distance – Distance
transform(L, r)[source]

The transform from luminosity to flux for the

Parameters:
  • flux
  • distance
Returns:

class popsynth.distributions.ConstantSphericalDistribution(seed: int = 1234, name: str = 'cons_sphere', form: str = None)[source]

Bases: popsynth.distributions.spherical_distribution.SphericalDistribution

Lambda
__init__(seed: int = 1234, name: str = 'cons_sphere', form: str = None)[source]

A spherical distribution with constant density.

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • form (str) – Mathematical description of distribution
  • Lambda (DistributionParameter) – Density per unit volume
dNdV(distance)[source]

The differential number of objects per volume element

Parameters:distance
Returns:
class popsynth.distributions.ZPowerSphericalDistribution(seed: int = 1234, name: str = 'zpow_sphere')[source]

Bases: popsynth.distributions.spherical_distribution.ConstantSphericalDistribution

__init__(seed: int = 1234, name: str = 'zpow_sphere')[source]

A spherical distribution with a power law density profile.

Lambda (1+r)^``delta``

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • form (str) – Mathematical description of distribution
  • delta (DistributionParameter) – Index of power law distribution
dNdV(distance)[source]

The differential number of objects per volume element

Parameters:distance
Returns:
delta
class popsynth.distributions.DeltaDistribution(seed: int = 1234, name: str = 'delta')[source]

Bases: popsynth.distribution.LuminosityDistribution

Lp
__init__(seed: int = 1234, name: str = 'delta')[source]

A delta function luminosity distribution, centred on Lp.

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • Lp (DistributionParameter) – The central value
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

class popsynth.distributions.FlatlandDistribution(seed: int = 1234, name: str = 'flatland', form: str = None)[source]

Bases: popsynth.distribution.SpatialDistribution

Lambda
__init__(seed: int = 1234, name: str = 'flatland', form: str = None)[source]

A flat spatial distribution with only length.

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • form (str) – Mathematical description of distribution
  • Lambda (DistributionParameter) – Length
dNdV(distance)[source]

The differential number of objects per volume element

Parameters:distance
Returns:
differential_volume(r)[source]

The differential volume

Parameters:distance – Distance
transform(L, r)[source]

The transform from luminosity to flux for the

Parameters:
  • flux
  • distance
Returns:

class popsynth.distributions.SpiralGalaxyDistribution(seed: int = 1234, name: str = 'spiral_galaxy', form: str = None)[source]

Bases: popsynth.distributions.spherical_distribution.SphericalDistribution

R0
R1
__init__(seed: int = 1234, name: str = 'spiral_galaxy', form: str = None)[source]

A spiral galaxy spatial distribution.

Parameters:
  • seed (int) – Random seed
  • name (str) – Name of the distribution
  • form (str) – Mathematical description of distribution
  • rho (DistributionParameter) – Local density
  • a (DistributionParameter) – Shape parameter
  • b (DistributionParameter) – Shape parameter
  • R1 (DistributionParameter) – Scale parameter
  • R0 (DistributionParameter) – Scale parameter
a
b
dNdV(r)[source]

The differential number of objects per volume element

Parameters:distance
Returns:
draw_sky_positions(size)[source]

Based on Wainscoat 1992 and Faucher-Giguere 2007.

Code thanks to Mortiz Pleintinger.

rho