Skip to content

Commit

Permalink
fix: handle notes and markers from new header
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne de Montalivet committed Dec 8, 2023
1 parent f6cd84c commit 56dd106
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions micromed_io/in_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ def decode_data_header_packet(self, packet: bytearray) -> None:
self.micromed_header.data_address = self._header["BOData"]
self.micromed_header.recording_date = self._header["start_time"]
self.sfreq = self.micromed_header.min_sampling_rate
# Handle notes
notes_dict = {}
for note_sample, note_val in self._header["notes"]:
if note_sample == 0:
break
notes_dict[note_sample] = note_val.decode("utf-8")
self.micromed_header.notes = notes_dict

# Handle notes
markers_dict = {}
for marker_sample, marker_val in self._header["trigger"]:
if marker_sample == 4294967295 and marker_val == 65535:
break
markers_dict[marker_sample] = str(marker_val)
self.micromed_header.markers = markers_dict

# pylint: disable=too-many-branches,too-many-statements
def decode_data_eeg_packet(
Expand Down

0 comments on commit 56dd106

Please sign in to comment.