popsynth.distribution module

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
display()[source]

use ipython pretty display to display the functions

Returns:
form

The latex form of the distribution

Returns:
name

The name of the distribution

Returns:
params

The parameters of the distribution

truth

value of the parameters used to simulate

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

Bases: popsynth.utils.meta.Parameter

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

Bases: popsynth.distribution.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
draw_luminosity(size)[source]

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

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

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

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

Bases: object

Container for 3D spatial values.

__init__(distance: Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]], theta: Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]], phi: Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype][numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]]) → None
dec
ra
class popsynth.distribution.SpatialDistribution(name: str, seed: int, form: Optional[str] = None)[source]

Bases: popsynth.distribution.Distribution

__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
dNdV(distance)[source]

The differential number of objects per volume element

Parameters:distance
Returns:
dec

The declination of the objects

Returns:
differential_volume(distance)[source]

The differential volume

Parameters:distance – Distance
distances

the distances to the objects

Returns:
draw_distance(size: int) → None[source]

Draw the distances from the specified dN/dr model.

Parameters:size (int) – Number of distances to sample
draw_sky_positions(size: int) → None[source]

Draw teh sky positions of the objects

Parameters:size (int) –
Returns:
phi

the longitudinal coordinate fo the objects

Returns:
r_max
ra

the right acension of the objects

Returns:
spatial_values

All the spatial values of the objects :returns:

theta

the polar coordinate of the objects

Returns:
time_adjustment(distance)[source]

The time adjustment

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

The transform from luminosity to flux for the

Parameters:
  • flux
  • distance
Returns: