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

Quicklook: Do something (not something smart) if there are unmatched celestial axes #140

Merged
Merged
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
19 changes: 13 additions & 6 deletions spectral_cube/spectral_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,20 @@ def quicklook(self):
"""
Use aplpy to make a quick-look image of the projection. This will make
the `FITSFigure` attribute available.
"""
if not hasattr(self, 'FITSFigure'):
import aplpy
self.FITSFigure = aplpy.FITSFigure(self.hdu)

self.FITSFigure.show_grayscale()
self.FITSFigure.add_colorbar()
If there are unmatched celestial axes, this will instead show an image
without axis labels.
"""
try:
if not hasattr(self, 'FITSFigure'):
import aplpy
self.FITSFigure = aplpy.FITSFigure(self.hdu)

self.FITSFigure.show_grayscale()
self.FITSFigure.add_colorbar()
except wcs.InconsistentAxisTypesError:
from matplotlib import pyplot
self.figure = pyplot.imshow(self.value)

# A slice is just like a projection in every way
class Slice(Projection):
Expand Down