[docs]defeprload(path:str,experiment:str=None,type:str=None,**kwargs):""" A general versions of eprload Parameters ---------- path : str The file path of the data that should be loaded. experiment : str, optional _description_, by default None type : str, optional _description_, by default None Returns ------- xarray.Dataarray _description_ Raises ------ ValueError _description_ RuntimeError _description_ """iftypeisNone:# Use the file ending to guess file type_,file_extension=os.path.splitext(path)if(file_extension==".DSC")|(file_extension==".DTA"):log.debug('File detected as Bruker')type='BRUKER'elif(file_extension==".h5")|(file_extension==".hdf5"):log.debug('File detected as HDF5')type='HDF5'elif(file_extension==".csv")|(file_extension==".txt"):log.debug('File detected as csv or txt file')type='TXT'eliffile_extension=='.mat':log.debug('File detecetd as Matlab')type='MAT'else:log.error("Can't detect file type")raiseValueError("Can't detect file type. Please choose the correct file or"" set type manually \n Valid file types: '.DSC','.DTA','.h5',""'.hdf5','.csv','.txt','.mat'")iftype=='BRUKER':returncreate_dataset_from_bruker(path)eliftype=='TXT':if'full_output'inkwargs:full_output=kwargs['full_output']delkwargs['full_output']iffull_output:print("WARNING: Can't get metadata from text file")data=np.loadtxt(path,*kwargs)returndataeliftype=='MAT':Matfile=loadmat(path,simplify_cells=True,squeeze_me=True)# Params = Matfile[Matfile["expname"]]if"options"inkwargs:opts=kwargs["options"]else:opts={}# if 'ref_echo_2D_idx' not in opts:# opts['ref_echo_2D_idx'] = 'end'# uwb_output = uwb_load(Matfile,opts)uwb_output=uwb_eval_match(Matfile,**kwargs)# axes = uwb_output.dta_x# data = uwb_output.dta_evreturnuwb_outputeliftype=='HDF5':returnxr.load_dataarray(path,engine='h5netcdf',invalid_netcdf=True)