Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEP007] Docs for isotope config #767

Merged
merged 7 commits into from
Jul 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 68 additions & 4 deletions docs/examples/abundancecust.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -46,12 +46,76 @@ 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
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=' ')
18 changes: 15 additions & 3 deletions docs/examples/abundanceuni.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down
4 changes: 3 additions & 1 deletion docs/examples/tardis_configv1_abundance_uniform_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
model:
abundances:
type: file
filename: tardis_model_abund.csv
filetype: tardis_model
11 changes: 11 additions & 0 deletions docs/examples/tardis_model_abund.csv
Original file line number Diff line number Diff line change
@@ -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