Skip to content

Commit

Permalink
fix old numpy testers
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelstjean committed Jun 19, 2023
1 parent a31550b commit 8602f13
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 34 deletions.
7 changes: 1 addition & 6 deletions nlsam/tests/test_angular_tools.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#! /usr/bin/env python

import numpy as np
from numpy.testing import assert_almost_equal, assert_equal, run_module_suite
from numpy.testing import assert_almost_equal, assert_equal

from nlsam.angular_tools import angular_neighbors, _angle, greedy_set_finder, split_per_shell

Expand Down Expand Up @@ -89,6 +87,3 @@ def test_split_per_shell():

for n, ii in enumerate(idx):
assert_equal(np.unique(greedy_set_finder(ii)), true_idx[n])

if __name__ == "__main__":
run_module_suite()
8 changes: 1 addition & 7 deletions nlsam/tests/test_bias_correction.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#! /usr/bin/env python

import numpy as np
from numpy.testing import assert_allclose, assert_array_less, run_module_suite
from numpy.testing import assert_allclose, assert_array_less

from nlsam.bias_correction import root_finder_sigma, multiprocess_stabilization

Expand Down Expand Up @@ -138,7 +136,3 @@ def test_stabilization():
# The answer is a bit off for the last values of the final output, might be due to different numerical schemes
assert_allclose(output[:80], answer[:80], atol=1e-2, rtol=1e-5)
assert_allclose(eta, eta_koay, atol=1e-2, rtol=1e-6)


if __name__ == "__main__":
run_module_suite()
8 changes: 1 addition & 7 deletions nlsam/tests/test_reshaping.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#! /usr/bin/env python

import numpy as np
from numpy.testing import assert_allclose, run_module_suite
from numpy.testing import assert_allclose

from nlsam.utils import col2im_nd, im2col_nd
from autodmri.blocks import extract_patches
Expand Down Expand Up @@ -52,7 +50,3 @@ def test_reshaping():
out = extract_patches(a, (2, 2, 2, 10), (1, 1, 1, 10)).reshape(-1, 2**3 * 10).T
redo = col2im_nd(out, (2, 2, 2, 10), (10, 10, 10, 10), (0, 0, 0, 0))
assert_allclose(a, redo)


if __name__ == "__main__":
run_module_suite()
8 changes: 1 addition & 7 deletions nlsam/tests/test_smoothing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#! /usr/bin/env python

import numpy as np
from numpy.testing import assert_array_less, run_module_suite
from numpy.testing import assert_array_less

from nlsam.bias_correction import xi
from nlsam.smoothing import local_standard_deviation
Expand Down Expand Up @@ -42,7 +40,3 @@ def test_local_standard_deviation():

# everything less than 10% error of real value?
assert_array_less(np.abs(std - corrected_std.mean()) / std, 0.1)


if __name__ == "__main__":
run_module_suite()
8 changes: 1 addition & 7 deletions nlsam/tests/test_stabilizer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#! /usr/bin/env python

import numpy as np
from numpy.testing import assert_allclose, assert_equal, run_module_suite
from numpy.testing import assert_allclose, assert_equal
from itertools import product

from nlsam.stabilizer import (_test_marcumq_cython,
Expand Down Expand Up @@ -322,7 +320,3 @@ def test_marcumq_octave():

for (a, b), q in zip(product(A, B), Q):
assert_allclose(_test_marcumq_cython(a, b, M), q, atol=1e-4, rtol=1e-6)


if __name__ == "__main__":
run_module_suite()

0 comments on commit 8602f13

Please sign in to comment.