Let's say I have a positions information in the form a two large 1D arrays X and Y. I want to sample non-uniformly positions from this arrays. I thought I could do this with np.random.choice, but since it only accepts 1D arrays and I can obviously not do
Xsample = np.random.choice(X, n, p)
Ysample = np.random.choice(Y, n, p)
with n number of points in the sample, and p a probability array, since this will sample different points for Xsample and Ysample, I am left with finding a way to obtain the indexes of one sampling. The problem is that there is no guarantee that the numbers in the lists are unique so cannot quite use np.where.
Any thoughts?
Aucun commentaire:
Enregistrer un commentaire