I have a NumPy array of X * Y elements, represented as a flatted array (arr = np.array(x * y)).
Given the following values:
X = 832
Y = 961
I need to access elements of the array in the following sequence:
arr[0:832:2]
arr[1:832:2]
arr[832:1664:2]
arr[833:1664:2]
...
arr[((Y-1) * X):(X * Y):2]
I'm not sure, mathematically, how to achieve the start and stop for each iteration in a loop.
[start:stop:step], such asarr[1:832:2] = 4.arris a structured array representing a hexagon tessellation.arrhas a shape of(X * Y, )and each element has a shape of(7, 2). I'm iterating over theY(column) range to assign values to the tessellation since each column shares x-axis values.