def plotFiles(self, flist): ''' Loads the specified data file(s) and plots them. ''' if len(flist) < 1 or (flist is None): if hasattr(self.pscr, 'obj') and self.pscr.obj is not None and hasattr(self.pscr.obj, "default_waves"): log.debug ("Plotting <pscr:%s>.default_waves" % os.path.basename(self.pscr.cur_file)) self.plotWaves (self.pscr.obj.default_waves) return elif hasattr(self.pscr, 'obj') and self.pscr.obj is not None and hasattr(self.pscr.obj, "default_files"): log.debug ("Plotting <pscr:%s>.default_files" % os.path.basename(self.pscr.cur_file)) flist = [self.pscrRelPath(i) for i in self.pscr.obj.default_files] if len(flist) < 1 or (flist is None): log.debug ("Empty list, nothing to do.") return log.debug ("File list: %s" % str(flist)) data = [] for fname in flist: d = igor.load (fname) d.info.setdefault('name', os.path.basename(str(fname))) d.info.setdefault('tmp', {}) d.info['tmp']['last path'] = str(fname) self.pscr.toolbar.path_ref = str(fname) self.plot.files = list(flist) data.append (d) self.plotWaves (data)
def kwav(self): ''' A dictionary of Wave() objects, using file base names (i.e. the part of the path after the last '/') as keys. It will misbehave if different waves in different directories have the same file name. For this purpose, use *BrowserWindow._wav* instead. ''' return dict({i: igor.load(j) for i,j in self.ksel})
def wav(self): ''' The currently selected waves as a list of Wave() objects. Works correctly for similary named waves in different directories. ''' return [igor.load(i) for i in self.sel]
if (param.output == param.input.name) and param.safe: with NamedTemporaryFile (delete=False) as tmp: tmp.close() igor.wave_write (wav, tmp.name) os.rename (tmp.name, param.output) else: igor.wave_write (wav, param.output) if __name__ == "__main__": p = arpes_opt_parse (sys.argv[1:]) print "Loading:", p.input.name inw = igor.load (p.input) ## perform argument post-processing (i.e. parsing of string ## arguments, unit conversion where necessary). # eax is always defined (default: 0) print " - Energy axis:", p.eax # Ef is always eV if p.Ef is not None: p.Ef = eval(p.Ef) if isinstance(p.Ef, int): p.Ef = inw.dim[p.eax].i2x(eval(p.Ef)) print " - Fermi level is", p.Ef, "eV" # norm-region is 'index' if specified