Skip to content

Commit b3aec16

Browse files
authored
Hotfix bdf recording (#444)
* change depricated function * Flush EDF buffer at quarter-second intervals Reduce the threshold for writing EDF samples from _fs to _fs // 4 so buffered data is flushed more frequently. Previously the FileRecorder only wrote when the buffer exceeded one second of samples; this change triggers writes at roughly quarter-second increments to lower memory usage and latency while retaining the existing behavior of writing full _fs-sized chunks and updating annotations/timestamps under the same lock.
1 parent 8d4d68b commit b3aec16

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/explorepy/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def _write_edf(self, packet):
362362
self._data = np.concatenate((self._data, data), axis=1)
363363
self._timestamps += list(data[0, :])
364364
with lock:
365-
if self._data.shape[1] > self._fs:
365+
if self._data.shape[1] > self._fs // 4:
366366
self._file_obj.writeSamples(list(self._data[:, :self._fs]))
367367
self._write_edf_anno()
368368
self._data = self._data[:, self._fs:]

0 commit comments

Comments
 (0)