Skip to content

Commit

Permalink
Merge pull request #78 from keflavich/is_spectral_cube_base
Browse files Browse the repository at this point in the history
Test for BaseSpectralCube with _is_spectral_cube
  • Loading branch information
keflavich committed Sep 1, 2016
2 parents eb1802b + 8f71b23 commit 43795be
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pvextractor/pvextractor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import print_function

import numpy as np
import warnings

from astropy import units as u
from astropy.extern import six
Expand Down Expand Up @@ -109,7 +110,10 @@ def extract_pv_slice(cube, path, wcs=None, spacing=1.0, order=3,

def _is_spectral_cube(obj):
try:
from spectral_cube import SpectralCube
return isinstance(obj, SpectralCube)
from spectral_cube.spectral_cube import BaseSpectralCube
return isinstance(obj, BaseSpectralCube)
except ImportError:
if 'SpectralCube' in (obj.__class__):
warnings.warn("Object appears to be a SpectralCube, but"
" the spectral_cube module could not be loaded")
return False

0 comments on commit 43795be

Please sign in to comment.