I\'m trying to find an alternate way of writing the following code, since the current function takes a long time. The numpy array eventmatrix is of shape
eventmatrix