A module of MEX/ELS flux.
The flux is dumped from CL, and located at thor:/irf/data/aspera3/els/mat.
I am not sure the CL really implement the ELS calibration properly. So using this module should be careful and your own risk.
Return the database path.
Database of ElS flux can be specified by [mels]/fluxmaturibase in irfpyrc. If no path is found,
The path may include the 4-digit subdirectories expressing the year.
- class irfpy.mels.flux.ElsFluxDatabase(dbpath=None)[source]¶
The ELS flux database folder.
The data base of the ELS flux. First, it searches through the file name ‘elecYYYYMMDDHH.mat’ under the given dbpath. Then, the start time is calculated from the file name, and registered into this database.
dbpath – Path of the database. Default is read by
# First, instance it.
>>> samplepath = os.path.join(os.path.dirname(__file__), 'sample', 'elsflux') >>> db = ElsFluxDatabase(dbpath=samplepath)
# Then, you can check the size of the data base. In the sample/elsflux folder, seven files can be found.
>>> print(len(db)) 7
# To get the file name of the data, you can use
>>> file = db.get(datetime.datetime(2005, 1, 2, 15, 0, 0)) >>> print(os.path.basename(file)) elec2005010200.mat
# In case you want to load the file one before, you can use
>>> file_prev = db.previousof(file) >>> print(os.path.basename(file_prev)) elec2005010100.mat
Initialize the database.
- class irfpy.mels.flux.ElsFluxFile(uri)[source]¶
Load the matlab flux file
uri – The URI or filename of the file.
Return the observation time as array of
>>> sample = ElsFluxFile.get_sample_filename() >>> s = ElsFluxFile(sample) >>> otime = s.getobstime() >>> print(len(otime)) 784
Return the time range stored in this file.
The start time is the time of the first packet. The end time is the time of the last packet. This means that the end time does not agree with the end of the observation time. The end of the observation time is the end time plus data acquisition time (typically 4 sec).
>>> sample = ElsFluxFile.get_sample_filename() >>> s = ElsFluxFile(sample) >>> print(s.gettimerange()) [datetime.datetime(2010, 6, 3, 18, 0, 4), datetime.datetime(2010, 6, 3, 18, 59, 57)]
Return the flux data obtained at t_c.
Note that the time of the returned data, t_r, is generally different from t_c. t_r sastisfies t_r < t_c and (t_r - t_c) is minimum. Sometimes the t_r is very far from t_c, as no error check or data gap check is done. It is the user’s responsible to check whether t_r is acceptable or not. Thus, it is recommended that the t_c is taken from the returned value of
datetime.datetime) – The time of the observation.
A tuple, (t_r, flux). flux should have 16x128 shaped ndarray.
>>> sample = ElsFluxFile.get_sample_filename() >>> s = ElsFluxFile(sample) >>> t_c = s.getobstime() >>> t_r, flux = s.get_data(t_c) >>> t_r == t_c True >>> print('%.5e' % flux.max()) 2.45800e+10