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 
27   
28   
29  from lib.frame_order.matrix_ops import rotate_daeg 
30   
31   
33      """Generate the 1st degree Frame Order matrix for the free rotor isotropic cone. 
34   
35      @param matrix:  The Frame Order matrix, 1st degree to be populated. 
36      @type matrix:   numpy 3D, rank-2 array 
37      @param R_eigen: The eigenframe rotation matrix. 
38      @type R_eigen:  numpy 3D, rank-2 array 
39      @param tmax:    The cone opening angle. 
40      @type tmax:     float 
41      """ 
42   
43       
44      matrix[:] = 0.0 
45   
46       
47      matrix[2, 2] = cos(tmax) + 1.0 
48   
49       
50      return 0.5 * rotate_daeg(matrix, R_eigen) 
 51   
52   
54      """Generate the rotated 2nd degree Frame Order matrix for the free rotor isotropic cone. 
55   
56      The cone axis is assumed to be parallel to the z-axis in the eigenframe. 
57   
58   
59      @param matrix:      The Frame Order matrix, 2nd degree to be populated. 
60      @type matrix:       numpy 9D, rank-2 array 
61      @param Rx2_eigen:   The Kronecker product of the eigenframe rotation matrix with itself. 
62      @type Rx2_eigen:    numpy 9D, rank-2 array 
63      @param tmax:        The cone opening angle. 
64      @type tmax:         float 
65      """ 
66   
67       
68      matrix[:] = 0.0 
69   
70       
71      cos_tmax = cos(tmax) 
72      cos_tmax2 = cos_tmax**2 
73   
74       
75      matrix[0, 0] = matrix[4, 4] = (cos_tmax2 + cos_tmax + 4.0) / 12.0 
76      matrix[1, 1] = matrix[3, 3] = (cos_tmax + 1.0) / 4.0 
77      matrix[8, 8] = (cos_tmax2 + cos_tmax + 1.0) / 3.0 
78   
79       
80      matrix[0, 4] = matrix[4, 0] = matrix[0, 0] 
81      matrix[0, 8] = matrix[8, 0] = -(cos_tmax2 + cos_tmax - 2.0) / 6.0 
82      matrix[4, 8] = matrix[8, 4] = matrix[0, 8] 
83   
84       
85      matrix[1, 3] = matrix[3, 1] = -matrix[1, 1] 
86   
87       
88      return rotate_daeg(matrix, Rx2_eigen) 
 89