Merge pull request #830 from astrofrog/use-astropy

Use Astropy by default instead of PyFITS if possible
This commit is contained in:
Stefan van der Walt
2014-04-23 00:03:05 +02:00
3 changed files with 16 additions and 7 deletions
+2
View File
@@ -50,6 +50,8 @@ functionality is only available with the following installed:
(or <`PIL http://www.pythonware.com/products/pil/>`__)
The ``Pillow`` library (or equivalently ``PIL``) is used for Input/Output.
* `Astropy <http://www.astropy.org>`__ is required to use the FITS io plug-in.
Testing requirements
--------------------
* `Nose <https://nose.readthedocs.org/en/latest/>`__
+7 -4
View File
@@ -3,11 +3,14 @@ __all__ = ['imread', 'imread_collection']
import skimage.io as io
try:
import pyfits
from astropy.io import fits as pyfits
except ImportError:
raise ImportError("PyFITS could not be found. Please refer to\n"
"http://www.stsci.edu/resources/software_hardware/pyfits\n"
"for further instructions.")
try:
import pyfits
except ImportError:
raise ImportError("PyFITS could not be found. Please refer to\n"
"http://www.stsci.edu/resources/software_hardware/pyfits\n"
"for further instructions.")
def imread(fname, dtype=None):
+7 -3
View File
@@ -9,10 +9,14 @@ from skimage import data_dir
pyfits_available = True
try:
import pyfits
from astropy.io import fits as pyfits
except ImportError:
pyfits_available = False
else:
try:
import pyfits
except ImportError:
pyfits_available = False
if pyfits_available:
import skimage.io._plugins.fits_plugin as fplug