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

Prevent the model computation worker from returning a view of...

Prevent the model computation worker from returning a view of sed.info.values(). This meant the entire dictionary was actually copied, wasting a lot of memory. Also adopt a usual list rather than a numpy array to store the info in pdf_analysis.
parent 2ecd5914
......@@ -194,10 +194,6 @@ class PdfAnalysis(AnalysisModule):
gbl.model_redshifts[idx_item] = item[2]
gbl.model_info[idx_item] = item[3]
# We transform model_info into an array as it is easier for
# selecting only models are the right redshift
gbl.model_info = np.array(gbl.model_info)
print('Analysing models...')
# Mask the invalid fluxes
......
......@@ -47,7 +47,7 @@ def sed(model_params, changed):
model_variables = np.array([sed.info[name]
for name in gbl.analysed_variables])
redshift = sed.info['redshift']
info = sed.info.values()
info = list(sed.info.values()) # Prevents from returning a view
return model_fluxes, model_variables, redshift, info
......@@ -156,7 +156,7 @@ def analysis(obs):
return (analysed_averages,
analysed_std,
np.array(model_fluxes[best_index, :]), # do NOT remove np.array()
list(gbl.model_info[w][best_index]),
list(gbl.model_info[w[0][best_index]]),
norm_facts[best_index],
chi2_[best_index],
chi2_red[best_index])
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