dace_query.population package

Submodules

dace_query.population.population module

dace_query.population.population.Population: PopulationClass = <dace_query.population.population.PopulationClass object>

Population instance

class dace_query.population.population.PopulationClass(dace_instance: DaceClass | None = None)

Bases: object

The population class. Use to retrieve data from the population module.

A population instance is already provided, to use it:

>>> from dace_query.population import Population
SIMULATIONS_DEFAULT_COLUMN = ['total_mass', 'semi_major_axis']

Simulation parameters retrieved by default

SNAPSHOTS_DEFAULT_COLUMN = ['system_id', 'planet_id', 'total_mass', 'semi_major_axis']

Snapshot parameters retrieved by default

get_columns(population_id: str, output_format: str | None = None) dict[str, ndarray] | DataFrame | Table | dict

Get the available columns for the specified population.

All available formats are defined in this section (see Output formats).

Parameters:
  • population_id (str) – The population id

  • output_format (str) – Type of data returns

Returns:

The desired data in the chosen output format

Return type:

dict[str, ndarray] or DataFrame or Table or dict

>>> from dace_query.population import Population
>>> population_to_search = 'ng96'
>>> values = Population.get_columns('ng96')
static get_snapshot_ages() list[str]

Use to get all snapshot ages.

Returns:

All existing ages

Return type:

list[str]

>>> from dace_query.population import Population
>>> ages = Population.get_snapshot_ages()
get_snapshots(population_id: str, years: str, columns: list[str] | None = None, output_format: str | None = None) dict[str, ndarray] | DataFrame | Table | dict

Get snapshots data for a specific population at a specific age.

All available formats are defined in this section (see Output formats).

Parameters:
  • population_id (str) – The population id to get snapshots from

  • years (str) – The specific age of the snapshot

  • columns (Optional[list[str]]) – A list of parameters to retrieve

  • output_format (Optional[str]) – Type of data returns

Returns:

The desired data in chosen output format

Return type:

dict[str, ndarray] or DataFrame or Table or dict

>>> from dace_query.population import Population
>>> population_id = 'ng96'
>>> years = '5000000'
>>> columns_to_retrieve = ['system_id', 'planet_id', 'total_mass']
>>> values = Population.get_snapshots(population_id=population_id, years=years, columns=columns_to_retrieve)
get_track(population_id: str, system_id: int, planet_id: int, columns: list[str] | None = None, output_format: str | None = None) dict[str, ndarray] | DataFrame | Table | dict

Retrieve tracks for a specific population, system id and planet id.

All available formats are defined in this section (see Output formats).

Parameters:
  • population_id (str) – The population id to retrieve tracks from

  • system_id (int) – The system id

  • planet_id (int) – The planet id

  • columns (Optional[list[str]]) – The parameters to retrieve

  • output_format (Optional[str]) – Type of data returns

Returns:

dict[str, ndarray] or DataFrame or Table or dict

>>> from dace_query.population import Population
>>> pop_id, planet_id, system_id = 'ng96', 1, 1
>>> parameters_to_retrieve = ['time_yr', 'total_mass']
>>> values = Population.get_track(population_id=pop_id, system_id=system_id, planet_id=planet_id, columns=parameters_to_retrieve)
query_database(limit: int | None = 10000, filters: dict | None = None, sort: dict | None = None, output_format: str | None = None) dict[str, ndarray] | DataFrame | Table | dict

Query the population database to retrieve data (population descriptions) in the chosen format.

Filters and sorting order can be applied to the query via named arguments (see Filtering and sorting).

All available formats are defined in this section (see Output formats).

Parameters:
  • limit (Optional[int]) – Maximum number of rows to return

  • filters (Optional[dict]) – Filters to apply to the query

  • sort (Optional[dict]) – Sort order to apply to the query

  • output_format (Optional[str]) – Type of data returns

Returns:

The desired data in the chosen output format

Return type:

dict[str, ndarray] or DataFrame or Table or dict

>>> from dace_query.population import Population
>>> values = Population.query_database()

Module contents