Commit e7db8695 authored by Leo Pound Singer's avatar Leo Pound Singer
Browse files

Move reproject imports to function level

reproject is not available on some old Linux distributions that
we have to support still.
parent c629eb1f
Pipeline #12931 passed with stage
in 41 minutes and 5 seconds
......@@ -36,7 +36,6 @@ from matplotlib.projections import projection_registry
import numpy as np
from scipy.ndimage import gaussian_filter
import scipy.optimize
from reproject import reproject_from_healpix
from .angle import reference_angle_deg
__all__ = (
......@@ -177,6 +176,10 @@ class AutoScaledWCSAxes(WCSAxes):
def _reproject_hpx(self, data, hdu_in=None, order='bilinear',
nested=False, field=0, smooth=None):
# FIXME: move this to a module-level import once reproject percolates
# into older software distributions
from reproject import reproject_from_healpix
if isinstance(data, np.ndarray):
data = (data, self.header['RADESYS'])
img, mask = reproject_from_healpix(data, self.header, hdu_in=hdu_in,
......
......@@ -32,7 +32,6 @@ try:
except ImportError:
# FIXME: drop this when we can depend on pillow >= 2.5.0
DecompressionBombWarning = RuntimeWarning
from reproject import reproject_interp
__all__ = ('bluemarble', 'blackmarble', 'mellinger', 'reproject_interp_rgb')
......@@ -119,6 +118,10 @@ nightlights = blackmarble
def reproject_interp_rgb(input_data, *args, **kwargs):
# FIXME: move this to a module-level import once reproject percolates into
# older software distributions
from reproject import reproject_interp
data = input_data.data
wcs = WCS(input_data.header).celestial
return np.moveaxis(np.stack([
......
......@@ -10,9 +10,9 @@ import sys
from pkg_resources import require, DistributionNotFound, VersionConflict
try:
from astropy.tests.helper import pytest
require('pytest_mpl')
require(['reproject>=0.3.2', 'pytest_mpl'])
except (ImportError, DistributionNotFound, VersionConflict):
print('these tests require pytest-mpl',
print('these tests require reproject>=0.3.2 and pytest-mpl',
file=sys.stderr)
raise SystemExit(77)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment