Thøger Emil Rivera-Thorsen

2017-03-23 02:06:02 UTC

Dear list;

I am honestly not certain whether this, or the SciPy list, is the

appropriate place to post this; please let me know if I got it wrong.

I am convolving a 1D data set containing a relatively narrow peak, with

a relatively narrow Gaussian kernel, in order to emulate the effect of

atmospheric seeing on astrophysical observations.

I have a 1D data array 45 pixels long, and a Gaussian kernel, and run

np.convolve(data, kernel, mode='same') on the two arrays, the resulting

array's peak is shifted relative to the origin. I have attached a plot

to illustrate.

The original data is shown in blue. When I convolve it with a symmetric

kernel (black), I get an offset resulting peak (magenta). If I flip the

kernel -- even though it is perfectly symmetric -- the resulting curve

is offset in the opposite direction (yellow). However, if I offset the

kernel so it is centered exactly one pixel below the central value, the

output array gets centered correct (red), even if I flip the (now no

longer symmetric) kernel.

This is using Numpy 1.11.3, python 2.7.13, on Anaconda 4.3.0 64-bit on

Ubuntu 16.10

Using astropy.convolution, reproduces the correct red curve, so I can

use that for now, but it seems to me this is either a bug or, if it is

indeed the intended behavior, a word of caution would be merited in the

docstring.

Cheers,

Emil Rivera-Thorsen

I am honestly not certain whether this, or the SciPy list, is the

appropriate place to post this; please let me know if I got it wrong.

I am convolving a 1D data set containing a relatively narrow peak, with

a relatively narrow Gaussian kernel, in order to emulate the effect of

atmospheric seeing on astrophysical observations.

I have a 1D data array 45 pixels long, and a Gaussian kernel, and run

np.convolve(data, kernel, mode='same') on the two arrays, the resulting

array's peak is shifted relative to the origin. I have attached a plot

to illustrate.

The original data is shown in blue. When I convolve it with a symmetric

kernel (black), I get an offset resulting peak (magenta). If I flip the

kernel -- even though it is perfectly symmetric -- the resulting curve

is offset in the opposite direction (yellow). However, if I offset the

kernel so it is centered exactly one pixel below the central value, the

output array gets centered correct (red), even if I flip the (now no

longer symmetric) kernel.

This is using Numpy 1.11.3, python 2.7.13, on Anaconda 4.3.0 64-bit on

Ubuntu 16.10

Using astropy.convolution, reproduces the correct red curve, so I can

use that for now, but it seems to me this is either a bug or, if it is

indeed the intended behavior, a word of caution would be merited in the

docstring.

Cheers,

Emil Rivera-Thorsen