Skip to content

Commit 7c0e0ca

Browse files
committed
Ephys streamer: Lock-in chunks to samples
1 parent 189840b commit 7c0e0ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

brainbox/io/spikeglx.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,10 @@ def read(self, nsel=slice(0, 10000), csel=slice(None), sync=True):
168168
"""
169169
overload the read function by downloading the necessary chunks
170170
"""
171-
first_chunk = np.maximum(0, np.searchsorted(self.chunks['chunk_bounds'], nsel.start + 0.01 * self.fs) - 1)
172-
last_chunk = np.maximum(0, np.searchsorted(self.chunks['chunk_bounds'], nsel.stop + 0.01 * self.fs) - 2)
171+
first_chunk = np.maximum(0, np.searchsorted(self.chunks['chunk_bounds'], nsel.start) - 1)
172+
last_chunk = np.maximum(0, np.searchsorted(self.chunks['chunk_bounds'], nsel.stop) - 1)
173173
n0 = self.chunks['chunk_bounds'][first_chunk]
174+
_logger.debug(f'Streamer: caching sample {n0}, (t={n0 / self.fs})')
174175
self.cache_folder.mkdir(exist_ok=True, parents=True)
175176
sr = self._download_raw_partial(first_chunk=first_chunk, last_chunk=last_chunk)
176177
data = sr[nsel.start - n0: nsel.stop - n0, csel]

0 commit comments

Comments
 (0)