ananke.Ananke module#

Contains the Ananke class definition

Please note that this module is private. The Ananke class is available in the main ananke namespace - use that instead.

class ananke.Ananke.Ananke(particles: Dict[str, ndarray[Any, dtype[_ScalarType_co]]], name: str, ngb: int = 64, caching: bool = False, append_hash: bool | None = None, k_params: Dict[str, Any] = {}, e_params: Dict[str, Any] = {}, err_params: Dict[str, Any] = {}, il_params: Dict[str, Any] = {}, **kwargs: Dict[str, Any])[source]#

Bases: object

Represents a single ananke pipeline.

__init__(particles: Dict[str, ndarray[Any, dtype[_ScalarType_co]]], name: str, ngb: int = 64, caching: bool = False, append_hash: bool | None = None, k_params: Dict[str, Any] = {}, e_params: Dict[str, Any] = {}, err_params: Dict[str, Any] = {}, il_params: Dict[str, Any] = {}, **kwargs: Dict[str, Any]) None[source]#
Parameters:
  • particles (dict) – A dictionary of same-length arrays representing particles data of a stellar population - see notes for formatting

  • name (str) – Name for the pipeline

  • ngb (int) – Number of neighbours to use in kernel density estimation

  • caching (bool) – EXPERIMENTAL: activate caching mode at every steps to resume work where it was left at from a previous python instance if needed. Default to True.

  • append_hash (bool) – TODO

  • k_params (dict) – Parameters to configure the kernel sizes estimation. Use class method display_kernel_docs to find what parameters can be defined

  • e_params (dict) – Parameters to configure the extinction pipeline. Use class method display_extinction_docs to find what parameters can be defined

  • err_params (dict) – Parameters to configure the error model pipeline. Use class method display_errormodel_docs to find what parameters can be defined

  • il_params (dict) – Parameters to configure the integrated light pipeline. Use class method display_integratedlight_docs to find what parameters can be defined

  • observer (array-like shape (3,) or dict of array-like shape (3,)) – Coordinates for the observer in phase space. Position and velocity quantities must respectively be given in kpc and km/s. To only specify position, an array-like object of shape (3,) is enough. If specifying both position and velocity, please provide a dictionary containing both coordinates as array-like objects of shape (3,), respectively denoting the position and velocity coordinates with keys pos3 and vel3. Position coordinates default to:

    [-8.12197337e+00 -1.47294445e-11  2.08000000e-02]
    

    and velocity coordinates default to:

    [ 12.9  245.6    7.78]
    
  • rshell (array-like shape (2,)) – Range in kpc of distances from the observer position of the particles that are to be considered. Default to:

    [  0 500]
    
  • photo_sys (string or list) – Name(s) of the photometric system(s) Galaxia should use to generate the survey. Default to ['padova/GAIA__DR2']. Available photometric systems can be queried with the class method display_available_photometric_systems.

  • cmd_magnames (string or dict) – Names of the filters Galaxia should use for the color-magnitude diagram box selection. The input can be given as string in which case it must meet the following format:

    "band1,band2-band3"
    

    where band1 is the magnitude filter and (band2, band3) are the filters that define the band2-band3 color index. Alternatively, a dictionary can be passed with the following format:

    dict('magnitude': band1,
         'color_minuend': band2,
         'color_subtrahend': band3)
    

    The filter names must correspond to filters that are part of the first chosen photometric system in photo_sys. Default to 'G,Gbp-Grp'.

  • fsample (float) – Sampling rate from 0 to 1 for the resulting synthetic star survey. 1 returns a full sample while any value under returns partial surveys. Default to 1.

  • app_mag_lim_lo, app_mag_lim_hi, abs_mag_lim_lo, abs_mag_lim_hi, color_lim_lo, color_lim_hi (float) – These allow to specify the limits of the chosen color-magnitude diagram box selection (lo for lower and hi for upper). app_mag, abs_mag and color represent respectively limits in apparent magnitudes, absolute magnitudes and color index. Default values follow those set in the dictionary:

    {'abs_mag': [-1000, 20],
     'app_mag': [-1000, 1000],
     'color': [-1000, 1000]}
    

Notes

The input particles must include same-length arrays for every key of the list of keys return by property required_particles_keys. Particular attention should be given to arrays of keys 'pos3' and 'vel3' that must be shaped as (Nx3) arrays of, respectively, position and velocity vectors. Use the class method make_dummy_particles_input to generate a dummy example of such input dictionary.

run(caching: bool | None = None, append_hash: bool | None = None, no_post_processing: bool | None = False, **kwargs) Output[source]#

Method to run the pipeline

Parameters:
  • caching (bool) – EXPERIMENTAL: activate caching mode at every steps to resume work where it was left at from a previous python instance if needed. Default to existing caching given to object at construction.

  • append_hash (bool) – Only relevant if caching is active. When True, ananke automatically adds truncated hashes to all files it produces, to uniquely identify them. Default to True.

  • input_dir, output_dir, i_o_dir (string) – Optional arguments to specify paths for the directories where ananke should generate input and output data. If the i_o_dir keyword argument is provided, it overrides any path given to the input_dir and output_dir keyword arguments.

  • no_post_processing (bool) – If True, ignore the post-processing pipeline following the galaxia_ananke run. This post-processing pipeline involves the replacement of absolute magnitude quantities by their apparent ones, followed by the extinction estimation pipeline and by the error model application. Default to False.

  • k_factor (float) – Scaling factor applied to the kernels lengths to adjust all the kernels sizes uniformly. Lower values reduces the kernels extents, while higher values increases them. Default to 1 (no adjustment).

  • surveyname (string) – Optional name Galaxia should use for the output files. Default to ‘survey’.

  • input_sorter (array_like) – TODO

  • n_gens, n_jobs (int or iterable of int) – Number of independent catalog generations ran in parallel. Can also receive an iterable containing each generation number to run in parallel. Default to 1. Usage of n_jobs is deprecated and will be removed.

  • max_gen_workers (int) – CURRENTLY NOT PROPERLY IMPLEMENTED Maximum number of workers to parallelize the initial catalog generations. Default to the number of independent generations in n_gens.

  • max_pp_workers (int) – Maximum number of workers to parallelize the post-processing pipelines after the initial catalog generation. Default to 1.

  • pp_auto_flush (bool) – TODO

  • verbose (bool) – Verbose boolean flag to allow pipeline to print what it’s doing to stdout. Default to True.

  • partitioning_rule (TODO) – TODO

  • rand_seed (int) – Seed to be used by Galaxia’s pseudorandom number generator. Default to 17052

  • nstart (int) – Index at which to start indexing synthetic stars. Default to 0

  • longitude, latitude (float) –

    Currently not implemented. Respectively default to:

    76.273 & 13.4725
    
  • star_type (int) – Currently not implemented. Default to 0

  • geometry_opt (int) – Currently not implemented. Default to 0

  • survey_area (float) – Currently not implemented. Default to 207.455

  • pop_id (int) – Currently not implemented. Default to 10

  • warp_flare_on (int) – Currently not implemented. Default to 0

  • photo_error (int) – Currently not implemented. Default to 0

Returns:

galaxia_output – Handler with utilities to utilize the output survey and its data.

Return type:

Galaxia.Output

Notes

An Output object almost behaves as a vaex DataFrame, also please consult vaex online tutorials for more hands-on information:

The DataFrame represents the catalogue with columns corresponding to properties of the stars from the synthetic stellar population it simulates.

Warning

When generated directly by galaxia_ananke, the catalogue properties reflect directly the quantities as computed by Galaxia. However the catalogue can be modified/amended by applying post-processing routines using the method apply_post_process_pipeline_and_flush. Also if such Output object was generated by other software than galaxia_ananke, post-processing may have been applied: also please refer to that software documentation for a more complete overview of the catalogue.

The catalogue properties include the photometric magnitudes per filter, with each filter identified by a key in the following lowercase format:

photosys_filtername

where

  • photo_sys corresponds to the chosen photometric system

  • filtername corresponds to a filter name of that system

As an example, the photometry in filters gbp, grp & g of the Gaia DR2 system identified as GAIA__DR2 are respectively under keys gaia__dr2_gbp, gaia__dr2_grp & gaia__dr2_g.

With those are also always included the following properties:

  • Zero Age Main Sequence stellar mass in solar masses via key minit

  • Celestial equatorial coordinates in \(degrees\) via keys (ra, dec)

  • Current stellar mass in solar masses via key mact

  • Tip of the Red Giant Branch stellar mass in solar masses via key mtip

  • Distance modulus in magnitude units via key dmod

  • Surface gravity in CGS units and decimal logarithmic scale via key grav

  • Parallax in milliarcseconds via key pi

  • Stellar metallicity \([Fe/H]\) in \(dex\) relative to solar via key feh

  • Index of parent particle via key parentid

  • Velocity coordinates in \(km/s\) via keys (vx, vy, vz)

  • Stellar ages in years and decimal logarithmic scale via key age

  • Celestial galactic coordinates in \(degrees\) via keys (glon, glat)

  • Surface temperature in Kelvin and decimal logarithmic scale via key teff

  • Flag = 1 if star not at center of its parent particle via key partid

  • Equatorial proper motions in milliarcseconds per year via keys (mura, mudec)

  • Distance in \(kpc\) via key rad

  • Position coordinates in \(kpc\) via keys (px, py, pz)

  • Radial velocity in \(km/s\) via key vr

  • Index of the data partition that contains the particle via key partitionid

  • Galactic proper motions in milliarcseconds per year via keys (mul, mub)

  • Stellar luminosity in solar luminosities and decimal logarithmic scale via key lum

Additionally, depending on what optional properties were provided with the input particle data, the output can also include the following properties:

  • Nitrogen abundance \([N/H]\) in \(dex\) via key nitrogen

  • Helium abundance \([He/H]\) in \(dex\) via key helium

  • Magnesium abundance \([Mg/H]\) in \(dex\) via key magnesium

  • Oxygen abundance \([O/H]\) in \(dex\) via key oxygen

  • Sulphur abundance \([S/H]\) in \(dex\) via key sulphur

  • Neon abundance \([Ne/H]\) in \(dex\) via key neon

  • Calcium abundance \([Ca/H]\) in \(dex\) via key calcium

  • Index of parent particle population via key satid

  • Formation distance of parent particle in kpc via key dform

  • Carbon abundance \([C/H]\) in \(dex\) via key carbon

  • Silicon abundance \([Si/H]\) in \(dex\) via key silicon

  • Alpha abundance \([Mg/Fe]\) in \(dex\) via key alpha

Ananke complements this set of properties with those that are generated from its various post-processing subroutines. As a result the photosys_filtername-formatted columns contain the apparent photometry, computed with addition of extinction and instrument error. Each component contributing to this final apparent photometry are stored in other columns with the photosys_filtername format with relevant prefixing/suffixing as listed below:

  • The intrinsic photometry are stored in the suffixed _Intrinsic keys

  • The extinction values are stored in the prefixed A_ keys

  • The properties’ standard error are stored in the suffixed _Sig keys

  • The properties’ actually drawn gaussian error are stored in the suffixed _Err keys

Note that because the error model generally also affect astrometry, the latter 2 suffixing rules also apply to the astrometric properties.

The extinction post-processing routine also add 3 properties:

  • The line-of-sight hydrogen column density in \(cm^{-2}\) and decimal logarithmic scale via key log10_NH

  • The reddening index via key E(B-V)

  • The reference extinction (which extinction coefficients are based on) via key A_0

property particles: Dict[str, ndarray[Any, dtype[_ScalarType_co]]]#
property particle_masses: ndarray[Any, dtype[_ScalarType_co]]#
property particle_initialmasses: ndarray[Any, dtype[_ScalarType_co]]#
property particle_positions: ndarray[Any, dtype[_ScalarType_co]]#
property particle_velocities: ndarray[Any, dtype[_ScalarType_co]]#
property particle_metallicities: ndarray[Any, dtype[_ScalarType_co]]#
property particle_ages: ndarray[Any, dtype[_ScalarType_co]]#
property particle_parentids: ndarray[Any, dtype[_ScalarType_co]]#
property name: str#
property ngb: int#
property caching: bool#
property append_hash: bool#
property universe: Universe#
property universe_rshell: ndarray[Any, dtype[_ScalarType_co]]#
property observer: Observer#
property observer_position: ndarray[Any, dtype[_ScalarType_co]]#
property observer_velocity: ndarray[Any, dtype[_ScalarType_co]]#
property particle_observed_positions: ndarray[Any, dtype[_ScalarType_co]]#
property particle_observed_velocities: ndarray[Any, dtype[_ScalarType_co]]#
property particle_observed_distances: ndarray[Any, dtype[_ScalarType_co]]#
property particle_input_kernels: ndarray[Any, dtype[_ScalarType_co]]#
property particle_input_position_kernels: ndarray[Any, dtype[_ScalarType_co]]#
property particle_input_velocity_kernels: ndarray[Any, dtype[_ScalarType_co]]#
property particle_nearest_observed_distances: ndarray[Any, dtype[_ScalarType_co]]#
property particle_nearest_observed_distmod: ndarray[Any, dtype[_ScalarType_co]]#
property extinctions#
property errors#
property residuals#
property parameters: Dict[str, Any]#
property photo_sys: str#
property galaxia_photosystems: List[PhotoSystem]#
property galaxia_isochrones#
property galaxia_catalogue_mag_names: Tuple[str]#
property intrinsic_catalogue_mag_names: Tuple[str]#
property galaxia_catalogue_mag_and_astrometrics: Tuple[str]#
property galaxia_catalogue_keys: Tuple[str]#
property photosystems_zeropoints: Quantity#
property photosystems_zeropoints_dict: Dict[str, Quantity]#
classmethod make_dummy_dictionary_description() str[source]#
classmethod make_dummy_particles_input(n_parts=100000, with_kernels=False) Dict[str, ndarray[Any, dtype[_ScalarType_co]]][source]#

Generate an example dummy input particles dictionary for Ananke made of randomly generated arrays.

Parameters:
  • n_parts (int) – Number of particles the example include. Default to 10**5.

  • with_kernels (bool) – Flag to include dummy kernels estimates in the returned dictionary. Default to False

Returns:

p – Dummy example input particles dictionary for Ananke.

Return type:

dict

Notes

The particle dictionary includes the following properties with corresponding keys:

  • Stellar metallicity \([Fe/H]\) in dex relative to solar via key feh

  • Initial stellar masses in solar masses via key massinit

  • Stellar ages in years and decimal logarithmic scale via key age

  • Position coordinates in \(kpc\) (Nx3) via key pos3

  • Velocity coordinates in \(km/s\) (Nx3) via key vel3

Additionally, Galaxia can optionally receive particle properties that will be carried over to the generated synthetic star, those include the following:

  • Helium abundance \([He/H]\) in \(dex\) via key helium

  • Nitrogen abundance \([N/H]\) in \(dex\) via key nitrogen

  • Oxygen abundance \([O/H]\) in \(dex\) via key oxygen

  • Magnesium abundance \([Mg/H]\) in \(dex\) via key magnesium

  • Sulphur abundance \([S/H]\) in \(dex\) via key sulphur

  • Neon abundance \([Ne/H]\) in \(dex\) via key neon

  • Index of the data partition that contains the particle via key partitionid

  • Calcium abundance \([Ca/H]\) in \(dex\) via key calcium

  • Formation distance of parent particle in kpc via key dform

  • Index of parent particle via key parentid

  • Carbon abundance \([C/H]\) in \(dex\) via key carbon

  • Silicon abundance \([Si/H]\) in \(dex\) via key silicon

  • Alpha abundance \([Mg/Fe]\) in \(dex\) via key alpha

  • Index of parent particle population via key id

Ananke compute the phase space densities that are used to determine particle kernel lengths, and requires for that the particle current stellar mass:

  • Present-day stellar masses in solar masses via key mass

but the dictionary can also alternatively receive pre-computed kernels with the following entries:

  • Phase-space kernel radii in \(kpc\) and \(km/s\) (Nx2) via key kernels

classmethod display_available_photometric_systems()[source]#

Return a nested dictionary of all photometric systems that are available in Galaxia.

Returns:

available_photo_systems – Dictionary of dictionaries of Isochrone objects.

Return type:

dict

classmethod display_kernels_docs() None[source]#

Print the KernelsDriver constructor docstring

classmethod display_EnBiD_docs() None[source]#

Print the EnBiD.run_enbid method docstring

classmethod display_extinction_docs() None[source]#

Print the ExtinctionDriver constructor docstring

classmethod display_errormodel_docs() None[source]#

Print the ErrorModelDriver constructor docstring

classmethod display_integratedlight_docs() None[source]#

Print the IntegratedLightDriver constructor docstring

classmethod display_galaxia_makesurvey_docs() None[source]#

Print the Galaxia.Survey.make_survey method docstring