diff --git a/docs/examples/abundancecust.rst b/docs/examples/abundancecust.rst index 19475608657..19e340647de 100644 --- a/docs/examples/abundancecust.rst +++ b/docs/examples/abundancecust.rst @@ -2,8 +2,8 @@ Using a custom stratified composition ************************************* -Overview -======== +ASCII Format +============= To use a stratified ejecta composition in TARDIS, the elemental abundances may be specified on a per-cell basis via an external ascii file (similar to setting @@ -46,8 +46,8 @@ The example file shown here has three simple layers: including details of how to develop your own dataset to suit your needs, please contact us. -TARDIS input file -================= +TARDIS ascii input file +======================= If you create a correctly formatted abundance profile file (called "abund.dat" in this example), you can use it in TARDIS by putting the following lines in @@ -55,3 +55,67 @@ the model section of the yaml file: .. literalinclude:: tardis_configv1_abundance_cust_example.yml :language: yaml + + +CSV Format +========== + +In this format, both elemental and isotopic abundances may +be specified on a per-cell basis via an external csv file. A csv file that could +work on a mesh with ten cells should be formatted like this: + +.. csv-table:: Example + :file: tardis_model_abund.csv + :delim: space + :header-rows: 1 + +In this file: + +- Header row contains element and isotopes symbol +- the remaining entries in each row give the set of elemental and isotopic abundances. + +The abundances are specified as mass fractions (i.e. the sum of columns +in each row should be 1.0). The mass fractions specified will be adopted directly in +the TARDIS calculations. + +The example file shown here has three simple layers: + +- an innermost region that is composed of Si and two Nickel Isotopes Ni56 and Ni58 + +- a middle region that is composed of O and Mg + +- an outer region that is composed of C and O. + +.. note:: + + Suppose you specify Elemental and Isotopic abundances for the same element. For ex- + :code:`Ni` and :code:`Ni56`. + Here, Ni will refer to the stable Nickel, i.e. (Z=26, A=58). + +.. warning:: + + The example given here is to show the format only. It is not a + realistic model. In any real calculation better resolution + (i.e. more grid points) should be used. + +TARDIS csv input file +===================== + +If you create a correctly formatted abundance profile file (called "tardis_model_abund.csv" +in this example), you can use it in TARDIS by putting the following lines in +the model section of the yaml file: + +.. literalinclude:: tardis_configv1_isotope_abundance_cust_example.yml + :language: yaml + +Convert ascii abundance file format to csv format +================================================= + +If you want to convert an ASCII abundance file(say "abund.dat") to CSV format, you can use +:code:`convert_abundances_format` function for it. Here is an example to demonstrate this: + +.. code:: python + + from tardis.util import convert_abundances_format + df = convert_abundances_format('abund.dat') + df.to_csv('converted_abund.csv', index=False, sep=' ') \ No newline at end of file diff --git a/docs/examples/abundanceuni.rst b/docs/examples/abundanceuni.rst index 7df5f52d834..07017fb9648 100644 --- a/docs/examples/abundanceuni.rst +++ b/docs/examples/abundanceuni.rst @@ -8,16 +8,28 @@ Overview The simplest possibility for specifying an ejecta composition is to use a uniform abundance pattern in all cells specified in the density profile setup step. These constant abundances can be supplied directly in the input (yaml) -file. Elemental abundances are set in the "abundances" subsection of the "model" +file. Elemental and Isotopic abundances are set in the "abundances" subsection of the "model" section, following the "type: uniform" specifier (see example input file below). They are specified as mass fractions. E.g. .. code-block:: none Si: 0.6 - S: 0.4 + S: 0.2 + Ni56: 0.2 -will set the mass fraction of silicon (Z=14) to 0.6 and sulphur (Z=16) to 0.4. +will set the mass fraction of silicon (Z=14) to 0.6, sulphur (Z=16) to 0.2 and Nickel(Z=26, A=56) to 0.2. + +.. note:: + + Suppose you specify Elemental and Isotopic abundance for the same element. For ex- + + .. code-block:: none + + Ni: 0.8 + Ni56: 0.2 + + Here, Ni will refer to the stable Nickel, i.e. (Z=26, A=58). .. note:: diff --git a/docs/examples/tardis_configv1_abundance_uniform_example.yml b/docs/examples/tardis_configv1_abundance_uniform_example.yml index f354293b387..77472625871 100644 --- a/docs/examples/tardis_configv1_abundance_uniform_example.yml +++ b/docs/examples/tardis_configv1_abundance_uniform_example.yml @@ -5,5 +5,7 @@ model: Mg: 0.03 Si: 0.52 S: 0.19 - Ar: 0.04 + Ar: 0.02 Ca: 0.03 + Ni56: 0.01 + Ni58: 0.01 diff --git a/docs/examples/tardis_configv1_isotope_abundance_cust_example.yml b/docs/examples/tardis_configv1_isotope_abundance_cust_example.yml new file mode 100644 index 00000000000..740d4148ae4 --- /dev/null +++ b/docs/examples/tardis_configv1_isotope_abundance_cust_example.yml @@ -0,0 +1,5 @@ +model: + abundances: + type: file + filename: tardis_model_abund.csv + filetype: tardis_model \ No newline at end of file diff --git a/docs/examples/tardis_model_abund.csv b/docs/examples/tardis_model_abund.csv new file mode 100644 index 00000000000..46200ee5b77 --- /dev/null +++ b/docs/examples/tardis_model_abund.csv @@ -0,0 +1,11 @@ +C O Mg Si Ni56 Ni58 +0 0 0 0.6 0.4 0 +0 0 0 0.1 0.5 0.4 +0 0 0 0.3 0 0.7 +0 0.2 0.8 0 0 0 +0 0.3 0.7 0 0 0 +0 0.2 0.8 0 0 0 +0 0.2 0.8 0 0 0 +0 0.2 0.8 0 0 0 +0.5 0.5 0 0 0 0 +0.5 0.5 0 0 0 0