Read ChimesΒΆ
The read_chimes.py
python module contains various dictionaries and functions that can be used to parse the abundance arrays that are output from the CHIMES module. These can be used to help the User find the abundance of a particular species in the abundance array, whether they are using the full CHIMES network or a reduced network with some of the elements switched off.
There are two dictionaries that define the names of the species in the full CHIMES network:
Dictionary | Description |
---|---|
chimes_dict |
This dictionary gives a series of
{Key : Value} pairs where theKey is the name of the species and the Value is the position ofthat species in the full CHIMES abundance array. So the User can use
chimes_dict["<species_name>"] to get the position of the speciescalled
"<species_name>" in the abundance array. Note that the namegiven by the User must exactly match the name defined in this dictionary.
To see a list of all possible species names, you can do:
for k, v in sorted(chimes_dict.items(), key = lambda x: x[1]): print(k) |
chimes_dict_inv |
This gives the inverse of the
chimes-dict dictionary, i.e. where theKey is the position in the full CHIMES abundance array and theValue is the name of the species at that position. So the User canuse
chimes_dict_inv[<position>] to find the name of the species thatis located at
<position> in the abundance array. |
The following functions can be used to construct dictionaries mapping species names to positions in the abundance array for a reduced network, and to read in the abundances of a given species from an HDF5 snapshot file:
Dictionary | Description |
---|---|
create_reduced_ chimes_dictionary( element_flags = np.zeros(9)) |
Creates a dictionary mapping species names to their position in the
CHIMES abundance array when using a reduced CHIMES network, i.e. when
some of the elements have been switched off. It takes as an optional
argument an array of integers of length 9,
element_flags , that canbe
0 or 1 that encode whether each metal element is includedin the network. These are given in the order: C, N, O, Ne, Mg, Si, S,
Ca, Fe. Note that H and He are always included in the network. If no
element_flags array is given to the function, then it defaults tothe primordial network with only H and He, i.e. with all metal elements
switched off.
|
create_reduced_ inverse_chimes_ dictionary( element_flags = np.zeros(9)) |
Creates the inverse dictionary, i.e. mapping the species position in the
CHIMES abundance array to the corresponding species name, when using a
reduced CHIMES network, i.e. when some of the elements have been switched
off. It takes as an optional argument an array of integers of length 9,
element_flags , that encode which elements are included in the network(see above for details).
|
read_chimes( filename, chimes_species, chimes_dataset = "PartType0/ Abundances") |
Takes the HDF5 snapshot file specified by
filename and reads theabundances of the species given by the string
chimes_species . Theoptional argument
chimes_dataset gives the name of the dataset in theHDF5 snapshot file containing the 2-dimensional CHIMES abundance array.
If this is not specified by the User, it defaults to
PartType0/ChimesAbundances . Returns a 1-dimensional array containingthe abundance of
chimes_species for each gas particle in the snapshot.This routine assumes that we are using the full CHIMES network.
|
read_reduced_ chimes(filename, chimes_species, chimes_dataset = "PartType0/ Abundances", element_flags = np.zeros(9)) |
As
read_chimes() , but for when we are using a reduced network, i.e.with some of the elements switched off. The
filename ,chimes_species and chimes_dataset arguments are as describedabove. The optional
element_flags argument gives an array of integersthat encode which elements are included in the reduced network. See the
create_reduced_chimes_dictionary() description above for details. Ifthis is not specified by the User, it defaults to the primordial network
with only H and He, i.e. with all metal elements switched off.
|