Skip to content

Commit

Permalink
test mass_absolute for nan caused by float imprecision
Browse files Browse the repository at this point in the history
  • Loading branch information
plodocus committed Dec 2, 2020
1 parent 4adf60a commit 5fb85a9
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,66 @@ def test_mass_absolute_T_inf(Q, T):
npt.assert_almost_equal(ref, comp)


def test_mass_absolute_sqrt_input_negative():
Q = np.array(
[
-13.09,
-14.1,
-15.08,
-16.31,
-17.13,
-17.5,
-18.07,
-18.07,
-17.48,
-16.24,
-14.88,
-13.56,
-12.65,
-11.93,
-11.48,
-11.06,
-10.83,
-10.67,
-10.59,
-10.81,
-10.92,
-11.15,
-11.37,
-11.53,
-11.19,
-11.08,
-10.48,
-10.14,
-9.92,
-9.99,
-10.11,
-9.92,
-9.7,
-9.47,
-9.06,
-9.01,
-8.79,
-8.67,
-8.33,
-8.0,
-8.26,
-8.0,
-7.54,
-7.32,
-7.13,
-7.24,
-7.43,
-7.93,
-8.8,
-9.71,
]
)
ref = 0
comp = core.mass_absolute(Q, Q)
npt.assert_almost_equal(ref, comp)


def test_apply_exclusion_zone():
T = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=float)
ref = np.empty(T.shape)
Expand Down

0 comments on commit 5fb85a9

Please sign in to comment.