Skip to content

Commit

Permalink
Add version tag to simulation objects (#2190)
Browse files Browse the repository at this point in the history
* Add test for versioning info

* Add version string to simulation objects

* Add name to mailmap

* Add another alias to mailmap
  • Loading branch information
krimmskramms authored Feb 8, 2023
1 parent fae9db6 commit d719b8e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ Kevin Cawley <[email protected]> KevinCawley <[email protected].

Kevin Yap <[email protected]>

Kim Lingemann <[email protected]> kimsina <[email protected]>
Kim Lingemann <[email protected]> kim <[email protected]>

Laud Bentil <[email protected]>
Laud Bentil <[email protected]> Laud Bentil <[email protected]>

Expand Down
4 changes: 4 additions & 0 deletions tardis/simulation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import numpy as np
import pandas as pd
import tardis
from astropy import units as u
from tardis import constants as const
from collections import OrderedDict
Expand Down Expand Up @@ -106,6 +107,8 @@ class Simulation(PlasmaStateStorerMixin, HDFWriterMixin):
convergence_plots_kwargs: dict
nthreads : int
The number of threads to run montecarlo with
version: str
The TARDIS version in use when instantiating the simulation object
.. note:: TARDIS must be built with OpenMP support in order for ``nthreads`` to have effect.
Expand Down Expand Up @@ -157,6 +160,7 @@ def __init__(
self.luminosity_requested = luminosity_requested
self.nthreads = nthreads
self.show_progress_bars = show_progress_bars
self.version = tardis.__version__

if convergence_strategy.type in ("damped"):
self.convergence_strategy = convergence_strategy
Expand Down
6 changes: 6 additions & 0 deletions tardis/simulation/tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import pandas as pd
import pandas.util.testing as pdt
import astropy.units as u
import tardis


@pytest.fixture(scope="module")
Expand Down Expand Up @@ -156,3 +157,8 @@ def test_plasma_state_storer_reshape(

# assert_quantity_allclose(
# t_rad, simulation_compare_data['test1/t_rad'] * u.Unit('K'), atol=0.0 * u.Unit('K'))


def test_version_tag(simulation_without_loop):
simulation = simulation_without_loop
assert simulation.version == tardis.__version__

0 comments on commit d719b8e

Please sign in to comment.