Population#
- dace_query.population.population.Population: PopulationClass = <dace_query.population.population.PopulationClass object>#
This is a singleton instance of the
PopulationClassclass.To use it, simply import it :
from dace_query.population import Population
- class dace_query.population.population.PopulationClass(dace_instance=None)#
Bases:
objectThe population class. Use to retrieve data from the population module.
Tip
A population instance is already provided, to use it:
from dace_query.population import Population
- get_columns(population_id, output_format=None)#
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()#
Use to get all snapshot ages.
- Returns:
All existing ages
- Return type:
list[str]
Getting all snapshot ages
from dace_query.population import Population ages = Population.get_snapshot_ages()
- get_snapshots(population_id, years, columns=None, output_format=None)#
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
Getting the snapshots for a specific population at a specific age
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, system_id, planet_id, columns=None, output_format=None)#
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
- Return type:
Union[dict[str,ndarray],DataFrame,Table,dict]- Returns:
dict[str, ndarray] or DataFrame or Table or dict
Getting the tracks for a specific population, system and planet
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=10000, filters=None, sort=None, output_format=None)#
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
Getting all population data
from dace_query.population import Population values = Population.query_database()