[SciPy-user] maximum_filter1d size parameter

josef.pktd@gmai... josef.pktd@gmai...
Sun Mar 8 07:29:23 CDT 2009


On Sun, Mar 8, 2009 at 2:22 AM, Rick Giuly <rgiuly@gmail.com> wrote:
> Hello All,
>
> It seems I'm not understanding the "size" parameter for
> maximum_filter1d. The documentation says size is the "length along which
> to calculate 1D maximum"
>
> Starting with this array:
>  >>> a
> array([[1, 2, 3],
>        [4, 1, 1],
>        [1, 6, 7]])
>
>
> Because there are 3 rows in the matrix, it seems to me that with size
> set to 3, the result of the filter would be:
> array([[4, 6, 7],
>        [4, 6, 7],
>        [4, 6, 7]])
>
>
> But the result is this:
>
>  >>> maximum_filter1d(a, 3, axis=0)
> array([[4, 2, 3],
>        [4, 6, 7],
>        [4, 6, 7]])
>
>
> I don't see why.
>
> Any help is appreciated.
>
> -rick

The filter is centered at the current point (keyword order=0), so at
the boundary it uses only the boundary point and the point next to it.
There are different modes (keyword mode), but none of them seem to
deliver what you want.

I tried different mode and order combinations, but it seems changing
the order at the boundaries to use the filter in one direction only is
not possible.

Josef


More information about the SciPy-user mailing list