Source code for irfpy.mima.pacc

'''Post acceleration
'''

import irfpy.mexop.imastatus as istat

[docs]def get(t): ''' Return PACC index at t from the operation event file. First call may take time (~20 sec or more) to load the event file, but from the second call, it returns quickly. >>> import datetime >>> import irfpy.mexop.imastatus >>> if not irfpy.mexop.imastatus.isdb(): ... print("No data source is found.") # doctest: +SKIP ... else: ... print(get(datetime.datetime(2006, 12, 3, 8, 0, 0))) 4 ... print get(datetime.datetime(2013, 5, 27, 23, 30, 0)) 7 ... print get(datetime.datetime(2000, 5, 27, 23, 30, 0)) -999 ''' state = istat.get_status(t) pacc = state.pacc try: return int(pacc) except: return -999
import unittest import doctest
[docs]def doctests(): return unittest.TestSuite(( doctest.DocTestSuite(), ))
if __name__ == '__main__': unittest.main(defaultTest='doctests')