Beispiel #1
0
    def __init__(self,name,_parent=None,**settings):
        self.name=name
        
        if _parent is not None:
            self.params=_parent.params
            self.settings=dict(_parent.settings)
            for k,v in settings.items():
                self.settings[k]=v
            self.defaults=_parent.defaults
        else:
            if name.endswith('.py'): name=name[:-3]
            if os.path.exists(name+'.py'):
                lines=open(name+'.py').readlines()
            elif os.path.exists(os.path.join(name,'code.py')):
                lines=open(os.path.join(name,'code.py')).readlines()
            self.params,self.defaults,self.core_code=runner.parse_code(lines)

            self.settings={}
            for k,v in self.defaults.items():
                self.settings[k]=v

        self.param_text=runner.make_param_text(self.params,self.defaults,self.settings)
        self.data=Data('%s/%s'%(self.name,self.param_text))
        
        self.mean=StatisticPopulation(mean,self.data)
        self.mean_sample=StatisticSample(mean,self.data)
        self.sd=StatisticPopulation(std,self.data)
        self.sd_sample=StatisticSample(std,self.data)
        self.median=StatisticPopulation(median,self.data)
        self.median_sample=StatisticSample(median,self.data)
        self.var=StatisticPopulation(var,self.data)
        self.var_sample=StatisticSample(var,self.data)
Beispiel #2
0
def make_setting_name(dir, setting):
    fn = '%s/code.py' % dir
    lines = file(fn).readlines()
    params, defaults, core_code = runner.parse_code(lines)
    return runner.make_param_text(params, defaults, setting)
Beispiel #3
0
def make_setting_name(dir,setting):
    fn='%s/code.py'%dir
    lines=file(fn).readlines()
    params,defaults,core_code=runner.parse_code(lines)
    return runner.make_param_text(params,defaults,setting)