Skip to content

Commit

Permalink
Fixing more NoneType errors
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Nov 20, 2023
1 parent 44ac060 commit a196159
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions py/desispec/spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,20 +698,20 @@ def to_specutils(self):
meta['resolution_data'] = self.resolution_data[band].copy()
try:
meta['extra'] = self.extra[band].copy()
except (KeyError, TypeError):
meta['extra'] = None
except (KeyError, TypeError, AttributeError):
pass
if i == 0:
#
# Only add these to the first item in the list.
#
meta['bands'] = self.bands
meta['fibermap'] = self.fibermap.copy()
meta['exp_fibermap'] = self.exp_fibermap.copy()
meta['desi_meta'] = self.meta.copy()
meta['single'] = self._single
meta['scores'] = self.scores.copy()
meta['scores_comments'] = self.scores_comments.copy()
meta['extra_catalog'] = self.extra_catalog.copy()
for key in ('fibermap', 'exp_fibermap', 'desi_meta',
'scores', 'scores_comments', 'extra_catalog'):
try:
meta[key] = getattr(self, key).copy()
except AttributeError:
pass
sl.append(Spectrum1D(flux=flux, spectral_axis=spectral_axis,
uncertainty=uncertainty, mask=mask, meta=meta))
return sl
Expand Down

0 comments on commit a196159

Please sign in to comment.