irfpy.imacommon.scidata

IMA science data, providing the count rate data access

It is a common part of IMA count rate science data access in the Matlab format.

For nominal use, refer to irfpy.mima.scidata and irfpy.vima.scidata.

irfpy.imacommon.scidata.reshape_mat3d(mat, npol=16)[source]

Reshape the matlab contents into MAEPT order

The function reshapes the matrix to MAEPT order (mass-azimuth-energy-polar-time).

Polar (elevaion) number should be specified, if you know it is not 16 elevation mode.

Returns:

(spectra, masslist, azimlist, polarlist, timelist). spectra has (N, 32, 16, 96, 16) element, where N is the number of 3-D data. masslist, azimlist, polarlist has (N, 2, 16, 96, 16) shape. timelist has (N, 16, 96, 16) shape.

irfpy.imacommon.scidata.reshape_mat(mat)[source]

Reshape the matlab contents into MAET order.

The function reshape the matrix to MAET order.

Parameters:

mat – Matlab contents.

Returns:

(spectra, masslist, azimlist, elevlist, timelist)

Each output has the shape of (32, 16, 96, T) for spectra; (32, 16, T) for timelist; and (2, 32, 16, T) for others. T is the number of time.

Parameters:

mat – Matlab format data file

Returns:

Tuple of array. (spectra, mass, azimuth, polar, time).

irfpy.imacommon.scidata.matfile2timeseries(matrix, emulate_full=False)[source]

Getting the matrix data in Matlab, time series of matrix is returned.

Parameters:
  • matrix – Matlab data (dictionary) read via scipy.io.loadmat(), or using higher-level way, e.g. irfpy.vima.scidata.ImaCountFile

  • emulate_full – Data is emulated to represent the full matrix, namely (M32, A16, E96) size matrix. For mode such as 28, where the original data is (M32, A8, E96) is expanded by assuming the uniform count rate over the bins to the full size.

Returns:

Time series of 2D matrix

Return type:

irfpy.imacommon.imascipac.TimeSeriesCntMatrix2D

This is a function for developer.

>>> from irfpy.vima.scidata import get_ima_count_file_full
>>> import datetime
>>> matlab_data = get_ima_count_file_full(datetime.datetime(2008, 3, 3, 14, 55))
>>> timeseries2d = matfile2timeseries(matlab_data.mat)
irfpy.imacommon.scidata.doctests()[source]