Total Complexity | 4 |
Total Lines | 15 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | "Some utility methods" |
||
25 | def rotation(theta, axis=-1): |
||
26 | """ |
||
27 | Return a rotation matrix around axis |
||
28 | 0:x, 1:y, 2:z |
||
29 | """ |
||
30 | ct = cos(theta) |
||
31 | st = sin(theta) |
||
32 | |||
33 | if axis in (0, -3): |
||
34 | return np.array([[1, 0, 0], |
||
35 | [0, ct, st], |
||
36 | [0, -st, ct]]) |
||
37 | |||
38 | if axis in (1, -2): |
||
39 | return np.array([[ct, 0, st], |
||
40 | [0, 1, 0], |
||
59 |