Ejemplo n.º 1
0
 def getConfig():
     config = configurationWidget()
     file = self.path + "/" + self.filename
     h5file = tables.openFile(file, mode="r")
     config.restoreState(h5file.root._v_attrs.config)
     h5file.close()
     return (config.p)
Ejemplo n.º 2
0
 def getConfig():
     config=configurationWidget()
     file=self.path+"/"+self.filename
     h5file = tables.openFile(file, mode = "r")
     config.restoreState(h5file.root._v_attrs.config) 
     h5file.close()
     return(config.p)
Ejemplo n.º 3
0
    def loadData(self,path=None,files=None): 
        if self.useLocalDrive!=None and self.useLocalDrive!=False:
            if self.useLocalDrive==True: self.useLocalDrive="C"
            path=copyFilesToLocal(path,self.useLocalDrive)
        selectedFiles=[path+"/"+file for file in os.listdir(path) if ".lv" in file]
        if files!=None:  
            if not isinstance(files,(list,tuple)): files=[files]
            selectedFiles=[selectedFiles[i] for i in files]
        if self.filters!=None:
            if not isinstance(self.filters,(list,tuple)): self.filters=[self.filters]
            for f in self.filters:
                selectedFiles=[selectedFiles[i] for i in range(len(selectedFiles)) if f in selectedFiles[i]]
        updated=False 
        progress = ProgressBar(len(selectedFiles))
        i=0
        print("load Data from: "+path)
        progress.run(i)
        config=configurationWidget()   
        for file in selectedFiles:
            if not file in list(self.measurements.keys()):
                h5file = tables.openFile(file, mode = "r")               
                #print '\r', "load Data: "+file.split("\\")[-1], 
                i+=1
                progress.run(i)
                h5file =config.restoreState(h5file,file=file)
                m=SlimMeasurement(config=config.p,path=path)   
                if self.useSpectrum=="TOF":                
                    m.spectrum=h5file.getNode("/spectra", "timeHistogram").read()
                    if self.xRange==None:
                        self.xRange=np.arange(config.p["Spectra","Time Histogram","Time min"],config.p["Spectra","Time Histogram","Time max"],config.p["Spectra","Time Histogram","Time resolution"])
                elif self.useSpectrum=="Energy":
                    m.spectrum=h5file.getNode("/spectra", "energyHistogram").read()            
                    if self.xRange==None:            
                        setting=config.p.param(("DLLParams"))
                        self.xRange=np.arange(-setting["E offset"],m.spectrum.shape[0]*setting["E factor"]-setting["E offset"]-setting["E factor"]/4.,setting["E factor"])
                if checkFileHasGroup(h5file,"keithley"):
                    m.keithley=h5file.getNode("/spectra", "keithley").read()
               

                self.measurements[file]=m
                h5file.close()
                updated=True        
        progress.run(len(selectedFiles))
        if self.sort!=None and self.sort!=False:
            self.sortMeasurements(self.sort)
        if updated: self.dataUpdated.emit() 
        print("") 
Ejemplo n.º 4
0
    def loadData(self, path=None, files=None):
        if self.useLocalDrive != None and self.useLocalDrive != False:
            if self.useLocalDrive == True: self.useLocalDrive = "C"
            path = copyFilesToLocal(path, self.useLocalDrive)
        selectedFiles = [
            path + "/" + file for file in os.listdir(path) if ".lv" in file
        ]
        if files != None:
            if not isinstance(files, (list, tuple)): files = [files]
            selectedFiles = [selectedFiles[i] for i in files]
        if self.filters != None:
            if not isinstance(self.filters, (list, tuple)):
                self.filters = [self.filters]
            for f in self.filters:
                selectedFiles = [
                    selectedFiles[i] for i in range(len(selectedFiles))
                    if f in selectedFiles[i]
                ]
        updated = False
        progress = ProgressBar(len(selectedFiles))
        i = 0
        print("load Data from: " + path)
        progress.run(i)
        config = configurationWidget()
        for file in selectedFiles:
            if not file in list(self.measurements.keys()):
                h5file = tables.openFile(file, mode="r")
                #print '\r', "load Data: "+file.split("\\")[-1],
                i += 1
                progress.run(i)
                h5file = config.restoreState(h5file, file=file)
                m = SlimMeasurement(config=config.p, path=path)
                if self.useSpectrum == "TOF":
                    m.spectrum = h5file.getNode("/spectra",
                                                "timeHistogram").read()
                    if self.xRange == None:
                        self.xRange = np.arange(
                            config.p["Spectra", "Time Histogram", "Time min"],
                            config.p["Spectra", "Time Histogram", "Time max"],
                            config.p["Spectra", "Time Histogram",
                                     "Time resolution"])
                elif self.useSpectrum == "Energy":
                    m.spectrum = h5file.getNode("/spectra",
                                                "energyHistogram").read()
                    if self.xRange == None:
                        setting = config.p.param(("DLLParams"))
                        self.xRange = np.arange(
                            -setting["E offset"],
                            m.spectrum.shape[0] * setting["E factor"] -
                            setting["E offset"] - setting["E factor"] / 4.,
                            setting["E factor"])
                if checkFileHasGroup(h5file, "keithley"):
                    m.keithley = h5file.getNode("/spectra", "keithley").read()

                self.measurements[file] = m
                h5file.close()
                updated = True
        progress.run(len(selectedFiles))
        if self.sort != None and self.sort != False:
            self.sortMeasurements(self.sort)
        if updated: self.dataUpdated.emit()
        print("")