Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge treatment in convolution when edges are NaN is not consistent #11920

Open
keflavich opened this issue Jul 2, 2021 · 0 comments
Open

Edge treatment in convolution when edges are NaN is not consistent #11920

keflavich opened this issue Jul 2, 2021 · 0 comments

Comments

@keflavich
Copy link
Contributor

from astropy.convolution import convolve, convolve_fft, Gaussian2DKernel
import numpy as np
x = np.ones([100,100], dtype='float') * np.nan
convolve_fft(x, Gaussian2DKernel(2), fill_value=np.nan, boundary='fill')
convolve(x, Gaussian2DKernel(2), fill_value=np.nan, boundary='fill')

The behavior between the above functions is not consistent. convolve returns an image that still includes NaNs even though interpolate_nan is specified, while convolve_fft does not.

The convolve_fft version is naively more intuitive to me, but @adrn showed me a use case where the convolve behavior is (probably) what is desired.

We need to make these consistent and document how to achieve the different outcomes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants