Skip to content

Commit

Permalink
Give a nice error if no data is present in the selected HDU
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Sep 14, 2017
1 parent 6d8ef2d commit f14e7ca
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 f14e7ca

Please sign in to comment.