Skip to content
Snippets Groups Projects
Commit e34e9d41 authored by BLANCO-GARCIA's avatar BLANCO-GARCIA
Browse files

adding matlab files reading

parent c955e234
No related branches found
No related tags found
No related merge requests found
"""
This file contains functions to read preformated data from
mat files
"""
import scipy
import numpy
__all__ = ['readmomapmat']
def readmomapmat(
fname
):
"""
momap_pn, s_indexes, s_array = readmomapmat(fname)
This functions reads a given .mat with momentum aperture data
Args:
fname: name of the input .mat file
Returns:
momap: positive and negative sides of momentum aperture
s_indexes: indexes where momap was calculated
s_array: s coordinates of s_indexes
first_element_index : returns the first element index
0 (in python), 1 (in matlab)
"""
f = scipy.io.loadmat(fname)
# 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'][:]
first_element_index = f['momap']['first_element_index'][:]
f.close()
return momap_pn, s_indexes, s_array, first_element_index
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment