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

Avoid multiply the array by a scalar once rather than twice. It makes the...

Avoid multiply the array by a scalar once rather than twice. It makes the computation quite a bit faster.
parent 2f5b3d87
......@@ -302,8 +302,8 @@ def _compute_scaling(model_fluxes, obs_fluxes, obs_errors):
denom = np.zeros(model_fluxes.shape[0])
for i in range(obs_fluxes.size):
if np.isfinite(obs_fluxes[i]):
num += (model_fluxes[:, i] * obs_fluxes[i] /
(obs_errors[i] * obs_errors[i]))
num += model_fluxes[:, i] * (obs_fluxes[i] / (obs_errors[i] *
obs_errors[i]))
denom += np.square(model_fluxes[:, i] / obs_errors[i])
return num/denom
......
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