irfpy.cena.cena_mass_time

CENA mass matrix with time-axis information.

cena_mass2 module is the packet base library. Now the cena_mass_time module is prepared to implement the time series data of the mass mode matrix.

irfpy.cena.cena_mass_time.getfullHdeflux(t0, t1, validation=None, mainhv=2750)[source]

Get the time series of the flux between t0 and t1.

Parameters
  • t0 (datetime.datetime) – Time start (inclusive)

  • t1 (datetime.datetime.) – Time end (inclusive)

  • mainhv – Main HV value should be more than this value. Otherwise, ignored.

Returns

A set of (obstime, matrix of the differential flux of H in the unit of #/cm2 eV sr s).

The differential flux matrix has the shape of (16, 7, N) where N is the number of observation time.

See also getfulldata() and irfpy.cena.cena_mass2.getHdefluxE16().

>>> t0 = datetime.datetime(2009, 7, 13, 11, 17)
>>> t1 = datetime.datetime(2009, 7, 13, 11, 17, 10)
>>> timelist, fulldata = getfullHdeflux(t0, t1)
>>> fulldata.shape
(16, 7, 3)

Simple way of averaging.

>>> aveflux = fulldata.mean(2)
>>> print(aveflux[0, 3])
--
>>> print('%.2f' % aveflux[8, 3])
59527.07
>>> print('%.2f %.2f %.2f' % (fulldata[8, 3, 0], fulldata[8, 3, 1], fulldata[8, 3, 2]))
48703.97 64938.62 64938.62
irfpy.cena.cena_mass_time.getfulldata(t0, t1, validation=None, mainhv=2750)[source]

Get the data obtained between t0 and t1.

Parameters
  • t0 (datetime.datetime) – Time start (inclusive)

  • t1 (datetime.datetime.) – Time end (inclusive)

  • mainhv – Main HV value should be more than this value. Otherwise, ignored.

Returns

A set of (obstime, matrix of the counts). Counts are just raw value. But if validation is specified, invalid data is masked.

Return type

A set of (list of datetime with shape of (N, ), numpy.ma.ndarray with shape of (16, 7, 128, N)), where N is the number of observation.

If the data is not found during the time period, RuntimeError will be raised.

>>> t0 = datetime.datetime(2009, 7, 13, 11, 17)
>>> t1 = datetime.datetime(2009, 7, 13, 11, 17, 10)
>>> timelist, fulldata = getfulldata(t0, t1)
>>> fulldata.shape
(16, 7, 128, 3)
>>> print(len(fulldata.compressed()))  # Number of valid data
21504
>>> print(fulldata.sum())    # Total counts.  May change after DB changes.
374.0

The corresponding data was obtained by SV table 2, energy range 0-3 and 12-16 is masked. Check this fact.

>>> print(fulldata[0, 4, 77, 2])
--
>>> len(fulldata[:4, :, :, :].compressed())
0
>>> print(fulldata[14, 6, 27, 0])
--
>>> len(fulldata[12:, :, :, :].compressed())
0

Hydrogen count can be get via summing mass channel 1 to 63. >>> hfulldata = fulldata[:, :, 1:64, :] >>> print(hfulldata.sum()) # H total counts. May change after DB cahnges. 346.0

Examine the validation.

>>> timelist2, fulldata2 = getfulldata(t0, t1, validation=[cm.invalid_mask.high_heavy_mask,
...                     cm.invalid_mask.high_count_mask])
>>> timelist == timelist2
True
>>> fulldata2.shape
(16, 7, 128, 3)
>>> len(fulldata2.compressed())  # Valid bins, smaller than fulldata.
15360
>>> fulldata2.sum()   # Total count valid.  Different from fulldata.sum()
268.0

Examine the HV mask.

>>> t0 = datetime.datetime(2009, 6, 13, 8, 0, 0)
>>> t1 = datetime.datetime(2009, 6, 13, 8, 15, 0)
>>> tlist3, fdata3 = getfulldata(t0, t1, mainhv=0)  # All the data retrieval
>>> print(len(tlist3))
209
>>> print(fdata3.shape)
(16, 7, 128, 209)
>>> tlist4, fdata4 = getfulldata(t0, t1, mainhv=2750)  # Only HV up data.
>>> print(len(tlist4))
183
>>> print(fdata4.shape)
(16, 7, 128, 183)