Commit c8204b03 authored by Médéric Boquien's avatar Médéric Boquien

Ensure that we do not try to fit bands that have an error bar of 0 mJy. We now...

Ensure that we do not try to fit bands that have an error bar of 0 mJy. We now simply discard such bands.
parent 57753ee7
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
- When using the `parameters\_file` option, the list of modules is read from `sed\_modules` rather than being inferred from the input file. (Médéric Boquien) - When using the `parameters\_file` option, the list of modules is read from `sed\_modules` rather than being inferred from the input file. (Médéric Boquien)
- The computation of the upper limits would only work for the first few models, reverting back to regular fits for the others. (Médéric Boquien) - The computation of the upper limits would only work for the first few models, reverting back to regular fits for the others. (Médéric Boquien)
- A more explicit message is now given when the flux table cannot be read properly. (Médéric Boquien) - A more explicit message is now given when the flux table cannot be read properly. (Médéric Boquien)
- Make sure that we do not try to fit data that have an error bar of 0 mJy. (Médéric Boquien)
### Optimised ### Optimised
- The cache architecture has been simplified, making it somewhat faster. It speeds up the model generation by ~1%. (Médéric Boquien) - The cache architecture has been simplified, making it somewhat faster. It speeds up the model generation by ~1%. (Médéric Boquien)
......
...@@ -148,7 +148,7 @@ def _compute_scaling(model_fluxes, obs_fluxes, obs_errors): ...@@ -148,7 +148,7 @@ def _compute_scaling(model_fluxes, obs_fluxes, obs_errors):
num = np.zeros(model_fluxes.shape[1]) num = np.zeros(model_fluxes.shape[1])
denom = np.zeros(model_fluxes.shape[1]) denom = np.zeros(model_fluxes.shape[1])
for i in range(obs_fluxes.size): for i in range(obs_fluxes.size):
if np.isfinite(obs_fluxes[i]): if np.isfinite(obs_fluxes[i]) and obs_errors[i] > 0.:
num += model_fluxes[i, :] * (obs_fluxes[i] / (obs_errors[i] * num += model_fluxes[i, :] * (obs_fluxes[i] / (obs_errors[i] *
obs_errors[i])) obs_errors[i]))
denom += np.square(model_fluxes[i, :] * (1./obs_errors[i])) denom += np.square(model_fluxes[i, :] * (1./obs_errors[i]))
......
...@@ -143,7 +143,10 @@ class ObservationsManagerPassbands(object): ...@@ -143,7 +143,10 @@ class ObservationsManagerPassbands(object):
(self.table[banderr] < threshold)) (self.table[banderr] < threshold))
self.table[band][w] = np.nan self.table[band][w] = np.nan
if upperlimits is False: if upperlimits is False:
w = np.where(self.table[banderr] < 0.) w = np.where(self.table[banderr] <= 0.)
self.table[band][w] = np.nan
else:
w = np.where(self.table[banderr] == 0.)
self.table[band][w] = np.nan self.table[band][w] = np.nan
if np.all(~np.isfinite(self.table[band])): if np.all(~np.isfinite(self.table[band])):
allinvalid.append(band) allinvalid.append(band)
......
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