Source add_spectra in case of 0 valid pixels from obj mask
in source.py:extract_spectra(), at line 1811 i had to add the test in case ksel has 0 valid pixels
ksel = (object_mask != 0)
if ksel.sum() == 0:
self._logger.error('object mask has 0 valid pixels')
else:
for tag in nb_tags:
self._logger.info("Extract spectra with tag %s" % (tag))
if self.images[tag].wcs.isEqual(wcsref):
weight = self.images[tag].data.copy()
weight[ksel] -= np.min(weight[ksel])
weight = weight.filled(0)
self.spectra[tag + suffix] = compute_optimal_spectrum(
subcub, object_mask, weight)