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)
def make_settings_table(dir): data = [] options = {} fn = '%s/code.py' % dir lines = file(fn).readlines() params, defaults, core_code = runner.parse_code(lines) for name in find_settings(dir): setting = parse_setting_name(name) d = [] for p in params: v = defaults[p] if p in setting: v = setting[p] #v=convert_string_to_value(v) d.append(v) if p not in options: options[p] = [] if v not in options[p]: options[p].append(v) data.append((d, name)) data.sort() return params, data, options, defaults
def make_settings_table(dir): data=[] options={} fn='%s/code.py'%dir lines=file(fn).readlines() params,defaults,core_code=runner.parse_code(lines) for name in find_settings(dir): setting=parse_setting_name(name) d=[] for p in params: v=defaults[p] if p in setting: v=setting[p] #v=convert_string_to_value(v) d.append(v) if p not in options: options[p]=[] if v not in options[p]: options[p].append(v) data.append((d,name)) data.sort() return params,data,options,defaults
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)
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)