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

made the timo_0 in decay framework required #2183

Closed
wants to merge 8 commits into from
Closed
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
8 changes: 8 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,11 @@ Le Truong <[email protected]>

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

Le Truong <[email protected]>

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

Soumya Tarafder <[email protected]>
Soumya Tarafder <[email protected]>
2 changes: 1 addition & 1 deletion docs/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.8.15"
}
},
"nbformat": 4,
Expand Down
9 changes: 4 additions & 5 deletions tardis/io/decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ class IsotopeAbundances(pd.DataFrame):
_metadata = ["time_0"]

def __init__(self, *args, **kwargs):
if "time_0" in kwargs:
time_0 = kwargs["time_0"]
kwargs.pop("time_0")
else:
time_0 = 0 * u.d
if "time_0" not in kwargs:
raise ValueError("The 'time_0' parameter must be specified when creating an instance of IsotopeAbundance.")
time_0 = kwargs["time_0"]
kwargs.pop("time_0")
super(IsotopeAbundances, self).__init__(*args, **kwargs)
self.time_0 = time_0

Expand Down
4 changes: 2 additions & 2 deletions tardis/io/tests/test_decay.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import pandas as pd

from astropy import units as u
from tardis.io.decay import IsotopeAbundances
from numpy.testing import assert_almost_equal

Expand All @@ -10,7 +10,7 @@ def simple_abundance_model():
index = pd.MultiIndex.from_tuples(
[(28, 56)], names=["atomic_number", "mass_number"]
)
return IsotopeAbundances([[1.0, 1.0]], index=index)
return IsotopeAbundances([[1.0, 1.0]], index=index, time_0=0*u.s)


def test_simple_decay(simple_abundance_model):
Expand Down
2 changes: 1 addition & 1 deletion tardis/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ def from_config(cls, config, atom_data=None):
abundance /= norm_factor
isotope_abundance /= norm_factor

isotope_abundance = IsotopeAbundances(isotope_abundance)
isotope_abundance = IsotopeAbundances(isotope_abundance,time_0=0*u.s)

elemental_mass = None
if atom_data is not None:
Expand Down
2 changes: 1 addition & 1 deletion tardis/model/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def simple_isotope_abundance():
[(6, 14), (12, 28)], names=["atomic_number", "mass_number"]
)
abundance = [[0.2] * 20] * 2
return IsotopeAbundances(abundance, index=index)
return IsotopeAbundances(abundance, index=index, time_0=0*u.s)


def test_model_decay(simple_isotope_abundance):
Expand Down
Loading