galaxia_ananke.Input module#

Contains the Input class definition

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

class galaxia_ananke.Input.Input(*args, **kwargs)[source]#

Bases: object

__init__(*args, **kwargs) None[source]#

Driver to store and prepare the input data for Galaxia.

Call signatures:

input = Input(particles, kernels,
              input_dir='/home/docs/checkouts/readthedocs.org/user_builds/py-galaxia-ananke/checkouts/main/docs/source',
              name='sim', caching=False,
              ngb=nres,
              k_factor=1.)

input = Input(pname, kname, caching=False)
Parameters:
  • particles (dict) – Dictionary where each elements represent the properties of the input particles, given as equal-length array_like objects.

  • The particle dictionary includes the following properties with

  • corresponding keys

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

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

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

  • * Stellar masses in solar masses via key ``mass``

  • \* 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

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

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

  • * Index of parent particle via key ``parentid``

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

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

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

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

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

  • * Index of parent particle population via key ``id``

  • * Formation distance of parent particle in kpc via key ``dform``

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

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

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

  • \* Neon abundance \([Ne/H]\) in \(dex\) via key ``neon`` – Input comes with class method make_dummy_particles_input to produce a dummy example of that dictionary.

  • kernels (array_like) – Array containing the kernel characteristic lengths for each input particle. Must be of equal length N as the arrays provided in the particles dictionary, as either a (N) or a (Nx2) array if representing respectively kernels in position space, or in phase space (using the same position and velocity unit as that of the corresponding particles dictionary entry).

  • input_dir (string or pathlib.Path) – Optional arguments to specify path for the directory where Galaxia’s input data should be generated. Default to ‘/home/docs/checkouts/readthedocs.org/user_builds/py-galaxia-ananke/checkouts/main/docs/source’.

  • name (string) – Optional name Galaxia should use for the input files. Default to ‘sim’.

  • caching (bool) – TODO

  • append_hash (bool) – TODO

  • ngb (int) – Number of neighbouring particles Galaxia should consider. Default to nres. ONLY SUPPORT 8, 32, 64 & 128.

  • 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).

  • pname (string) – Path to existing pre-formatted particles EBF files to use as input for Galaxia. This keyword argument must be used in conjunction with kname. Default to None if unused.

  • kname (string) – Path to existing pre-formatted kernel EBF files to use as input for Galaxia. This keyword argument must be used in conjunction with pname. Default to None if unused.

particles_dictionary_description = '\n            The particle dictionary includes the following properties with\n            corresponding keys:\n            \n            * Stellar metallicity $[Fe/H]$ in dex relative to solar via key ``feh``\n            * Position coordinates in $kpc$ (Nx3) via key ``pos3``\n            * Stellar ages in years and decimal logarithmic scale via key ``age``\n            * Stellar masses in solar masses via key ``mass``\n            * Velocity coordinates in $km/s$ (Nx3) via key ``vel3``\n            \n            Additionally, Galaxia can optionally receive particle properties\n            that will be carried over to the generated synthetic star, those\n            include the following: \n            \n            * Alpha abundance $[Mg/Fe]$ in $dex$ via key ``alpha``\n            * Nitrogen abundance $[N/H]$ in $dex$ via key ``nitrogen``\n            * Index of parent particle via key ``parentid``\n            * Silicon abundance $[Si/H]$ in $dex$ via key ``silicon``\n            * Calcium abundance $[Ca/H]$ in $dex$ via key ``calcium``\n            * Sulphur abundance $[S/H]$ in $dex$ via key ``sulphur``\n            * Helium abundance $[He/H]$ in $dex$ via key ``helium``\n            * Index of the data partition that contains the particle via key ``partitionid``\n            * Index of parent particle population via key ``id``\n            * Formation distance of parent particle in kpc via key ``dform``\n            * Magnesium abundance $[Mg/H]$ in $dex$ via key ``magnesium``\n            * Carbon abundance $[C/H]$ in $dex$ via key ``carbon``\n            * Oxygen abundance $[O/H]$ in $dex$ via key ``oxygen``\n            * Neon abundance $[Ne/H]$ in $dex$ via key ``neon``\n        '#
all_possible_keys_in_particles = {'age', 'alpha', 'calcium', 'carbon', 'dform', 'feh', 'helium', 'id', 'magnesium', 'mass', 'neon', 'nitrogen', 'oxygen', 'parentid', 'partitionid', 'pos3', 'silicon', 'sulphur', 'vel3'}#
property caching: bool#
property particles: Dict[str, ndarray[Any, dtype[_ScalarType_co]]]#
property length: int#
property hdim: int#
property name: str#
property append_hash: bool#
property name_hash: str#
property ngb: int#
property k_factor: float | ndarray[Any, dtype[_ScalarType_co]]#
property kernels: ndarray[Any, dtype[_ScalarType_co]]#
property pname: Path#
property kname: Path#
keys()[source]#
optional_keys() List[str][source]#
prepare_input(survey: Survey) Tuple[str, pathlib.Path, Dict[str, str | float | int]][source]#

TODO

property input_sorter: ndarray[Any, dtype[int64]]#
property hash: str#
property metadata: Dict[str, Any]#
classmethod make_dummy_particles_input(n_parts=100000)[source]#

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

Parameters:

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

Returns:

p – Dummy example input particles dictionary for Input.

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

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

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

  • Stellar masses in solar masses via key mass

  • 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:

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

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

  • Index of parent particle via key parentid

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

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

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

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

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

  • Index of parent particle population via key id

  • Formation distance of parent particle in kpc via key dform

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

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

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

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

classmethod make_dummy_kernels_input(n_parts=100000)[source]#

Generate an example dummy input kernels for Input made of randomly generated arrays.

Parameters:

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

Returns:

kernels – Dummy example input phase space kernels for Input.

Return type:

array