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

Fix a crash in the computation of the χ² because previous optimisations had...

Fix a crash in the computation of the χ² because previous optimisations had been been not fully propagated to the case of upper limits.
parent 9abec2e1
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
- Remove a Numpy warning in the computation of the IGM absorption (Médéric Boquien) - Remove a Numpy warning in the computation of the IGM absorption (Médéric Boquien)
- The Herschel passbands only included the filter. Now they include the full throughput of the instrument. Flux differences are expected to be no more than 1%. (Médéric Boquien) - The Herschel passbands only included the filter. Now they include the full throughput of the instrument. Flux differences are expected to be no more than 1%. (Médéric Boquien)
- The `dustatt_powerlaw` module indicated that the Milky Way bump has an amplitude of 3. This is only valid for the `dustatt_calzleit` module. As `dustatt_powerlaw` is normalised to A(V) rather than E(B-V) for `dustatt_calzleit`, the bump is a factor Rv larger. A more reasonable value is now given. (Médéric Boquien) - The `dustatt_powerlaw` module indicated that the Milky Way bump has an amplitude of 3. This is only valid for the `dustatt_calzleit` module. As `dustatt_powerlaw` is normalised to A(V) rather than E(B-V) for `dustatt_calzleit`, the bump is a factor Rv larger. A more reasonable value is now given. (Médéric Boquien)
- The correction of the χ² for the upper limits now properly takes into account earlier changes intended to reduce memory usage and speed up the analysis. This prevents a crash. (Médéric Boquien)
### Optimised ### Optimised
- By default the MKL library created many threads for each for the parallel processes. Not only was this not necessary as a high-level parallelisation already exists, but it generated a strong oversubscription on the CPU and on the RAM. The slowdown was over a factor of ~2 in some cases. Now we mandate KML to use only 1 thread fo each process. (Médéric Boquien & Yannick Roehlly) - By default the MKL library created many threads for each for the parallel processes. Not only was this not necessary as a high-level parallelisation already exists, but it generated a strong oversubscription on the CPU and on the RAM. The slowdown was over a factor of ~2 in some cases. Now we mandate KML to use only 1 thread fo each process. (Médéric Boquien & Yannick Roehlly)
......
...@@ -402,14 +402,11 @@ def compute_chi2(model_fluxes, obs_fluxes, obs_errors, lim_flag): ...@@ -402,14 +402,11 @@ def compute_chi2(model_fluxes, obs_fluxes, obs_errors, lim_flag):
# Some observations may not have flux values in some filter(s), but # Some observations may not have flux values in some filter(s), but
# they can have upper limit(s). # they can have upper limit(s).
if limits == True: if limits == True:
mask_lim = (obs_errors <= 0.) for i, obs_error in enumerate(obs_errors):
chi2 += -2. * np.sum( if obs_error < 0.:
np.log( chi2 += -2. * np.log(np.sqrt(np.pi/2.) * (-obs_errors[i]) * (
np.sqrt(np.pi/2.)*(-obs_errors[mask_lim])*( 1.+erf((obs_fluxes[i] - model_fluxes[i, :]*scaling) /
1.+erf( (np.sqrt(2)*(-obs_errors[i])))))
(obs_fluxes[mask_lim]-model_fluxes[mask_lim, :] *
scaling[:, np.newaxis]) /
(np.sqrt(2)*(-obs_errors[mask_lim]))))), axis=1)
return chi2, scaling return chi2, scaling
......
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