-
Notifications
You must be signed in to change notification settings - Fork 14
Description
I would like the possibility to calculate a permutation of 2D and 3D objects (possibly images, or 1D spatiotemporal systems in the 2D case, and 2D spatiotemporal systems or volumes in the 3D case).
An example for the 2D version is given in Ribero et al. (2012), and a 3D version is described in Schlemmer et al. (2018). Essentially, you take a subarray out of the original array, flatten it and calculate the permutation index of the resulting pattern.
But I would like to have this method in a much more generic way than it is presented in the papers above, where any "stencil shape" can be used, not just rectangles (2D) or the "tripod" in the 3D case. This can be realized by allowing the user to give a boolean array to the function. Example:
stencil = [0 1 0;
1 1 1;
0 1 0]
applied to matrix (image)
[ 1 2 3 4 5;
6 7 8 9 10;
11 12 13 14 15;
16 17 18 19 20;
21 22 23 24 25]
would result in (overlapping) patterns
[2 6 7 8 12]
[3 7 8 9 13]
...
that can then be translated into permutation indices, from which a distribution can be estimated, from which a permutation entropy can be calculated.
One could also (but imo does not necessarily need) to implement the option to pass a 2D (3D) lag and length instead of a stencil to easily get rectangular shaped stencils, similar to what's already described in the Ribero paper and implemented in the ordpy library.