irfpy.jdc.frame0
¶
Frame definition. Draft version.
This is a draft version of the frame definition. Thus, I added “0” in the trail of the module name.
Convert between the JDC0 angles and vectors
The converion of the angles to JDC0 frame is implemented.
See angles2jdc()
and jdc2angles()
.
The definition follows the definition of myself.
Thus, the coordinate system may be chagned in the future.
The definition is consistent to the one defined in fov0
.
The elevation angle, \(\theta\), 0 is the zenith (z axis) and 180 for the nadir looking direction.
The azimutha angle, \(\phi\), 0 is x axis and 90 for y axis.
Angle \(\theta\) and \(\phi\) is the polar coordinate system of the JDC0 frame.
Convert between the JDC0 vectors and NSC vectors
The frame conversion between JDC0 and NSC vectors is also implemented.
See jdc2nsc()
and nsc2jdc()
.
NSC means the nadir looking spacecraft coordinate system defined
at irfpy.pep.pep_attitude
.
The definition is
z-axis: Nadir direction, i.e. spacecraft to the body center.
- y-axis: y-z plane contains the velocity vector. The y-component
of the velocity should have positive.
x-axis: Completes the right hand system.
The JDC0 frame has fixed relation with NSC, as the rigid mount of the sensor. I define as follows for draft frame conversion.
This means that the positive velocity (\(y_{NSC}\)) is in +x in JDC, thus the velocity vector (ram directioN) is in between the CH-0 and CH-15, i.e. \(\phi=0\).
Convert from NSC vectors to physical frame
The conversion is implemented in irfpy.pep.pep_attitude
module.
-
irfpy.jdc.frame0.
angles2jdc
(theta, phi)[source]¶ Return the unit vector as
np.array
object corresponding to the angles.- Parameters
theta (float) – Theta in degrees. Float or (N,) shape np.array.
phi (float) – Phi in degrees. Float or (N,) shape np.array.
- Returns
The corresponding vector with shape of (3,) or (3, N)
- Return type
np.array
>>> print(angles2jdc(0, 0)) [0. 0. 1.]
The following returns the corresponding vector for \((\theta, \phi) = (0, 0), (1, 1), (2, 2), ...\) at once.
>>> print(angles2jdc(np.arange(181), np.arange(181)).shape) (3, 181)
-
irfpy.jdc.frame0.
jdc2angles
(vec)[source]¶ Return the JDC angle for the corresponding JDC vector.
- Parameters
vec (np.array) – np.array, with (3,) or (3, N) shape.
- Returns
Theta and Phi
- Return type
np.array with (2,) or (2, N) shape.
>>> print(jdc2angles([1, 0, 0])) [90. 0.]
For multiple vectors, you can convert to angles. Note that the shape should be (3, N), thus, the array should look like
np.array([[x0, x1, x2, ...], [y0, y1, y2, ...], [z0, z1, z2, ...]])
>>> print(jdc2angles([[1, 10, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]])) [[90. 90. 90. 45.] [ 0. 0. 90. 0.]]
-
irfpy.jdc.frame0.
nsc2jdc
(vecnsc)[source]¶ Convert from NSC to JDC.
vec should be (3,) or (3,N) array.
>>> nsc = [1, 2, -3] >>> print(nsc2jdc(nsc)) [2 1 3] >>> nscs = [[1, 1, 1, 1, 1], [2, 1, 0, -1, 2], [-3, -1, 0, 1, 3]] >>> print(nsc2jdc(nscs)) [[ 2 1 0 -1 2] [ 1 1 1 1 1] [ 3 1 0 -1 -3]]
-
irfpy.jdc.frame0.
jdc2nsc
(vecjdc)[source]¶ Convert from NSC to JDC.
vec should be (3,) or (3,N) array.
>>> jdc = [1, 2, -3] >>> print(jdc2nsc(jdc)) [2 1 3] >>> jdcs = [ [ 2, 1, 0, -1, 2], ... [ 1, 1, 1, 1, 1], ... [ 3, 1, 0, -1, -3]] >>> print(jdc2nsc(jdcs)) [[ 1 1 1 1 1] [ 2 1 0 -1 2] [-3 -1 0 1 3]]