tardis.io.model_reader module¶
- tardis.io.model_reader.parse_csv_abundances(csvy_data)[source]¶
A parser for the csv data part of a csvy model file. This function filters out columns that are not abundances.
- Parameters
- csvy_datapandas.DataFrame
- Returns
- indexnp.ndarray
- abundancespandas.DataFrame
- isotope_abundancepandas.MultiIndex
- tardis.io.model_reader.read_abundances_file(abundance_filename, abundance_filetype, inner_boundary_index=None, outer_boundary_index=None)[source]¶
read different density file formats
- Parameters
- abundance_filenamestr
filename or path of the density file
- abundance_filetypestr
type of the density file
- inner_boundary_indexint
index of the inner shell, default None
- outer_boundary_indexint
index of the outer shell, default None
- tardis.io.model_reader.read_artis_density(fname)[source]¶
Reading a density file of the following structure (example; lines starting with a hash will be ignored): The first density describes the mean density in the center of the model and is not used. 5 #index velocity [km/s] log10(density) [log10(g/cm^3)] 0 1.1e4 1.6e8 1 1.2e4 1.7e8
- Parameters
- fnamestr
filename or path with filename
- Returns
- time_of_modelastropy.units.Quantity
time at which the model is valid
- datapandas.DataFrame
data frame containing index, velocity (in km/s) and density
- tardis.io.model_reader.read_cmfgen_composition(fname, delimiter='\\s+')[source]¶
Read composition from a CMFGEN model file
The CMFGEN file format contains information about the ejecta state in the first four columns and the following ones contain elemental and isotopic abundances.
WARNING : deprecated
- fnamestr
filename of the csv file
- tardis.io.model_reader.read_cmfgen_density(fname)[source]¶
Reading a density file of the following structure (example; lines starting with a hash will be ignored): The first density describes the mean density in the center of the model and is not used. The file consists of a header row and next row contains unit of the respective attributes Note that the first column has to contain a running index
Example:
index velocity densities electron_densities temperature - km/s g/cm^3 /cm^3 K 0 871.66905 4.2537191e-09 2.5953807e+14 7.6395577 1 877.44269 4.2537191e-09 2.5953807e+14 7.6395577
Rest columns contain abundances of elements and isotopes
- Parameters
- fnamestr
filename or path with filename
- Returns
- time_of_modelastropy.units.Quantity
time at which the model is valid
- velocitynp.ndarray
- mean_densitynp.ndarray
- electron_densitiesnp.ndarray
- temperaturenp.ndarray
- tardis.io.model_reader.read_csv_composition(fname, delimiter='\\s+')[source]¶
Read composition from a simple CSV file
The CSV file can contain specific isotopes or elemental abundances in the different columns. The first row must contain the header in which the contents of each column is specified by the elemental symbol (for elemental abundances) or by the symbol plus mass number (for isotopic abundances).
Example: C O Fe Ni56 Co
The i-th row specifies the composition in the i-th shell
- fnamestr
filename of the csv file
- tardis.io.model_reader.read_csv_isotope_abundances(fname, delimiter='\\s+', skip_columns=0, skip_rows=[1])[source]¶
A generic parser for a TARDIS composition stored as a CSV file
The parser can read in both elemental and isotopic abundances. The first column is always expected to contain a running index, labelling the grid cells. The parser also allows for additional information to be stored in the first skip_columns columns. These will be ignored if skip_columns > 0. Note that the first column, containing the cell index is not taken into account here.
Specific header lines can be skipped by the skip_rows keyword argument
It is expected that the first row of the date block (after skipping the rows specified in skip_rows) specifies the different elements and isotopes. Each row after contains the composition in the corresponding grid shell. The first composition row describes the composition of the photosphere and is essentially ignored (for the default value of skip_rows).
Example:
Index C O Ni56 0 1 1 1 1 0.4 0.3 0.2
- Parameters
- fnamestr
filename or path with filename
- Returns
- indexnp.ndarray
- abundancespandas.DataFrame
- isotope_abundancepandas.MultiIndex
- tardis.io.model_reader.read_density_file(filename, filetype)[source]¶
read different density file formats
- Parameters
- filenamestr
filename or path of the density file
- filetypestr
type of the density file
- Returns
- time_of_modelastropy.units.Quantity
time at which the model is valid
- velocitynp.ndarray
the array containing the velocities
- unscaled_mean_densitiesnp.ndarray
the array containing the densities
- tardis.io.model_reader.read_simple_ascii_abundances(fname)[source]¶
Reading an abundance file of the following structure (example; lines starting with hash will be ignored): The first line of abundances describe the abundances in the center of the model and are not used. #index element1, element2, …, element30 0 0.4 0.3, .. 0.2
- Parameters
- fnamestr
filename or path with filename
- Returns
- indexnp.ndarray
containing the indices
- abundancespandas.DataFrame
data frame containing index, element1 - element30 and columns according to the shells
- tardis.io.model_reader.read_simple_ascii_density(fname)[source]¶
Reading a density file of the following structure (example; lines starting with a hash will be ignored): The first density describes the mean density in the center of the model and is not used. 5 s #index velocity [km/s] density [g/cm^3] 0 1.1e4 1.6e8 1 1.2e4 1.7e8
- Parameters
- fnamestr
filename or path with filename
- Returns
- time_of_modelastropy.units.Quantity
time at which the model is valid
- datapandas.DataFrame
data frame containing index, velocity (in km/s) and density