Skip to content
Merged
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
7 changes: 4 additions & 3 deletions src/explorepy/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,11 @@ def _write_edf(self, packet):
self._data = np.concatenate((self._data, data), axis=1)
self._timestamps += list(data[0, :])
with lock:
if self._data.shape[1] > self._fs // 4:
self._file_obj.writeSamples(list(self._data[:, :self._fs]))
num_samples_to_write = (self._data.shape[1] // self._fs) * self._fs
if num_samples_to_write > 0:
self._file_obj.writeSamples(list(self._data[:, :num_samples_to_write]))
self._write_edf_anno()
self._data = self._data[:, self._fs:]
self._data = self._data[:, num_samples_to_write:]

def _process_packet_data(self, packet):
"""Helper function to extract and format data from a packet."""
Expand Down
Loading