The Voronoi binning example in the tutorial contains the following code:
# First we need to make lists of pixel Coordinates
# note this will be stupid big with large data cubes
# in that case find a smartter way to make these arrays
# ... X is a 1D list of length 150**2
X = []
for x in np.arange(0, cube.shape[2]):
X+=[x]*cube.shape[2]
x = np.array(X)
# ... Y is a 1D list of length 150**2
Y=[]
for y in np.arange(0,cube.shape[1]):
Y+=list(np.arange(0,cube.shape[1]))
y = np.array(Y)
I don't know if finding a smarter way was meant an exercise for the reader, but I certainly think there is a more efficient way provided by numpy to do this.
The Voronoi binning example in the tutorial contains the following code:
I don't know if finding a smarter way was meant an exercise for the reader, but I certainly think there is a more efficient way provided by numpy to do this.
https://heloises.github.io/hoki/Voronoi_binning_of_SED_data.html#Book-keeping---creating-the-pixel-coordinate,-signal-and-noise-arrays
This does the trick:
Can provide PR if you want.