Skip to content

Instantly share code, notes, and snippets.

def find_nfold_coincidences(timestamps, channels, nfold = 4, max_coincidence_time_ps = 20e3):
""" Given a list of timestamps, and a list of channels those timestamps
appeared on (both of length N), finds nfold coincidences. Coincidences are
limited to cases where:
(1) There are `nfold` timestamps within a timeframe `max_coincidence_time_ps`
(2) Those timestamps all appear on different channels """
td = np.diff(timestamps)
def line_supercover(Py_ssize_t y0, Py_ssize_t x0, Py_ssize_t y1, Py_ssize_t x1):
cdef int dx = abs(x1-x0)
cdef int dy = abs(y1-y0)
cdef int x = x0
cdef int y = y0
cdef int ii = 0
cdef int n = dx + dy
cdef int err = dx - dy