Commit 3aa04792 authored by Médéric Boquien's avatar Médéric Boquien

The standardisation of error bars must be done on the final estimates, not on...

The standardisation of error bars must be done on the final estimates, not on the estimates for a single block.
parent 50c864ac
......@@ -185,10 +185,8 @@ def analysis(idx, obs):
if variable.endswith('_log'):
variable = variable[:-4]
_ = np.log10
maxstd = lambda mean, std: max(0.02, std)
else:
_ = lambda x: x
maxstd = lambda mean, std: max(0.05 * mean, std)
if variable in gbl_results.bayes.massproportional:
values = _(gbl_models.properties[i, wz] * scaling * corr_dz)
......@@ -197,7 +195,7 @@ def analysis(idx, obs):
mean, std = weighted_param(values, likelihood)
gbl_results.bayes.means[idx, i] = mean
gbl_results.bayes.errors[idx, i] = maxstd(mean, std)
gbl_results.bayes.errors[idx, i] = std
if gbl_models.conf['analysis_params']['save_chi2'] is True:
save_chi2(obs, variable, gbl_models, chi2, values)
best_idx_z = np.nanargmin(chi2)
......
......@@ -66,10 +66,6 @@ class BayesResultsManager(object):
for result in results)):
raise TypeError("A list of BayesResultsManager is required.")
if len(results) == 1:
results[0]._weights = None
return results[0]
means = np.array([result.means for result in results])
errors = np.array([result.errors for result in results])
weights = np.array([result.weights for result in results])[..., None]
......@@ -91,6 +87,14 @@ class BayesResultsManager(object):
(means-merged.means)**2), axis=0) /
sumweights)
for i, variable in enumerate(merged.propertiesnames):
if variable.endswith('_log'):
maxstd = lambda mean, std: max(0.02, std)
else:
maxstd = lambda mean, std: max(0.05 * mean, std)
merged.errors[:, i] = maxstd(merged.means[:, i],
merged.errors[:, i])
return merged
@property
......
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