popsynth.selection_probability package

Submodules

popsynth.selection_probability.flux_selectors module

class popsynth.selection_probability.flux_selectors.HardFluxSelection[source]

Bases: LowerBound

__init__() None[source]

A hard selection on the observed flux.

Based on LowerBound.

draw(size: int)[source]
class popsynth.selection_probability.flux_selectors.SoftFluxSelection[source]

Bases: SoftSelection

__init__() None[source]

A soft selection on the observed flux.

Based on SoftSelection.

draw(size: int)[source]

popsynth.selection_probability.generic_selectors module

class popsynth.selection_probability.generic_selectors.UnitySelection(name='unity')[source]

Bases: SelectionProbability

__init__(name='unity')[source]

A selection that returns all selected.

Parameters

name – Name of the selection

draw(size: int) None[source]
class popsynth.selection_probability.generic_selectors.BernoulliSelection[source]

Bases: SelectionProbability

probability
__init__() None[source]

A Bernoulli selection with probability as a parameter.

Parameters

probability (SelectionParameter) – Probability for each Bernoulli trial

draw(size: int) None[source]
class popsynth.selection_probability.generic_selectors.BoxSelection(name: str = 'box selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: SelectionProbability

vmin
vmax
__init__(name: str = 'box selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

A box selection on observed_value, distance, luminosity or flux.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

  • vmin (SelectionParameter) – Minimum value of selection

  • vmax (SelectionParameter) – Maximum value of selection

draw(size: int) ndarray[source]
class popsynth.selection_probability.generic_selectors.LowerBound(name: str = 'Hard selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: SelectionProbability

boundary
__init__(name: str = 'Hard selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

A hard, lower bound selection on obs_value, distance, luminosity or flux.

Selects values >= boundary.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

  • boundary (SelectionParameter) – Value of the selection boundary

draw(size: int) None[source]
class popsynth.selection_probability.generic_selectors.UpperBound(name: str = 'Hard selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: SelectionProbability

boundary
__init__(name: str = 'Hard selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

A hard, upper bound selection on obs_value, distance, luminosity or flux.

Selects values <= boundary.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

  • boundary (SelectionParameter) – Value of the selection boundary

draw(size: int) None[source]
class popsynth.selection_probability.generic_selectors.SoftSelection(name: str = 'Soft Selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: SelectionProbability

boundary
strength
__init__(name: str = 'Soft Selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False) None[source]

A soft selection using an inverse logit function either on the log or linear value of the observed_value, distance, luminosity or flux.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

  • boundary (SelectionParameter) – Center of the inverse logit

  • strength (SelectionParameter) – Width of the logit

draw(size: int, use_log=True) None[source]

popsynth.selection_probability.selection_probability module

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

Bases: Parameter

class popsynth.selection_probability.selection_probability.SelectionProbability(name: str = 'name', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: object

__init__(name: str = 'name', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False) None[source]

Base class for selections on a population.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

set_luminosity(luminosity: ndarray) None[source]

Set the luminosity of the selection.

set_distance(distance: ndarray) None[source]

Set the distance of the selection.

set_observed_flux(observed_flux: ndarray) None[source]

Set the observed flux of the selection.

set_observed_value(observed_value: ndarray) None[source]

Set the observed value of the selection.

abstract classmethod draw(size: int) None[source]
reset()[source]

Reset the selector.

select(size: int)[source]
property parameters: Dict[str, float]
property selection: ndarray
property n_selected: int
property n_non_selected: int
property n_objects: int
property selection_index: ndarray
property non_selection_index: ndarray
property name: str
class popsynth.selection_probability.selection_probability.DummySelection[source]

Bases: SelectionProbability

__init__()[source]

A Dummy selection for testing.

draw(size=1)[source]

popsynth.selection_probability.spatial_selection module

class popsynth.selection_probability.spatial_selection.SpatialSelection(name: str)[source]

Bases: SelectionProbability

__init__(name: str) None[source]

A generic spatial selection.

Parameters

name (str) – Name of the selection

set_spatial_distribution(spatial_distribtuion: SpatialDistribution) None[source]

Set the spatial distribution for the selection.

Parameters

spatial_distribution (SpatialDistribution) – The spatial_distribution

class popsynth.selection_probability.spatial_selection.GalacticPlaneSelection(name: str = 'galactic plane selector')[source]

Bases: SpatialSelection

b_limit
__init__(name: str = 'galactic plane selector')[source]

A selection that excludes objects near the galactic plane.

Parameters
  • name (str) – Name of the selection

  • b_limit (SelectionParameter) – Limit around Galactic plane to exclude in Galactic latitude and in units of degrees

draw(size: int)[source]

Module contents

class popsynth.selection_probability.HardFluxSelection[source]

Bases: LowerBound

__init__() None[source]

A hard selection on the observed flux.

Based on LowerBound.

draw(size: int)[source]
class popsynth.selection_probability.SoftFluxSelection[source]

Bases: SoftSelection

__init__() None[source]

A soft selection on the observed flux.

Based on SoftSelection.

draw(size: int)[source]
class popsynth.selection_probability.BernoulliSelection[source]

Bases: SelectionProbability

probability
__init__() None[source]

A Bernoulli selection with probability as a parameter.

Parameters

probability (SelectionParameter) – Probability for each Bernoulli trial

draw(size: int) None[source]
class popsynth.selection_probability.LowerBound(name: str = 'Hard selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: SelectionProbability

boundary
__init__(name: str = 'Hard selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

A hard, lower bound selection on obs_value, distance, luminosity or flux.

Selects values >= boundary.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

  • boundary (SelectionParameter) – Value of the selection boundary

draw(size: int) None[source]
class popsynth.selection_probability.UpperBound(name: str = 'Hard selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: SelectionProbability

boundary
__init__(name: str = 'Hard selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

A hard, upper bound selection on obs_value, distance, luminosity or flux.

Selects values <= boundary.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

  • boundary (SelectionParameter) – Value of the selection boundary

draw(size: int) None[source]
class popsynth.selection_probability.SoftSelection(name: str = 'Soft Selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: SelectionProbability

boundary
strength
__init__(name: str = 'Soft Selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False) None[source]

A soft selection using an inverse logit function either on the log or linear value of the observed_value, distance, luminosity or flux.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

  • boundary (SelectionParameter) – Center of the inverse logit

  • strength (SelectionParameter) – Width of the logit

draw(size: int, use_log=True) None[source]
class popsynth.selection_probability.UnitySelection(name='unity')[source]

Bases: SelectionProbability

__init__(name='unity')[source]

A selection that returns all selected.

Parameters

name – Name of the selection

draw(size: int) None[source]
class popsynth.selection_probability.SelectionProbability(name: str = 'name', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: object

__init__(name: str = 'name', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False) None[source]

Base class for selections on a population.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

set_luminosity(luminosity: ndarray) None[source]

Set the luminosity of the selection.

set_distance(distance: ndarray) None[source]

Set the distance of the selection.

set_observed_flux(observed_flux: ndarray) None[source]

Set the observed flux of the selection.

set_observed_value(observed_value: ndarray) None[source]

Set the observed value of the selection.

abstract classmethod draw(size: int) None[source]
reset()[source]

Reset the selector.

select(size: int)[source]
property parameters: Dict[str, float]
property selection: ndarray
property n_selected: int
property n_non_selected: int
property n_objects: int
property selection_index: ndarray
property non_selection_index: ndarray
property name: str
class popsynth.selection_probability.SpatialSelection(name: str)[source]

Bases: SelectionProbability

__init__(name: str) None[source]

A generic spatial selection.

Parameters

name (str) – Name of the selection

set_spatial_distribution(spatial_distribtuion: SpatialDistribution) None[source]

Set the spatial distribution for the selection.

Parameters

spatial_distribution (SpatialDistribution) – The spatial_distribution

class popsynth.selection_probability.BoxSelection(name: str = 'box selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

Bases: SelectionProbability

vmin
vmax
__init__(name: str = 'box selection', use_obs_value: bool = False, use_distance: bool = False, use_luminosity: bool = False, use_flux: bool = False)[source]

A box selection on observed_value, distance, luminosity or flux.

Parameters
  • name (str) – Name of the selection

  • use_obs_value (bool) – If True, make selection on observed_value. False by default.

  • use_distance (bool) – If True make selection on distance. False by default.

  • use_luminosity (bool) – If True make selection on luminosity. False by default.

  • use_flux (bool) – If True make selection on flux. False by default.

  • vmin (SelectionParameter) – Minimum value of selection

  • vmax (SelectionParameter) – Maximum value of selection

draw(size: int) ndarray[source]
class popsynth.selection_probability.DummySelection[source]

Bases: SelectionProbability

__init__()[source]

A Dummy selection for testing.

draw(size=1)[source]
class popsynth.selection_probability.SelectionParameter(default: Optional[float] = None, vmin: Optional[float] = None, vmax: Optional[float] = None, free: bool = True, is_normalization: bool = False)[source]

Bases: Parameter

class popsynth.selection_probability.GalacticPlaneSelection(name: str = 'galactic plane selector')[source]

Bases: SpatialSelection

b_limit
__init__(name: str = 'galactic plane selector')[source]

A selection that excludes objects near the galactic plane.

Parameters
  • name (str) – Name of the selection

  • b_limit (SelectionParameter) – Limit around Galactic plane to exclude in Galactic latitude and in units of degrees

draw(size: int)[source]
class popsynth.selection_probability.DistanceSelection(name: str = 'distance')[source]

Bases: SpatialSelection

min_distance
max_distance
__init__(name: str = 'distance')[source]

Select distances

Parameters
  • name (str) – Name of the selection

  • min_distance – minimum distance to select

  • max_distance – maximum distance to select

draw(size: int)[source]