irfpy.imacommon.imascipac¶
IMA science packet emulation
IMA packet is either 192s or 32s. See also How to handle IMA science data.
32s packet
Not yet supported (since we have not run this mode for nominal operations)
192s packet
192s is the default mode for IMA.
In the usual mode, the energy is swept every 12s over 96 steps.
Then, the deflection is swept, if sweeping mode, over 16 steps.
Thus, each 12s data represent the 2-D data (cone-shaped).
This 2-D data is CntMatrix2D.
- class irfpy.imacommon.imascipac.CntMatrix(t, matrix, mode, mode_data=None, name='unknown', hk=None)[source]¶
Bases:
objectRepresent a single 192s packet with deflection sweeping.
Constructor of count matrix for 192s packet.
- Parameters
t – (
datetime) The start time of the packetmatrix – The matrix in MAEP order. This will be modified by operation.
matrix_data – The matrix in MAEP order, the original matrix. This should be kept for any further operations.
mode – The mode. (
irfpy.imacommon.imamode.Modeobject)mode_data – The mode at observation.
name – The name of the sensor. Default is ‘unknown’.
hk – The
HKobject. Default is HK object with all variables filled by None.
- class irfpy.imacommon.imascipac.TimeSeriesCntMatrix[source]¶
Bases:
irfpy.util.tdict.TimeDictContainer for time series of
CntMatrix.Instance of this class preserves the time series of the
CntMatrixmember. Users do not need to instance any object, but helper functions will generate those objects.This class is an extension from
util:irfpy.util.tdict.TimeDict.
- class irfpy.imacommon.imascipac.CntMatrix2D(t, matrix, polar, mode, mode_data=None, name='unknown', hk=None)[source]¶
Bases:
objectContainer for 2-D slice of IMA science count.
Instance of this class preserves the 2D information of the IMA count data together with some aux data. Users do not need to instance the object. This is mostly used as a member of
TimeSeriesCntMatrix2D.The data is accessed via the attributes:
tfor timematrixfor matrix (counts) innp.ma.masked_array.matrix_datafor matrix (counts) innp.ma.masked_array.polarpolar index (start, stop) inclusive.modemode (irfpy.imacommon.imamode.Modeobject).mode_datafor the original mode (for emulation functionality)namefor the name of the sensorhkforHK, the housekeeping data
IMA science data is obtained “simultaneously” in 2D velocity space, namely energy (velocity) and azimuth. Additionally, mass direction data is appended.
The shape of the matrix depends on the
mode. Two commonly used modes aremode 24andmode 25and the corresponding shapes are the same (M32, A16, E96). The difference is the time resolution and elevation coverage.- For
mode 24, the time resolution is 12sec and elevation coverage is every 1 step.
- For
- For
mode 25, the time resolution is 24sec and elevation coverage is every 2 steps.
- For
Note that the energy direction information is obtained from the sweep of high voltage. Thus, in the reality the obtained data is not “instantly” observed. However, this class assums the observations are done at the time of the start.
- class irfpy.imacommon.imascipac.TimeSeriesCntMatrix2D[source]¶
Bases:
irfpy.util.tdict.TimeDictContainer for time series of
CntMatrix2D.Instance of this class preserves the time series of the
CntMatrix2Dmember. Users do not need to instance any object, but helper functions will generate those objects.This class is an extensin from
util:irfpy.util.tdict.TimeDict.
- irfpy.imacommon.imascipac.timeseries2d_to_energytime_simple(timeser2d, azim=None)[source]¶
Convert
TimeSeriesCntMatrix2Dobject to (96, N_t) matrix.- Parameters
timeser2d –
TimeSeriesCntMatrix2Dobjectazim – Azimuthal angle to be accounted. A list/tuple of the number should be given. For example,
(1,)will give the azimuth channel 1 only.(0, 4, 7, 9)will give the azimuth channels 0, 4, 7, and 9 (although this is non-sense for physics point of view). If None is given, all the channels are used.
- Returns
Simply add over the mass and the azimuth, and returns (96, N_t) shaped matrix.
- irfpy.imacommon.imascipac.timeseries2d_to_energytime_max(timeser2d, azim=None)[source]¶
Convert
TimeSeriesCntMatrix2Dobject to (96, N_t) matrix.- Parameters
timeser2d –
TimeSeriesCntMatrix2Dobjectazim – Azimuthal angle to be accounted. A list/tuple of the number should be given. For example,
(1,)will give the azimuth channel 1 only.(0, 4, 7, 9)will give the azimuth channels 0, 4, 7, and 9 (although this is non-sense for physics point of view). If None is given, all the channels are used.
- Returns
Simply take the maximum of the azimuth channle, after the sum over the mass index, and returns (96, N_t) shaped matrix.
- irfpy.imacommon.imascipac.convert2to3(timeser_cntmat2d, emulate_full=False)[source]¶
Convert 2D time series to 3D.
- Parameters
timeser_cntmat2d –
TimeSeriesCntMatrix2Dobject- Keywrod emulate_full
Data is emulated to represent the full matrix, namely (M32, A16, E96, P16) size matrix. To use this functionality, the 2D object should be full size, or emulated full size (i.e. the shape should be (M32, A16, E96)). For mode such as 28, where the original data is (M32, A8, E96) is not accepted. It should be the mode 27 (using emulation functionality) where (M32, A16, E96) sized 2D object is available. For mode 27, the original shape of (M32, A16, E96, P2) will be expanded to (M32, A16, E96, P16) with each value 1/8.
- Returns
TimeSeriesCntMatrixobject
The first and last data could contain a partial data, unless the first data of 2D array is synchronized to the start of the measurement (i.e. polar[0] == 0).
- class irfpy.imacommon.imascipac.HK[source]¶
Bases:
objectRepresents HK data embedded in science data.
HK data is stored. This is very primitive class and the user can directly access the variable from the attirbutes.
modeThe modepacclevelPAC levelpromsection(EE)PROM sectionfifofillFIFO fillMore. TBC
Note
This is for embedded HK data. For real HK data, also stored in
fulldataset has not yet been implemented. This is obtained in different time than the science data packet.