diff --git a/pyatsoleiloutils/readhdf5file.py b/pyatsoleiloutils/readhdf5file.py new file mode 100644 index 0000000000000000000000000000000000000000..8f3ab7df9f935ec5896583081c5e0da1cf925162 --- /dev/null +++ b/pyatsoleiloutils/readhdf5file.py @@ -0,0 +1,34 @@ +""" +This file contains functions to read preformated data from +hdf5 files +""" + +import h5py +import numpy + +__all__ = ['readmomaphdf5'] + +def readmomaphdf5( + fname + ): + """ + This functions reads a given hdf5 with momentum aperture data + saved with the function savemomaphdf5. + + Args: + fname: name of the input hdf5 file + Returns: + + """ + f = h5py.File('momap_'+listofringnames[i]+'.hdf5', 'r') + + # set momap input format for get_lifetime + momap_pn = numpy.array((f['momap']['dppP'][:], + f['momap']['dppN'][:])) + momap_pn = numpy.copy(momap_pn.T) + s_indexes=f['momap']['s_indexes'][:] + s_array=f['momap']['s_array'][:] + f.close() + + return momap_pn, s_indexes, s_array +