vima_demo.rawcount_2d
ΒΆ
Presents how the VEX/IMA raw counts are retrieved and processed.
""" Presents how the VEX/IMA raw counts are retrieved and processed.
"""
import datetime
from irfpy.vima import scidata_util
# Getting the time series of IMA data
t0 = datetime.datetime(2008, 10, 5, 0, 0, 0)
t1 = datetime.datetime(2008, 10, 6, 0, 0, 0)
timeser2d = scidata_util.getarray2d(t0, t1) # 2-D timeseries object (irfpy.imacommon.imascipac.TimeSeriesCntMatrix2D object)
# Each data (2-D count data object -- irfpy.imacommon.imascipac.CntMatrix2D) can be iterated.
for obstime, data2d in timeser2d:
print(data2d)
# Getting the data at a specific time (2-D count data object -- irfpy.imacommon.imascipac.CntMatrix2D).
time_at_kl12, data_at_kl12 = timeser2d.get(datetime.datetime(2012, 10, 5, 12))
# The information of the data can be displayed.
print(data_at_kl12) # -> <<class 'irfpy.imacommon.imascipac.CntMatrix2D'>@2012-10-05T11:59:59.199330:MOD=24 >>24<<:POL=02/02:CNTmax=11>
# You can get the mode of the observation
mode = data_at_kl12.mode
print(mode) # -> <IMA:Mode-25 (Exm-1) M32/A16/E96/P 8> meaning that the azimuthal direction is 8 bins.
# You can get the polar index at the observation
polar = data_at_kl12.polar
print(polar) # -> [0, 1] meaning that the polar index 0 and 1 added.
# You can get the matrix of the count rate
matrix = data_at_kl12.matrix
print(matrix) # -> A numpy array with (32, 16, 96) shape
# You can get the counts along M=25, A=2 as
print(matrix[25, 2, :]) # => [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
# 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0]