Skip to content

Commit a9cd8be

Browse files
committed
test coord
1 parent bbc0d5e commit a9cd8be

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_coord.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import unittest
2+
import numpy as np
3+
import numpy.testing as npt
4+
from sigpy import util, coord
5+
6+
if __name__ == '__main__':
7+
unittest.main()
8+
9+
class TestCoord(unittest.TestCase):
10+
11+
def test_normal(self):
12+
13+
x = util.randn((10, 1))
14+
y = util.randn((10, 1))
15+
z = util.randn((10, 1))
16+
17+
r, theta, phi = coord.cartes_to_spheri(x, y, z)
18+
xn, yn, zn = coord.spheri_to_cartes(r, theta, phi)
19+
20+
npt.assert_allclose(x, xn)
21+
npt.assert_allclose(y, yn)
22+
npt.assert_allclose(z, zn)

0 commit comments

Comments
 (0)