popsynth.distributions package

Submodules

Module contents

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

Bases: SpatialDistribution

__init__(seed: int = 1234, name: str = 'sphere', form: Optional[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: Optional[str] = None, truth: Dict[str, Any] = {}, is_rate: bool = True)[source]

Bases: SpatialDistribution

__init__(seed: int = 1234, name: str = 'cosmo', form: Optional[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.

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

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

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

Bases: CosmologicalDistribution

r0
a
rise
decay
peak
__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

dNdV(z)[source]

The differential number of objects per volume element

Parameters

distance

Returns

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

Bases: CosmologicalDistribution

Lambda
delta
__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

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

Bases: LuminosityDistribution

Lmin
alpha
__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

phi(L)[source]

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

draw_luminosity(size: int = 1)[source]

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

Parameters

size

Returns

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

Bases: LuminosityDistribution

mu
tau
__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

phi(L)[source]

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

draw_luminosity(size=1)[source]

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

Parameters

size

Returns

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

Bases: LuminosityDistribution

mu
tau
__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

phi(L)[source]

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

draw_luminosity(size=1)[source]

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

Parameters

size

Returns

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

Bases: LuminosityDistribution

Lmin
alpha
__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

phi(L)[source]

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

draw_luminosity(size=1)[source]

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

Parameters

size

Returns

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

Bases: LuminosityDistribution

Lmin
alpha
Lbreak
beta
Lmax
__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

phi(L)[source]

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

draw_luminosity(size=1)[source]

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

Parameters

size

Returns

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

Bases: SphericalDistribution

Lambda
__init__(seed: int = 1234, name: str = 'cons_sphere', form: Optional[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: ConstantSphericalDistribution

delta
__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

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

Bases: 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

phi(L)[source]

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

draw_luminosity(size=1)[source]

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

Parameters

size

Returns

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

Bases: SpatialDistribution

Lambda
__init__(seed: int = 1234, name: str = 'flatland', form: Optional[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

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

dNdV(distance)[source]

The differential number of objects per volume element

Parameters

distance

Returns

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

Bases: SphericalDistribution

rho
a
b
R1
R0
__init__(seed: int = 1234, name: str = 'spiral_galaxy', form: Optional[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

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.

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

Bases: LuminosityDistribution

Lmin
Lmax
__init__(seed: int = 1234, name: str = 'logunilum')[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

  • Lmax (DistributionParameter) – Maximum value of the luminosity

phi(L)[source]

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

draw_luminosity(size=1)[source]

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

Parameters

size

Returns

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

Bases: CosmologicalDistribution

r0
zmin
zmax
__init__(seed: int = 1234, name: str = 'uniform_cosmo', is_rate: bool = True)[source]

A cosmological distribution where the density evolves uniformly.

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