Commit c6a73f3e authored by Leo Pound Singer's avatar Leo Pound Singer

Use Astropy instead of Scipy for Gaussian smoothing

parent 512ae79a
......@@ -9,6 +9,11 @@ Changelog
probable constellations for a localization, for fun and for public outreach
- Switch the implementation of the ``smooth`` option of ``imshow_hpx`` and
``contour_hpx`` from ``scipy.ndimage.gaussian_filter`` to
``astropy.convolution.convolve_fft`` in order to correctly handle points near
the projection boundary where invalid values must be masked out.
0.1.7 (2019-04-24)
......@@ -81,6 +81,7 @@ The following example demonstrates most of the features of this module.
""" # noqa: E501
from astropy.convolution import convolve_fft, Gaussian2DKernel
from astropy.coordinates import SkyCoord
from import Header
from astropy.time import Time
......@@ -96,7 +97,6 @@ from matplotlib.patches import ConnectionPatch, FancyArrowPatch, PathPatch
from matplotlib.projections import projection_registry
import numpy as np
from reproject import reproject_from_healpix
from scipy.ndimage import gaussian_filter
from scipy.optimize import minimize_scalar
from .angle import reference_angle_deg
......@@ -286,7 +286,8 @@ class AutoScaledWCSAxes(WCSAxes):
if smooth is not None:
pixsize = np.mean(np.abs(self.wcs.wcs.cdelt)) * u.deg
smooth = (smooth / pixsize).to(u.dimensionless_unscaled).value
img = gaussian_filter(img, smooth)
kernel = Gaussian2DKernel(smooth)
img = convolve_fft(img, kernel)
return img
def contour_hpx(self, data, hdu_in=None, order='bilinear', nested=False,
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