Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nice error when no data is present in HDU #424

Merged
merged 1 commit into from
Sep 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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