Hi Josef, I do not need regular spacing of the original data. I only need them to be sorted and that I get it with a previous numpy call. Then the algorithm using the cumsum does the trick without a explicit loop. Armando