Suppose the data in one axis is 1 2 3 4 5 6 7 8
. The following table shows how the data is extended for each mode (assuming cval=0
):
mode | Ext | Input | Ext
-----------+---------+------------------------+---------
'mirror' | 4 3 2 | 1 2 3 4 5 6 7 8 | 7 6 5
'reflect' | 3 2 1 | 1 2 3 4 5 6 7 8 | 8 7 6
'nearest' | 1 1 1 | 1 2 3 4 5 6 7 8 | 8 8 8
'constant' | 0 0 0 | 1 2 3 4 5 6 7 8 | 0 0 0
'wrap' | 6 7 8 | 1 2 3 4 5 6 7 8 | 1 2 3
For an even window size n
, consider the window of size n+1
, and then don't include the lower and right edges. (The position of the window can be changed by using the origin
argument.)