Tutorial: ELS counts¶
Problem 1¶
I want to get VEX/ELS count data between 2007-10-05T01:30:00 to 2007-10-05T01:50:00.
Answer 1¶
A recommended way is to use a data center as
>>> import datetime
>>> t0 = datetime.datetime(2007, 10, 5, 1, 30)
>>> t1 = datetime.datetime(2007, 10, 5, 1, 50)
>>> import irfpy.vels.rawdata
>>> dc = irfpy.vels.rawdata.DataCenterEls()
>>> tlist, elsmatrix = dc.get_array(t0, t1)
Here tlist
includes the list of the (start) time, and elsmatrix
contains a list of numpy array.
>>> print(tlist)
[datetime.datetime(2007, 10, 5, 1, 30, 3, 690002)
datetime.datetime(2007, 10, 5, 1, 30, 7, 690000)
datetime.datetime(2007, 10, 5, 1, 30, 16, 129001)
...
datetime.datetime(2007, 10, 5, 1, 49, 53, 538999)
datetime.datetime(2007, 10, 5, 1, 49, 57, 538998)]
>>> print(len(tlist))
261
>>> print(len(elsmatrix))
261
>>> elsmatrix = np.array(elsmatrix) # One can convert to the numpy array
>>> print(elsmatrix.shape) # The array has a shape of (ndata=261, energy=128, dir=16)
(261, 128, 16)
Answer 1 (alternative, no more supported way)¶
The function irfpy.vels.scidata.get_counts()
will provide the ELS data.
>>> import irfpy.vels.scidata as velsdata
>>> import datetime
>>> t0 = datetime.datetime(2007, 10, 5, 1, 30)
>>> t1 = datetime.datetime(2007, 10, 5, 1, 50)
>>> tlist, elsmatrix = velsdata.get_counts(t0, t1)
The returned is a tuple, with the list of the start time and the matrix.
>>> print(tlist)
[datetime.datetime(2007, 10, 5, 1, 30, 3, 690002)
datetime.datetime(2007, 10, 5, 1, 30, 7, 690000)
datetime.datetime(2007, 10, 5, 1, 30, 16, 129001)
datetime.datetime(2007, 10, 5, 1, 30, 20, 128999)
...
datetime.datetime(2007, 10, 5, 1, 49, 49, 539001)
datetime.datetime(2007, 10, 5, 1, 49, 53, 538999)
datetime.datetime(2007, 10, 5, 1, 49, 57, 538998)]
>>> print(len(tlist))
261
>>> print(elsmatrix)
[[[ 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. 0. ..., 2. 1. 0.]
...,
[ 0. 1. 0. ..., 21. 20. 16.]
[ 0. 0. 0. ..., 17. 15. 16.]
[ 0. 0. 0. ..., 2. 2. 5.]]]
>>> print(elsmatrix.shape)
(128, 16, 261)
During the given 20 minutes, ELS produced 261 spectra (here one spectrum is corresponding to a matrix with (E=128, S=16) shape).
Each matrix has (E=128, S=16) shape, so
that the full matrix has a shape of (128, 16, 261).
The time observed can be referred to by tlist
.
Warning
Note the order of the matrix is different from the recommended way.
Problem 2¶
I want to get MEX/ELS count data between 2007-10-20T07:30:00 to 2007-10-20T07:45:00.
Answer 2 (recommended)¶
How do you do? Let’s exercise referring to the Anwer 1 ;)
Answer 2 (alternative, non-supported way)¶
Almost identical call to VEX/ELS, but one can use irfpy.mels.scidata.get_counts()
.
>>> import irfpy.mels.scidata as melsdata
>>> import datetime
>>> t0 = datetime.datetime(2007, 10, 20, 7, 30)
>>> t1 = datetime.datetime(2007, 10, 20, 7, 45)
>>> tlist, elsmatrix = melsdata.get_counts(t0, t1)
Check by yourself that the tilst
has 197 elements, and elsmatrix
is
an array with a shape of (128, 16, 197)
.
Exercise¶
What is the maximum count rate recorded by MEX/ELS for the time period between 2007-10-08T11:00:00 and 2007-10-08T14:00:00?
How many energy and sector bins are recorded by zero counts for the time period between 2007-10-25T00:00:00 and 2007-10-25T01:00:00?