Skip to content

Commit

Permalink
Merge pull request #424 from astrofrog/no-data-hdu-0
Browse files Browse the repository at this point in the history
Nice error when no data is present in HDU
  • Loading branch information
keflavich authored Sep 28, 2017
2 parents c1f9a99 + c2c7b8f commit da62d16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
0.4.1 (unreleased)
------------------

- Raise a nicer error if no data is present in the default or
selected HDU
(https://github.com/radio-astro-tools/spectral-cube/pull/424)
- Check mask inputs to OneDSpectrum and add mask handling for
OneDSpectrum.spectral_interpolate
(https://github.com/radio-astro-tools/spectral-cube/pull/400)
Expand Down
4 changes: 4 additions & 0 deletions spectral_cube/io/fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ def load_fits_cube(input, hdu=0, meta=None, **kwargs):

data, header, beam_table = read_data_fits(input, hdu=hdu, **kwargs)

if data is None:
raise Exception('No data found in HDU {0}. You can try using the hdu= '
'keyword argument to read data from another HDU.'.format(hdu))

if meta is None:
meta = {}

Expand Down

0 comments on commit da62d16

Please sign in to comment.