-
Notifications
You must be signed in to change notification settings - Fork 0
/
rotation_matrix.py
56 lines (36 loc) · 1.33 KB
/
rotation_matrix.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import sys
import numpy as np
import configparser
class RotationMatrix():
def __init__(self, config_file, args):
config = configparser.ConfigParser()
config.read(config_file)
self.ngc_sgc = args.ngc_sgc
if self.ngc_sgc is None:
self.ngc_sgc = config.get('sim', 'ngc_sgc')
if self.ngc_sgc == "NGC":
self.rotation_matrix = self.ngc_matrix()
elif self.ngc_sgc == "SGC":
self.rotation_matrix = self.sgc_matrix()
else:
self.rotation_matrix = None
print("ERROR: wrong chosen galactic cap")
os._exit(1)
def ngc_matrix(self):
print("INFO: Using the Rotation matrix for NGC")
axx = ayy = 1 / 2.
axy = - np.sqrt(3) / 2.
axz = ayz = azx = azy = 0.
ayx = - axy
azz = 1
return [axx, axy, axz, ayx, ayy, ayz, azx, azy, azz]
def sgc_matrix(self):
print("INFO: Using the Rotation matrix for SGC")
axx = ayy = (1 / 2.) + 1. / ( 2. * np.sqrt(2) )
axy = ayx = (1 / 2.) - 1. / ( 2. * np.sqrt(2) )
axz = - 1. / 2.
ayz = 1. / 2.
azx = 1. / 2.
azy = - 1. / 2.
azz = 1. / ( np.sqrt(2) )
return [axx, axy, axz, ayx, ayy, ayz, azx, azy, azz]