mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 21:08:24 +08:00
Merge pull request #830 from astrofrog/use-astropy
Use Astropy by default instead of PyFITS if possible
This commit is contained in:
@@ -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/>`__
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user