Source code for irfpy.vels.fov
""" Field of view of ELS.
This module provides VEX/ELS field of view.
Implementation is based on the information of SPICE Instrumet Kernel, while
this module does not depend on SPICE.
Thus, this module can be used without installing SpiceyPy.
The frame is in the instrument frame ("VEX_ASPERA4_ELS").
Converting to other frames can be done using :mod:`irfpy.vexpvat.vexspice` module.
*Usage example*
>>> from irfpy.vels import fov
>>> simplefov = fov.SimpleFOV()
The view vector of channel 5 (center direction) is obtained as
>>> vv = simplefov.viewvector_elsframe(5) # ELS CH-5, viewing vector in ELS frame.
>>> print('{vv[0]:.3f} {vv[1]:.3f} {vv[2]:.3f}'.format(vv=vv))
0.000 -0.831 0.556
The corresponding velocity vector (centre direction) is obtained as
>>> vv = simplefov.velocityvector_elsframe(5) # ELS CH-5, velocity vector in ELS frame.
>>> print('{vv[0]:.3f} {vv[1]:.3f} {vv[2]:.3f}'.format(vv=vv))
-0.000 0.831 -0.556
If one convert to the other frame, the vexspice module should be used.
>>> from irfpy.vexpvat import vexspice as vs
>>> vs.init()
>>> import datetime
>>> t0 = datetime.datetime(2009, 12, 3, 15, 30)
>>> conv_els2sc = vs.convert_matrix(t0, 'VEX_ASPERA4_ELS', 'VEX_SPACECRAFT')
>>> vv_sc = conv_els2sc.dot(vv) # Apply the frame conversion.
>>> print('{vv[0]:.3f} {vv[1]:.3f} {vv[2]:.3f}'.format(vv=vv_sc))
0.831 0.556 0.000
*Definition of frame*
The ELS FOV is illustrated as (figure from SPICE kernel, "VEX_ASPERA4_V02.TI")::
This diagram illustrates ELS sector layout:
^ +Zels
| S# indicate the sector "#"
V7 | V8 position in the sensor
V6 ....|.... V9 assembly.
.' S15 | S0 `.
V5 .' S14 | S1 `. V10 V# indicate the sector "#"
. S13 | S2 . view direction.
V4 . | . V11
.S12 | S3. For example, for
. o--------------> +Yels Sector "1" the view
.S11 / +Xels S4. direction is the vector
V3 . / . V12 emanating from the
.S10 / S5. aperture center through
V2 . / S6 . V13 the point designated
`. / S8 S7 .' by "V1".
V1/ ......... ' V14
/ V0 V15
V
View direction
of sector "1"
"""
import numpy as _np
[docs]class SimpleFOV:
""" Simple field of view for VEX/ELS.
>>> simplefov = SimpleFOV()
The view vector of channel 5 (center direction) is obtained as
>>> vv = simplefov.viewvector_elsframe(15.5) # ELS CH-15.5, viewing vector in ELS frame.
>>> print('{vv[0]:.3f} {vv[1]:.3f} {vv[2]:.3f}'.format(vv=vv))
0.000 0.000 -1.000
The corresponding velocity vector (centre direction) is obtained as
>>> vv = simplefov.velocityvector_elsframe(15.5) # ELS CH-5, velocity vector in ELS frame.
>>> print('{vv[0]:.3f} {vv[1]:.3f} {vv[2]:.3f}'.format(vv=vv))
-0.000 -0.000 1.000
"""
def __init__(self):
pass
[docs] def viewvector_elsframe(self, ch_nr):
""" Return the viewing vector of the given channel in ELS frame.
:param ch_nr: Channel number
:returns: A viewing vector in ELS frame.
"""
angle = _np.deg2rad(-22.5 * ch_nr - 101.25)
x = 0
y = _np.cos(angle)
z = _np.sin(angle)
return _np.array([x, y, z])
[docs] def velocityvector_elsframe(self, ch_nr):
""" Return the velocity vector of the given channel in ELS frame.
:param ch_nr: Channel number
:returns: A velocity vector in ELS frame.
"""
return -self.viewvector_elsframe(ch_nr)