|
33 | 33 |
|
34 | 34 | from MDAnalysis.lib import transformations as t |
35 | 35 |
|
36 | | -from unittest import TestCase |
37 | | - |
| 36 | +#------------------------------------------------------------ |
| 37 | +# DEPRECATION: Remove this file in 3.0 when lib.transformations is removed |
| 38 | +#------------------------------------------------------------ |
38 | 39 |
|
39 | 40 | """ |
40 | 41 | Testing transformations is weird because there are 2 versions of many of |
|
48 | 49 | .. versionchanged:: 1.0.0 |
49 | 50 | test_transformations_old_module was removed as core/transformations.py is |
50 | 51 | gone |
| 52 | +
|
| 53 | +.. deprecated:: 2.10.0 |
| 54 | + will be removed in 3.0. |
51 | 55 | """ |
52 | 56 |
|
53 | 57 | # tolerance for tests |
|
59 | 63 | # versions from transformations._transformations seem to always shadow |
60 | 64 | # the Python ones from transformations.transformations. |
61 | 65 | # |
62 | | -# As a hack, I replaced t._py_* with t.transformations.* so that the |
63 | | -# tests run but they just test the compiled code twice. |
| 66 | +# As a hack, I replaced t._py_* with t.transformations.* so that the tests run |
| 67 | +# but they just test the compiled code twice. (See PR GH-5062). |
64 | 68 |
|
65 | 69 |
|
66 | 70 | @pytest.mark.parametrize( |
@@ -420,23 +424,10 @@ def test_superimposition_matrix(f): |
420 | 424 | M = f(v0, v1) |
421 | 425 | assert_allclose(v1, np.dot(M, v0), atol=_ATOL) |
422 | 426 |
|
423 | | - # scaling kwarg not supported in transformations any more |
424 | | - # |
425 | | - # S = t.scale_matrix(0.45) |
426 | | - # T = t.translation_matrix(np.array([0.2, 0.2, 0.2]) - 0.5) |
427 | | - # M = t.concatenate_matrices(T, R, S) |
428 | | - # v1 = np.dot(M, v0) |
429 | | - # v0[:3] += np.sin(np.linspace(0.0, 1e-9, 300)).reshape(3, -1) |
430 | | - # M = f(v0, v1, scaling=True) |
431 | | - # assert_allclose(v1, np.dot(M, v0), atol=_ATOL) |
432 | | - |
433 | | - # M = f(v0, v1, scaling=True, usesvd=False) |
434 | | - # assert_allclose(v1, np.dot(M, v0), atol=_ATOL) |
435 | | - # |
436 | | - # v = np.empty((4, 100, 3), dtype=np.float64) |
437 | | - # v[:, :, 0] = v0 |
438 | | - # M = f(v0, v1, scaling=True, usesvd=False) |
439 | | - # assert_allclose(v1, np.dot(M, v[:, :, 0]), atol=_ATOL) |
| 427 | + # We used to have tests here that also tested the `scaling=True` kwarg of |
| 428 | + # transformations.superimposition_matrix(). This kwarg is no longer |
| 429 | + # supported in the transformations package. We don't need it for MDAnalysis |
| 430 | + # so we just removed the tests. (See PR GH-5062) |
440 | 431 |
|
441 | 432 |
|
442 | 433 | @pytest.mark.parametrize( |
@@ -841,32 +832,9 @@ def test_arcball_2(self): |
841 | 832 | assert_allclose(np.sum(R), 0.2055924) |
842 | 833 |
|
843 | 834 |
|
844 | | -# rotaxis was an MDA addition |
845 | | - |
846 | | - |
847 | | -def test_rotaxis_equal_vectors(): |
848 | | - a = np.arange(3) |
849 | | - x = t.rotaxis(a, a) |
850 | | - assert_array_equal(x, [1, 0, 0]) |
851 | | - |
852 | | - |
853 | | -def test_rotaxis_different_vectors(): |
854 | | - # use random coordinate system |
855 | | - e = np.eye(3) |
856 | | - r = np.array( |
857 | | - [ |
858 | | - [0.69884766, 0.59804425, -0.39237102], |
859 | | - [0.18784672, 0.37585347, 0.90744023], |
860 | | - [0.69016342, -0.7078681, 0.15032367], |
861 | | - ] |
862 | | - ) |
863 | | - re = np.dot(r, e) |
864 | | - |
865 | | - for i, j, l in permutations(range(3)): |
866 | | - x = t.rotaxis(re[i], re[j]) |
867 | | - # use abs since direction doesn't matter |
868 | | - assert_almost_equal(np.abs(np.dot(x, re[l])), 1) |
869 | | - |
| 835 | +# rotaxis() was an MDA addition. It was migrated to lib.mdamath in 2.10.0 (and |
| 836 | +# its functionality is tested there). A stub with deprecation warning was left |
| 837 | +# behin in lib.transformations. All of it will be removed in 3.0.0. |
870 | 838 |
|
871 | 839 | def test_rotaxis_deprecation(): |
872 | 840 | a = np.arange(3) |
|
0 commit comments