Source code for irfpy.vels.dnf

""" Access to differential number flux data of VEX/ELS.

Data access by "data center" approach.
"""
import logging as _logging
import numpy as _np

from irfpy.vels import rawdata as _rawdata
from irfpy.vels import scidata as _scidata

from irfpy.vels.bible import flux as _bible_flux
from irfpy.vels import energy as _energy


[docs]class DataCenterFlux128(_rawdata.DataCenterEls): """ Data center for the E128 energy mode. >>> import datetime >>> import irfpy.vels.dnf >>> import numpy as np >>> dc = irfpy.vels.dnf.DataCenterFlux128() >>> t0 = datetime.datetime(2011, 11, 2, 23, 10) >>> d0 = dc.nearest(t0) >>> print(d0[0]) 2011-11-02 23:09:59.122000 >>> print('{:.2e}'.format(np.nanmax(d0[1]))) 2.04e+08 """
[docs] def read_file(self, filename): _logger = _logging.getLogger(__name__) tlist, clist = _rawdata.DataCenterEls.read_file(self, filename) tlist2 = [] clist2 = [] for t, cc in zip(tlist, clist): if not isinstance(cc, _scidata.ElsCountDataE128): _logger.debug("Data for {} is not in E128 mode.".format(t)) continue _logger.debug("data for {} is under processing".format(t)) # Counts is # _logger.debug(cc) c = cc.get_count() ne, nd = c.shape etbl = _energy.get_default_table_128() dlist = _np.arange(nd) dnf = _bible_flux.raw2dnf_np(c, etbl, dlist) tlist2.append(t) clist2.append(dnf) return tlist2, clist2