1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """Module for the handling of Frame Order."""
24
25
26 from math import cos, pi, sin
27 try:
28 from scipy.integrate import quad
29 except ImportError:
30 pass
31
32
33 from lib.geometry.pec import pec
34 from lib.frame_order.matrix_ops import rotate_daeg
35 from lib.frame_order.pseudo_ellipse import tmax_pseudo_ellipse
36
37
39 """Generate the 1st degree Frame Order matrix for the free rotor pseudo-ellipse.
40
41 @param matrix: The Frame Order matrix, 1st degree to be populated.
42 @type matrix: numpy 3D, rank-2 array
43 @param R_eigen: The eigenframe rotation matrix.
44 @type R_eigen: numpy 3D, rank-2 array
45 @param theta_x: The cone opening angle along x.
46 @type theta_x: float
47 @param theta_y: The cone opening angle along y.
48 @type theta_y: float
49 """
50
51
52 fact = 2.0 * pec(theta_x, theta_y)
53
54
55 if fact == 0.0:
56 fact = 1e100
57 else:
58 fact = 1.0 / fact
59
60
61 matrix[2, 2] = fact * quad(part_int_daeg1_pseudo_ellipse_free_rotor_22, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]
62
63
64 return rotate_daeg(matrix, R_eigen)
65
66
68 """Generate the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse.
69
70 @param matrix: The Frame Order matrix, 2nd degree to be populated.
71 @type matrix: numpy 9D, rank-2 array
72 @param Rx2_eigen: The Kronecker product of the eigenframe rotation matrix with itself.
73 @type Rx2_eigen: numpy 9D, rank-2 array
74 @param theta_x: The cone opening angle along x.
75 @type theta_x: float
76 @param theta_y: The cone opening angle along y.
77 @type theta_y: float
78 """
79
80
81 fact3 = 3.0 * pec(theta_x, theta_y)
82 fact4 = 4.0 * pec(theta_x, theta_y)
83 fact6 = 6.0 * pec(theta_x, theta_y)
84
85
86 if fact3 == 0.0:
87 fact3 = 1e100
88 fact4 = 1e100
89 fact6 = 1e100
90 else:
91 fact3 = 1.0 / fact3
92 fact4 = 1.0 / fact4
93 fact6 = 1.0 / fact6
94
95
96 matrix[0, 0] = fact6 * (4.0*pi - quad(part_int_daeg2_pseudo_ellipse_free_rotor_00, -pi, pi, args=(theta_x, theta_y), full_output=1)[0])
97 matrix[1, 1] = matrix[3, 3] = fact4 * quad(part_int_daeg2_pseudo_ellipse_free_rotor_11, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]
98 matrix[4, 4] = fact6 * (4.0*pi - quad(part_int_daeg2_pseudo_ellipse_free_rotor_44, -pi, pi, args=(theta_x, theta_y), full_output=1)[0])
99 matrix[8, 8] = fact3 * (2.0*pi - quad(part_int_daeg2_pseudo_ellipse_free_rotor_88, -pi, pi, args=(theta_x, theta_y), full_output=1)[0])
100
101
102 matrix[0, 4] = matrix[0, 0]
103 matrix[4, 0] = matrix[4, 4]
104 matrix[0, 8] = fact3 * (2.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_08, -pi, pi, args=(theta_x, theta_y), full_output=1)[0])
105 matrix[8, 0] = fact6 * (4.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_80, -pi, pi, args=(theta_x, theta_y), full_output=1)[0])
106 matrix[4, 8] = fact3 * (2.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_48, -pi, pi, args=(theta_x, theta_y), full_output=1)[0])
107 matrix[8, 4] = matrix[8, 0]
108
109
110 matrix[1, 3] = matrix[3, 1] = -matrix[1, 1]
111
112
113 return rotate_daeg(matrix, Rx2_eigen)
114
115
117 """The theta-sigma partial integral of the 1st degree Frame Order matrix element zz for the free rotor pseudo-ellipse.
118
119 @param phi: The azimuthal tilt-torsion angle.
120 @type phi: float
121 @param x: The cone opening angle along x.
122 @type x: float
123 @param y: The cone opening angle along y.
124 @type y: float
125 @return: The theta-sigma partial integral.
126 @rtype: float
127 """
128
129
130 tmax = tmax_pseudo_ellipse(phi, x, y)
131
132
133 return sin(tmax)**2
134
135
137 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse.
138
139 @param phi: The azimuthal tilt-torsion angle.
140 @type phi: float
141 @param x: The cone opening angle along x.
142 @type x: float
143 @param y: The cone opening angle along y.
144 @type y: float
145 @return: The theta-sigma partial integral.
146 @rtype: float
147 """
148
149
150 tmax = tmax_pseudo_ellipse(phi, x, y)
151
152
153 cos_tmax = cos(tmax)
154
155
156 return cos(phi)**2 * cos_tmax**3 + 3.0*sin(phi)**2 * cos_tmax
157
158
160 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse.
161
162 @param phi: The azimuthal tilt-torsion angle.
163 @type phi: float
164 @param x: The cone opening angle along x.
165 @type x: float
166 @param y: The cone opening angle along y.
167 @type y: float
168 @return: The theta-sigma partial integral.
169 @rtype: float
170 """
171
172
173 tmax = tmax_pseudo_ellipse(phi, x, y)
174
175
176 cos_tmax = cos(tmax)
177
178
179 return cos(phi)**2 * (cos_tmax**3 - 3.0*cos_tmax)
180
181
183 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse.
184
185 @param phi: The azimuthal tilt-torsion angle.
186 @type phi: float
187 @param x: The cone opening angle along x.
188 @type x: float
189 @param y: The cone opening angle along y.
190 @type y: float
191 @return: The theta-sigma partial integral.
192 @rtype: float
193 """
194
195
196 tmax = tmax_pseudo_ellipse(phi, x, y)
197
198
199 return sin(tmax)**2
200
201
203 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse.
204
205 @param phi: The azimuthal tilt-torsion angle.
206 @type phi: float
207 @param x: The cone opening angle along x.
208 @type x: float
209 @param y: The cone opening angle along y.
210 @type y: float
211 @return: The theta-sigma partial integral.
212 @rtype: float
213 """
214
215
216 tmax = tmax_pseudo_ellipse(phi, x, y)
217
218
219 cos_tmax = cos(tmax)
220
221
222 return sin(phi)**2 * cos_tmax**3 + 3.0*cos(phi)**2 * cos_tmax
223
224
226 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse.
227
228 @param phi: The azimuthal tilt-torsion angle.
229 @type phi: float
230 @param x: The cone opening angle along x.
231 @type x: float
232 @param y: The cone opening angle along y.
233 @type y: float
234 @return: The theta-sigma partial integral.
235 @rtype: float
236 """
237
238
239 tmax = tmax_pseudo_ellipse(phi, x, y)
240
241
242 cos_tmax = cos(tmax)
243
244
245 return sin(phi)**2 * (cos_tmax**3 - 3.0*cos_tmax)
246
247
249 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse.
250
251 @param phi: The azimuthal tilt-torsion angle.
252 @type phi: float
253 @param x: The cone opening angle along x.
254 @type x: float
255 @param y: The cone opening angle along y.
256 @type y: float
257 @return: The theta-sigma partial integral.
258 @rtype: float
259 """
260
261
262 tmax = tmax_pseudo_ellipse(phi, x, y)
263
264
265 cos_tmax = cos(tmax)
266
267
268 return cos_tmax**3 - 3.0*cos_tmax
269
270
272 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse.
273
274 @param phi: The azimuthal tilt-torsion angle.
275 @type phi: float
276 @param x: The cone opening angle along x.
277 @type x: float
278 @param y: The cone opening angle along y.
279 @type y: float
280 @return: The theta-sigma partial integral.
281 @rtype: float
282 """
283
284
285 tmax = tmax_pseudo_ellipse(phi, x, y)
286
287
288 return cos(tmax)**3
289