def ifeffit(self,cmd): "execute an Ifeffit command or list of ifeffit commands" coms = split(cmd,'\012') ret = 0 for c in coms: if (c != ''): ret = _ifeffit.iff_exec(c) return ret
def __init__(self,screen_echo = 1,use_numeric=1): # this initializes the Ifeffit session try: _ifeffit.iff_exec(' ') except: print " failed to load ifeffit library" sys.exit(1) startup_string = "&screen_echo=%i" % (screen_echo) self.ifeffit(startup_string) self.MAX_ARRAY_PTS = int(self.get_scalar("&maxpts")) self.num_array = None if (use_numeric == 1): try: import Numeric self.num_array = Numeric.array except: self.num_array = None
if (os.name == 'nt'): oskeys = os.environ.keys() defkeys = {'PGPLOT_DEV':'/GW', 'IFEFFIT_DIR':'C:\Program Files\Ifeffit'} for i in defkeys.keys(): if (i in oskeys): u = os.environ[i] v = defkeys[i] else: os.environ[i] = defkeys[i] os.environ['PGPLOT_DIR'] = os.environ['IFEFFIT_DIR'] os.environ['PATH'] = os.environ['PATH'] + ';.;' + os.environ['IFEFFIT_DIR'] try: import _ifeffit _ifeffit.iff_exec(' ') except: print "Cannot load Ifeffit Module -- check path and installation" sys.exit(1) class Ifeffit: """ Ifeffit - Python interface to the IFEFFIT XAFS Analysis library This module provides a simple set of functions to interface with the IFEFFIT XAFS Analysis library. The functions provided are: - ifeffit(cmd): execute an Ifeffit command - put_scalar(name,val): set a python double as an Ifeffit scalar