Example #1
0
    def __init__(self, argv=sys.argv):
        global par
        if _swig_:
            # c_rsf.sf_init needs 'utf-8' (bytes) not unicode
            c_rsf.sf_init(len(argv), [arg.encode('utf-8') for arg in argv])
            self.prog = c_rsf.sf_getprog()
        else:
            self.pars = _Simtab()
            self.prog = argv[0]

            for arg in argv[1:]:
                if arg[:4] == 'par=':
                    # extract parameters from parameter file
                    parfile = open(arg[4:], 'r')
                    self.pars.input(parfile)
                    parfile.close()
                else:
                    self.pars.put(arg)

        for type in ('int', 'float', 'bool'):
            # create methods int, float, bool
            setattr(self, type, self.__get(type))
            # create methods ints, floats, bools
            setattr(self, type + 's', self.__gets(type))
        par = self
Example #2
0
 def __init__(self, argv=sys.argv):
     c_rsf.sf_init(len(argv), argv)
     self.prog = c_rsf.sf_getprog()
     for type in ('int', 'float', 'bool'):
         setattr(self, type, self.__get(type))
         setattr(self, type + 's', self.__gets(type))
Example #3
0
 def __init__(self,argv=sys.argv):
     c_rsf.sf_init(len(argv),argv)
     self.prog = c_rsf.sf_getprog()
     for type in ('int','float','bool'):
         setattr(self,type,self.__get(type))
         setattr(self,type+'s',self.__gets(type))