Skip to content

Commit

Permalink
Merge 1681dc2 into e7fa1d5
Browse files Browse the repository at this point in the history
  • Loading branch information
wkerzendorf committed Mar 14, 2014
2 parents e7fa1d5 + 1681dc2 commit 8a4646c
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rapid spectral modelling of supernovae. The code is described in this documentat
gui
uses
examples/examples
testing
atomic
plasma
montecarlo
Expand Down
15 changes: 15 additions & 0 deletions docs/testing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Testing TARDIS
--------------

Testing a code like TARDIS is an important step to making sure that the output is trustworthy. The TARDIS team has opted
to use the py.test testing framework for use with TARDIS (and some astropy extensions of it). To run the tests download
the desired version of TARDIS and run it with::

python setup.py test

This will run the currently implemented tests (which are not as many as there should be)

To quickly test TARDIS with any atomic dataset (it will only see if it in general runs)::

python setup.py test --args="--atomic-dataset=<path_to_dataset> -s"

47 changes: 47 additions & 0 deletions tardis/io/tests/data/tardis_configv1_verysimple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
tardis_config_version: v1.0

supernova:
luminosity_requested: 2.8e9 Lsun
time_explosion: 13 day

atom_data: kurucz_atom_pure_simple.h5

model:

structure:
type: specific

velocity:
start: 1.1e4 km/s
stop: 2.0e4 km/s
num: 20

density:
type: branch85_w7

abundances:
type: uniform
O: 0.19
Mg: 0.03
Si: 0.52
S: 0.19
Ar: 0.04
Ca: 0.03

plasma:
ionization: lte
excitation: lte
radiative_rates_type: dilute-blackbody
line_interaction_type: macroatom

montecarlo:
seed: 23111963
no_of_packets : 2.0e+5
iterations: 5
last_no_of_packets: 5.0e+5
no_of_virtual_packets: 5

spectrum:
start: 500 angstrom
stop: 20000 angstrom
num: 10000
5 changes: 4 additions & 1 deletion tardis/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# file for setting up tests
#py.test configuration

def pytest_addoption(parser):
parser.addoption("--atomic-dataset", dest='atomic-dataset', default=None, help="filename for atomic dataset")
29 changes: 29 additions & 0 deletions tardis/tests/test_tardis_full.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pytest
import os
import yaml
from tardis import io, model, simulation
from tardis.io.config_reader import TARDISConfiguration
from numpy.testing import assert_array_almost_equal

@pytest.mark.skipif(not pytest.config.getvalue("atomic-dataset"),
reason='--atomic_database was not specified')
class TestSimpleRun():
"""
Very simple run
"""

@classmethod
@pytest.fixture(scope="class", autouse=True)
def setup(self):
self.atom_data_filename = pytest.config.getvalue('atomic-dataset')
assert os.path.exists(self.atom_data_filename)
self.config_yaml = yaml.load(open('tardis/io/tests/data/tardis_configv1_verysimple.yml'))
self.config_yaml['atom_data'] = self.atom_data_filename

self.config = TARDISConfiguration.from_config_dict(self.config_yaml)
self.model = model.Radial1DModel(self.config)
simulation.run_radial1d(self.model)


def test_structure(self):
pass

0 comments on commit 8a4646c

Please sign in to comment.