irfpy.joee.frame0

JoEE and S/C frame conversions

Draft version of frame conversions. See also JoEE for definition. Brief summary is here.

Angles to JoEE frame

\(\theta\) is defined by the angle from y=z plane. \(\phi\) is defined from z axis and -y axis is 90.

Therefore, the conversion to vector of JoEE frame is

\[\begin{split}x = \sin\theta \\ y = -\cos\theta \times \sin\phi \\ z = \cos\theta \times \cos\phi\end{split}\]

JoEE frame and JUICE frame

The JUICE frame (sometimes called PEP frame or NSC frame) and the JoEE frame conversion is defined as a simple matrix, as the same way as JNA0. See also irfpy.jna.frame0.

There are two following functions, but they are just aliases from JNA-SC conversion in irfpy.jna.frame0.

irfpy.joee.frame0.joee2nsc(vec)

JNA to SC.

Parameters

vec – Vector in JNA frame. (3,) or (3, N) shaped numpy array.

>>> r_jna = np.array([1, 3, 5])
>>> r_nsc = jna2nsc(r_jna)
>>> print(r_nsc)
[-1  5  3]

Multiple vector conversion is supported. Shape should be (3, N), where N is the number of vectors. The returned is also (3, N) shape.

>>> rs_jna = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]])
>>> print(rs_jna.shape)
(3, 5)
>>> rs_nsc = jna2nsc(rs_jna)
>>> print(rs_nsc.shape)
(3, 5)
>>> print(rs_nsc[:, 0])
[-1 11  6]
irfpy.joee.frame0.nsc2joee(vec)

SC frame vector, vec, is converted to JNA frame.

Parameters

vec – Vector in NSC frame. (3,) or (3, N) shaped numpy array.

>>> r_jna = np.array([-1, 2, 8])
>>> r_nsc = jna2nsc(r_jna)
>>> print(r_nsc)
[1 8 2]
irfpy.joee.frame0.joee2angles(vec)[source]

Convert from vector to JoEE angles.

Angles ar in degrees. \(\theta\) and \(\phi\).

(Below test “+1-1” is just to change -0. to 0. so no meaning.)

>>> print(joee2angles([0, 0, 2]) + 1 - 1)
[ 0.  0.]
>>> print(joee2angles([3, 0, 0]) + 1 - 1)
[ 90.   0.]
>>> print(joee2angles([[3, -2, 0, 0, 0], [0, 0, -1.45, 3, 0], [0, 0, 0, 0, -1]]) + 1 - 1)
[[  90.  -90.    0.    0.    0.]
 [   0.    0.   90.  -90. -180.]]
irfpy.joee.frame0.angles2joee(theta, phi)[source]

From (arrays of) theta and phi, vector(s) in JoEE is returned.

x = sintheta y = -costheta times sinphi z = costheta times cosphi

(Below the test include +1-1 just to change -0.0 to 0.0)

>>> print(angles2joee(0, 0) + 1 - 1)
[ 0.  0.  1.]
>>> print(angles2joee(90, 0) + 1 - 1)
[ 1.  0.  0.]
>>> print(angles2joee(-90, 0) + 1 - 1)
[-1.  0.  0.]
>>> print(angles2joee(0, 90) + 1 - 1)
[ 0. -1.  0.]
>>> print(angles2joee(0, -90) + 1 - 1)
[ 0.  1.  0.]
>>> print(np.round(angles2joee(0, 180), 3) + 1 - 1)
[ 0.  0. -1.]
irfpy.joee.frame0.doctests()[source]