[Numpy-discussion] Re: Applying a function on local environments

2024-07-26 Thread Juan Nunez-Iglesias
On Sat, 27 Jul 2024, at 12:02 AM, Robert Kern wrote: > scipy.ndimage.generic_filter() > See also my post on accelerating generic filters with numba: https://ilovesymposia.com/2017/03/15/prettier-lowlevelcalla

[Numpy-discussion] Re: Applying a function on local environments

2024-07-26 Thread Robert Kern
On Fri, Jul 26, 2024 at 8:50 AM wrote: > Dear all, > > my goal would be to apply some function on a local environment of size K x > K x K where K is bigger than 1 and odd. For example, if K = 3, it would be > nice to apply some function "func" on such an environment around each > n-dimensional po

[Numpy-discussion] Re: Applying a function on local environments

2024-07-26 Thread Dom Grigonis
Hello Thomas, It seems that what you are after is application of custom kernels. Similar existing things to look at: * For linear kernels, have a look at `np.correlate` function. * For custom kernels, see `numba` stencils. See: https://numba.pydata.org/numba-doc/latest/user/stencil.html One rea

[Numpy-discussion] Applying a function on local environments

2024-07-26 Thread langthom
Dear all, my goal would be to apply some function on a local environment of size K x K x K where K is bigger than 1 and odd. For example, if K = 3, it would be nice to apply some function "func" on such an environment around each n-dimensional position within the n-dimensional array. So, for K