Re: [Numpy-discussion] Possible bug in Numpy.convolve

2017-03-22 Thread Thøger Emil Rivera-Thorsen

OK, this is embarrassing.
I had in fact made the kernel only almost symmetric, it was slightly 
offset to one side.

This caused it. Only a wetware bug.
Sorry for having wasted your time!


On 03/23/2017 03:38 AM, josef.p...@gmail.com wrote:



On Wed, Mar 22, 2017 at 10:06 PM, Thøger Emil Rivera-Thorsen 
> wrote:


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



___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org 
https://mail.scipy.org/mailman/listinfo/numpy-discussion



Can you provide an example to replicate?

I haven't seen this behavior, it looks centered to me, at least for 
odd window length..
AFAIR, I had to try a bit in the past for how to set the window and 
location with even window length.


>>> np.__version__
'1.11.2'

>>> x = np.linspace(-1, 1, 21)
>>> w = stats.norm.pdf(np.linspace(-3, 3, 5))
>>> np.column_stack((x, np.convolve(x, w, mode='same')))[8:13]
array([[ -2.e-01,  -1.33368234e-01],
   [ -1.e-01,  -6.66841169e-02],
   [  0.e+00, 1.51788304e-17],
   [  1.e-01, 6.66841169e-02],
   [  2.e-01, 1.33368234e-01]])


>>> x = np.abs(np.linspace(-1, 1, 21))
>>> w = stats.norm.pdf(np.linspace(-3, 3, 4))
>>> np.column_stack((x, np.convolve(x, w, mode='same')))[8:13]
array([[ 0.2   ,  0.12320129],
   [ 0.1   ,  0.07392077],
   [ 0.,  0.02552663],
   [ 0.1   ,  0.02552663],
   [ 0.2   ,  0.07392077]])


>>> w = stats.norm.pdf(np.linspace(-3, 3, 5))
>>> np.column_stack((x, np.convolve(x, w, mode='same')))[8:13]
array([[ 0.2   ,  0.13336823],
   [ 0.1   ,  0.06757049],
   [ 0.,  0.02767626],
   [ 0.1   ,  0.06757049],
   [ 0.2   ,  0.13336823]])

Josef


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion



___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible bug in Numpy.convolve

2017-03-22 Thread josef . pktd
On Wed, Mar 22, 2017 at 10:06 PM, Thøger Emil Rivera-Thorsen <
thoger.e...@gmail.com> wrote:

> 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
>
>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
Can you provide an example to replicate?

I haven't seen this behavior, it looks centered to me, at least for odd
window length..
AFAIR, I had to try a bit in the past for how to set the window and
location with even window length.

>>> np.__version__
'1.11.2'

>>> x = np.linspace(-1, 1, 21)
>>> w = stats.norm.pdf(np.linspace(-3, 3, 5))
>>> np.column_stack((x, np.convolve(x, w, mode='same')))[8:13]
array([[ -2.e-01,  -1.33368234e-01],
   [ -1.e-01,  -6.66841169e-02],
   [  0.e+00,   1.51788304e-17],
   [  1.e-01,   6.66841169e-02],
   [  2.e-01,   1.33368234e-01]])


>>> x = np.abs(np.linspace(-1, 1, 21))
>>> w = stats.norm.pdf(np.linspace(-3, 3, 4))
>>> np.column_stack((x, np.convolve(x, w, mode='same')))[8:13]
array([[ 0.2   ,  0.12320129],
   [ 0.1   ,  0.07392077],
   [ 0.,  0.02552663],
   [ 0.1   ,  0.02552663],
   [ 0.2   ,  0.07392077]])


>>> w = stats.norm.pdf(np.linspace(-3, 3, 5))
>>> np.column_stack((x, np.convolve(x, w, mode='same')))[8:13]
array([[ 0.2   ,  0.13336823],
   [ 0.1   ,  0.06757049],
   [ 0.,  0.02767626],
   [ 0.1   ,  0.06757049],
   [ 0.2   ,  0.13336823]])

Josef
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Possible bug in Numpy.convolve

2017-03-22 Thread Thøger Emil Rivera-Thorsen

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


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] migration of all scipy.org mailing lists

2017-03-22 Thread Benjamin Root
nabble is the other site that probably should be notified of the mailing
list move.

On Wed, Mar 22, 2017 at 10:11 AM, Nathan Goldbaum 
wrote:

> Are you sure about astropy? They recently moved to google groups.
>
>
> On Wednesday, March 22, 2017, Ralf Gommers  wrote:
>
>> Hi all,
>>
>> The server for the scipy.org mailing list is in very bad shape, so we
>> (led by Didrik Pinte) are planning to complete the migration of active
>> mailing lists to the python.org infrastructure and to decommission the
>> lists than seem dormant/obsolete.
>>
>> The scipy-user mailing list was already moved to python.org a month or
>> two ago, and that migration went smoothly.
>>
>> These are the lists we plan to migrate:
>>
>> astropy
>> ipython-dev
>> ipython-user
>> numpy-discussion
>> numpy-svn
>> scipy-dev
>> scipy-organizers
>> scipy-svn
>>
>> And these we plan to retire:
>>
>> Announce
>> APUG
>> Ipython-tickets
>> Mailman
>> numpy-refactor
>> numpy-refactor-git
>> numpy-tickets
>> Pyxg
>> scipy-tickets
>> NiPy-devel
>>
>> There will be a short period (<24 hours) where messages to the list may
>> be refused, with an informative message as to why. The mailing list address
>> will change from listn...@scipy.org to listn...@python.org
>>
>> This will happen asap, likely within a day or two. So two requests:
>> 1.  If you see any issue with this plan, please reply and keep Didrik and
>> myself on Cc (we are not subscribed to all lists).
>> 2. If you see this message on a numpy/scipy list, but not on another list
>> (could be due to a moderation queue) then please forward this message again
>> to that other list.
>>
>> Thanks,
>> Ralf
>>
>>
>>
>>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] migration of all scipy.org mailing lists

2017-03-22 Thread Nathan Goldbaum
Are you sure about astropy? They recently moved to google groups.

On Wednesday, March 22, 2017, Ralf Gommers  wrote:

> Hi all,
>
> The server for the scipy.org mailing list is in very bad shape, so we
> (led by Didrik Pinte) are planning to complete the migration of active
> mailing lists to the python.org infrastructure and to decommission the
> lists than seem dormant/obsolete.
>
> The scipy-user mailing list was already moved to python.org a month or
> two ago, and that migration went smoothly.
>
> These are the lists we plan to migrate:
>
> astropy
> ipython-dev
> ipython-user
> numpy-discussion
> numpy-svn
> scipy-dev
> scipy-organizers
> scipy-svn
>
> And these we plan to retire:
>
> Announce
> APUG
> Ipython-tickets
> Mailman
> numpy-refactor
> numpy-refactor-git
> numpy-tickets
> Pyxg
> scipy-tickets
> NiPy-devel
>
> There will be a short period (<24 hours) where messages to the list may be
> refused, with an informative message as to why. The mailing list address
> will change from listn...@scipy.org
>  to
> listn...@python.org 
>
> This will happen asap, likely within a day or two. So two requests:
> 1.  If you see any issue with this plan, please reply and keep Didrik and
> myself on Cc (we are not subscribed to all lists).
> 2. If you see this message on a numpy/scipy list, but not on another list
> (could be due to a moderation queue) then please forward this message again
> to that other list.
>
> Thanks,
> Ralf
>
>
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] migration of all scipy.org mailing lists

2017-03-22 Thread Ralf Gommers
On Thu, Mar 23, 2017 at 12:18 AM, Neal Becker  wrote:

> Has anyone taken care of notifying gmane about this?
>

We will have to update this info in quite a few places after the move is
done. Including Gmane, although that site hasn't been working for half a
year so is pretty low on the priority list.

Ralf
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] migration of all scipy.org mailing lists

2017-03-22 Thread Neal Becker
Has anyone taken care of notifying gmane about this?

Ralf Gommers wrote:

> Hi all,
> 
> The server for the scipy.org mailing list is in very bad shape, so we (led
> by Didrik Pinte) are planning to complete the migration of active mailing
> lists to the python.org infrastructure and to decommission the lists than
> seem dormant/obsolete.
> 
> The scipy-user mailing list was already moved to python.org a month or two
> ago, and that migration went smoothly.
> 
> These are the lists we plan to migrate:
> 
> astropy
> ipython-dev
> ipython-user
> numpy-discussion
> numpy-svn
> scipy-dev
> scipy-organizers
> scipy-svn
> 
> And these we plan to retire:
> 
> Announce
> APUG
> Ipython-tickets
> Mailman
> numpy-refactor
> numpy-refactor-git
> numpy-tickets
> Pyxg
> scipy-tickets
> NiPy-devel
> 
> There will be a short period (<24 hours) where messages to the list may be
> refused, with an informative message as to why. The mailing list address
> will change from listn...@scipy.org to listn...@python.org
> 
> This will happen asap, likely within a day or two. So two requests:
> 1.  If you see any issue with this plan, please reply and keep Didrik and
> myself on Cc (we are not subscribed to all lists).
> 2. If you see this message on a numpy/scipy list, but not on another list
> (could be due to a moderation queue) then please forward this message
> again to that other list.
> 
> Thanks,
> Ralf


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] migration of all scipy.org mailing lists

2017-03-22 Thread Ralf Gommers
(and now with Didrik on Cc - apologies)



On Wed, Mar 22, 2017 at 10:23 PM, Ralf Gommers 
wrote:

> Hi all,
>
> The server for the scipy.org mailing list is in very bad shape, so we
> (led by Didrik Pinte) are planning to complete the migration of active
> mailing lists to the python.org infrastructure and to decommission the
> lists than seem dormant/obsolete.
>
> The scipy-user mailing list was already moved to python.org a month or
> two ago, and that migration went smoothly.
>
> These are the lists we plan to migrate:
>
> astropy
> ipython-dev
> ipython-user
> numpy-discussion
> numpy-svn
> scipy-dev
> scipy-organizers
> scipy-svn
>
> And these we plan to retire:
>
> Announce
> APUG
> Ipython-tickets
> Mailman
> numpy-refactor
> numpy-refactor-git
> numpy-tickets
> Pyxg
> scipy-tickets
> NiPy-devel
>
> There will be a short period (<24 hours) where messages to the list may be
> refused, with an informative message as to why. The mailing list address
> will change from listn...@scipy.org to listn...@python.org
>
> This will happen asap, likely within a day or two. So two requests:
> 1.  If you see any issue with this plan, please reply and keep Didrik and
> myself on Cc (we are not subscribed to all lists).
> 2. If you see this message on a numpy/scipy list, but not on another list
> (could be due to a moderation queue) then please forward this message again
> to that other list.
>
> Thanks,
> Ralf
>
>
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] migration of all scipy.org mailing lists

2017-03-22 Thread Ralf Gommers
Hi all,

The server for the scipy.org mailing list is in very bad shape, so we (led
by Didrik Pinte) are planning to complete the migration of active mailing
lists to the python.org infrastructure and to decommission the lists than
seem dormant/obsolete.

The scipy-user mailing list was already moved to python.org a month or two
ago, and that migration went smoothly.

These are the lists we plan to migrate:

astropy
ipython-dev
ipython-user
numpy-discussion
numpy-svn
scipy-dev
scipy-organizers
scipy-svn

And these we plan to retire:

Announce
APUG
Ipython-tickets
Mailman
numpy-refactor
numpy-refactor-git
numpy-tickets
Pyxg
scipy-tickets
NiPy-devel

There will be a short period (<24 hours) where messages to the list may be
refused, with an informative message as to why. The mailing list address
will change from listn...@scipy.org to listn...@python.org

This will happen asap, likely within a day or two. So two requests:
1.  If you see any issue with this plan, please reply and keep Didrik and
myself on Cc (we are not subscribed to all lists).
2. If you see this message on a numpy/scipy list, but not on another list
(could be due to a moderation queue) then please forward this message again
to that other list.

Thanks,
Ralf
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion