irfpy.swim.SwimSciCount

SwimSciCount module is an implementation for bridging Sadppac.

SwimSciCount module is an implementation for bridging Sadppac. Sadppac is python implementation of libsadppac for packet analysis library for SARA. libsadppac is based on packet structure, therefor, all the available information from the sensor can be obtained. However, for scientific analysis matrix form is more easier than the packet class. Here, I would provide a sequence of routines to handle scientific count data. The source code can be used as well for a sample of using Sadppac module.

>>> print(getBmuUri(939))   
file///path/to/orb_0939/orb_0939.swim
>>> loader=SwimLoader()
>>> t,x=loader.getStartMatrix(939)
>>> print(x.shape)
(885, 16, 16)
class irfpy.swim.SwimSciCount.SwimLoader(rcfile=None)[source]

Bases: object

A factory class to load SWIM data.

The data base is open using ${HOME}/.irfpyrc setting.

USAGE: loader = SwimLoader() data3000=loader.getStartMatrix(3000)

Initialize the loader.

getStartMatrix(orbnr)[source]

Obtain a start counter data matrix of the specified orbit number.

The returne format is same as bmufile2startmatrix. Tuple of (time, startmatx). @retval time Time is N-element array of datetime instances. @retval startmatx Matrix in the start counter, which has the NxE(=16)xD(=16) elements. Here N is the number of data samples. E and D is the energy and directions.

getMassMatrix(orbnr)[source]

Obtain a mass matrix of the specified orbit number.

getObservationTime(orbnr)[source]

Get a tuple of observations time in the format of Julday

irfpy.swim.SwimSciCount.getBmuUri(orbnr, baseuri=None)[source]

Obtain the uriname of the BMU file of SWIM based on the orbit number.

The base URI is obtained from ${HOME}/.irfpyrc file. You must have the file and in [swim] section, bmuobase entry have to specify the correct location. If the irfpyrc has a problem, RuntimeError will be returned.

irfpy.swim.SwimSciCount.bmufile2massmatrix(filename, start=datetime.datetime(1, 1, 1, 0, 0), stop=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999))[source]
irfpy.swim.SwimSciCount.bmufile2startmatrix(filename, start=datetime.datetime(1, 1, 1, 0, 0), stop=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999))[source]

The simplest way of obtaining start matrix.

@param[in] filename Filename @param[in] start Start time of the data to be read. @param[in] stop Stop time of the data to be read. @retval time Time is N-element array of datetime instances. @retval startmatx Matrix in the start counter, which has the NxE(=16)xD(=16) elements. Here N is the number of data samples. E and D is the energy and directions.

irfpy.swim.SwimSciCount.simple_vtk_dumper_trial(time_list, matrix_array, filename='swim_simple_vtk_dump.vtk', start=datetime.datetime(1, 1, 1, 0, 0), end=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999))[source]

A very primitive dump into VTK format.