popsynth.distribution module

class popsynth.distribution.DistributionParameter(default: Optional[float] = None, vmin: Optional[float] = None, vmax: Optional[float] = None, free: bool = True, is_normalization: bool = False)[source]

Bases: Parameter

class popsynth.distribution.Distribution(name: str, seed: int, form: str)[source]

Bases: object

__init__(name: str, seed: int, form: str) None[source]

A distribution base class.

Parameters
  • name (str) – Name of the distribution

  • seed (int) – Random seed

  • form (str) – the LaTeX form

property normalization_parameter: Optional[float]
property name: str

The name of the distribution

Returns

property form: str

The latex form of the distribution

Returns

property params: Dict[str, float]

The parameters of the distribution

property truth: Dict[str, float]

value of the parameters used to simulate

property probability: ndarray
display()[source]

use ipython pretty display to display the functions

Returns

class popsynth.distribution.SpatialContainer(distance: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], theta: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], phi: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]])[source]

Bases: object

Container for 3D spatial values.

distance: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]
theta: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]
phi: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]
property dec: ndarray
property ra: ndarray
__init__(distance: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], theta: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], phi: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) None
class popsynth.distribution.SpatialDistribution(name: str, seed: int, form: Optional[str] = None)[source]

Bases: Distribution

r_max
__init__(name: str, seed: int, form: Optional[str] = None)[source]

A base class for spatial distributions, such as redshift distributions.

Parameters
  • name (str) – Name of the distribution

  • seed (int) – Random seed

  • form (Union[str, None]) – the LaTeX form

abstract differential_volume(distance)[source]

The differential volume

Parameters

distance – Distance

abstract dNdV(distance)[source]

The differential number of objects per volume element

Parameters

distance

Returns

time_adjustment(distance)[source]

The time adjustment

Parameters

distance – Distance

abstract transform(flux, distance)[source]

The transform from luminosity to flux for the

Parameters
  • flux

  • distance

Returns

property theta: ndarray

the polar coordinate of the objects

Returns

property phi: ndarray

the longitudinal coordinate fo the objects

Returns

property dec: ndarray

The declination of the objects

Returns

property ra: ndarray

the right acension of the objects

Returns

property distances: ndarray

the distances to the objects

Returns

property spatial_values

All the spatial values of the objects :returns:

draw_sky_positions(size: int) None[source]

Draw the sky positions of the objects

Parameters

size (int) –

Returns

draw_distance(size: int, normalize: bool = False) None[source]

Draw the distances from the specified dN/dr model.

Parameters

size (int) – Number of distances to sample

class popsynth.distribution.LuminosityDistribution(name: str, seed: int, form: Optional[str] = None)[source]

Bases: Distribution

__init__(name: str, seed: int, form: Optional[str] = None)[source]

A base class for luminosity distributions.

Parameters
  • name (str) – Name of the distribution

  • seed (int) – Random seed

  • form (Union[str, None]) – the LaTeX form

abstract phi(luminosity)[source]

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

abstract draw_luminosity(size: int) ndarray[source]

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

Parameters

size

Returns

compute_probability(L: ndarray) None[source]