pyhiperta.waveform_indexing.neighbors_only_stencil

pyhiperta.waveform_indexing.neighbors_only_stencil() ndarray[source]

Return the stencil selecting __only the neighbors__ of a pixel in 2D array.

The pixel itself is not included: center element of the stencil is 0.

Notes

The stencil values depend on the way the 1D to 2D conversion is performed. Depending on how the axis are deformed, it could be transposed or reversed. The current implementation does

0 1 1 4

2 3 4 -> 0 3 6

5 6 2 5

so the stencil is 1 where the neighbors are and 0 otherwise (and 0 at the center to exclude current pixel).