-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from LIBRA-project/model-prms
`tritium.Model` parameters are more straightforward
- Loading branch information
Showing
3 changed files
with
234 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from libra_toolbox.tritium.model import ( | ||
activity_to_quantity, | ||
quantity_to_activity, | ||
SPECIFIC_ACT, | ||
MOLAR_MASS, | ||
ureg, | ||
) | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"units", [None, ureg.Bq, ureg.Ci, ureg.Bq / ureg.g, ureg.Ci / ureg.L] | ||
) | ||
@pytest.mark.parametrize("activity", [0, 1e-2, 0.5, 1, 2]) | ||
def test_activity_to_quantity(activity, units): | ||
if units: | ||
activity = activity * units | ||
assert activity_to_quantity(activity) == activity / (SPECIFIC_ACT * MOLAR_MASS) | ||
if units: | ||
assert activity_to_quantity(activity).dimensionality != activity.dimensionality | ||
|
||
|
||
@pytest.mark.parametrize("units", [None, ureg.g, ureg.mol, ureg.kg, ureg.mol / ureg.L]) | ||
@pytest.mark.parametrize("quantity", [0, 1e-2, 0.5, 1, 2]) | ||
def test_quantity_to_activity(quantity, units): | ||
if units: | ||
quantity = quantity * units | ||
assert quantity_to_activity(quantity) == quantity * (SPECIFIC_ACT * MOLAR_MASS) | ||
if units: | ||
assert quantity_to_activity(quantity).dimensionality != quantity.dimensionality |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters