Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions suite2p/classification/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ def _get_logp(self, stats):
x[x < self.grid[0, n]] = self.grid[0, n]
x[x > self.grid[-1, n]] = self.grid[-1, n]
x[np.isnan(x)] = self.grid[0, n]
# np.digitize(..., right=True) returns 0 for x == grid[0], which after
# the -1 would index the *last* bin; clip so values at (or clamped to)
# the minimum use the first bin and values at the maximum the last.
ibin = np.digitize(x, self.grid[:, n], right=True) - 1
ibin = np.clip(ibin, 0, self.p.shape[0] - 1)
logp[:, n] = np.log(self.p[ibin, n] + 1e-6) - np.log(1 - self.p[ibin, n] +
1e-6)
return logp
Expand Down