From 56dd1060e1735f8f37eafb3e4bdc2761a04339e7 Mon Sep 17 00:00:00 2001 From: Etienne de Montalivet Date: Fri, 8 Dec 2023 12:15:57 +0100 Subject: [PATCH] fix: handle notes and markers from new header --- micromed_io/in_out.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/micromed_io/in_out.py b/micromed_io/in_out.py index 6664533..a779b84 100644 --- a/micromed_io/in_out.py +++ b/micromed_io/in_out.py @@ -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(