Commit cc75fcb2 authored by Médéric Boquien's avatar Médéric Boquien

Re-enable the analysis of variables in log space.

parent 3349d0ba
......@@ -195,12 +195,12 @@ def analysis(idx, obs):
# likelihood as weight.
for prop in gbl_results.bayes.intmean:
if prop.endswith('_log'):
prop = prop[:-4]
values = gbl_models.intprop[prop[:-4]][wz]
_ = np.log10
else:
values = gbl_models.intprop[prop][wz]
_ = lambda x: x
values = _(gbl_models.intprop[prop][wz])
mean, std = weighted_param(values[wlikely], likelihood)
mean, std = weighted_param(_(values[wlikely]), likelihood)
gbl_results.bayes.intmean[prop][idx] = mean
gbl_results.bayes.interror[prop][idx] = std
if gbl_models.conf['analysis_params']['save_chi2'] is True:
......@@ -208,13 +208,13 @@ def analysis(idx, obs):
for prop in gbl_results.bayes.extmean:
if prop.endswith('_log'):
prop = prop[:-4]
values = gbl_models.extprop[prop[:-4]][wz]
_ = np.log10
else:
values = gbl_models.extprop[prop][wz]
_ = lambda x: x
values = _(gbl_models.extprop[prop][wz])
mean, std = weighted_param(values[wlikely] * scaling_l * corr_dz,
likelihood)
mean, std = weighted_param(_(values[wlikely] * scaling_l * corr_dz),
likelihood)
gbl_results.bayes.extmean[prop][idx] = mean
gbl_results.bayes.exterror[prop][idx] = std
if gbl_models.conf['analysis_params']['save_chi2'] is True:
......
......@@ -31,10 +31,12 @@ class ModelsManager(object):
self.allpropnames, self.allextpropnames = get_info(self)
self.allintpropnames = set(self.allpropnames) - self.allextpropnames
props_nolog = set([prop[:-4] if prop.endswith('log') else prop
for prop in conf['analysis_params']['variables']])
self.intpropnames = (self.allintpropnames & set(obs.intprops) |
self.allintpropnames & set(conf['analysis_params']['variables']))
self.allintpropnames & props_nolog)
self.extpropnames = (self.allextpropnames & set(obs.extprops) |
self.allextpropnames & set(conf['analysis_params']['variables']))
self.allextpropnames & props_nolog)
size = len(params.blocks[iblock])
self.flux = {band: SharedArray(size) for band in obs.bands}
......
......@@ -30,8 +30,12 @@ class BayesResultsManager(object):
def __init__(self, models):
nobs = len(models.obs)
self.propertiesnames = models.allpropnames
extpropnames = models.extpropnames
intpropnames = models.intpropnames
extpropnames = [prop for prop in models.obs.conf['analysis_params']['variables']
if (prop in models.allextpropnames or
prop[:-4] in models.allextpropnames)]
intpropnames = [prop for prop in models.obs.conf['analysis_params']['variables']
if (prop in models.allintpropnames or
prop[:-4] in models.allintpropnames)]
self.nproperties = len(intpropnames) + len(extpropnames)
# Arrays where we store the data related to the models. For memory
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment