Commit fca6ab18 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

Rather than fitting again the best model to retrieve the proper scaling, let's...

Rather than fitting again the best model to retrieve the proper scaling, let's keep it. It takes little memory.
parent d9281b94
......@@ -227,6 +227,7 @@ def analysis(idx, obs):
mean, std = weighted_param(values[wlikely], likelihood[wlikely])
best_idx_z = np.nanargmin(chi2)[idx] = chi2[best_idx_z][idx] = scaling[best_idx_z][idx] = (wz.start + best_idx_z*wz.step +
......@@ -272,14 +273,8 @@ def bestfit(oidx, obs):
params[gbl_params.modules.index('redshifting')]['redshift'] = obs.redshift
sed = gbl_warehouse.get_sed(gbl_params.modules, params)
fluxes = np.array([sed.compute_fnu(filt) for filt in gbl_obs.bands])
intprops = np.array([[prop] for prop in gbl_obs.intprops])
extprops = np.array([[prop] for prop in gbl_obs.extprops])
corr_dz = compute_corr_dz(obs.redshift, obs.distance)
_, scaling = compute_chi2(fluxes[:, None], intprops[:, None],
extprops[:, None], obs, corr_dz,
scaling =[oidx]
for band in[band].data[oidx] = sed.compute_fnu(band) * scaling
......@@ -229,6 +229,18 @@ class BestResultsManager(object):
def index(self, index):
self._index = index
def scaling(self):
"""Returns a shared array containing the scaling of the best fit for each
def scaling(self, scaling):
self._scaling = scaling
def merge(results):
"""Merge a list of partial results computed on individual blocks of
......@@ -262,6 +274,7 @@ class BestResultsManager(object):
merged.extprop[prop].data[iobs] = \
merged.chi2[iobs] = results[bestidx].chi2[iobs]
merged.scaling[iobs] = results[bestidx].scaling[iobs]
merged.index[iobs] = results[bestidx].index[iobs]
return merged
Supports Markdown
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