This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |