From 698b077acd3569101203e0a2b22c206493e5ca9d Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Wed, 7 May 2025 12:06:07 -0400 Subject: [PATCH 1/2] test struct.unpack rather than class --- neo/rawio/micromedrawio.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/neo/rawio/micromedrawio.py b/neo/rawio/micromedrawio.py index 7cd30c593..102d0e1cf 100644 --- a/neo/rawio/micromedrawio.py +++ b/neo/rawio/micromedrawio.py @@ -146,8 +146,13 @@ def _parse_header(self): gain = factor offset = -logical_ground * factor - f.seek(8, 1) - (sampling_rate,) = f.read_f("H") + # this skips the filtering info done with the machine + f.seek(8, 1) + + #(sampling_rate,) = f.read_f("H") + # sampling_rate is actually the rate_coefficient which is multipled by the + # Rate_Min which is the sampling_rate + sampling_rate = struct.unpack("H", f.read(struct.calcsize("H"))) sampling_rate *= Rate_Min chan_id = str(c) signal_channels.append( From 0d6dc090297af88777404680d477c932453b5036 Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Wed, 7 May 2025 12:13:58 -0400 Subject: [PATCH 2/2] unpack the unpack --- neo/rawio/micromedrawio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/rawio/micromedrawio.py b/neo/rawio/micromedrawio.py index 102d0e1cf..528935ef1 100644 --- a/neo/rawio/micromedrawio.py +++ b/neo/rawio/micromedrawio.py @@ -148,11 +148,11 @@ def _parse_header(self): # this skips the filtering info done with the machine f.seek(8, 1) - + #(sampling_rate,) = f.read_f("H") # sampling_rate is actually the rate_coefficient which is multipled by the # Rate_Min which is the sampling_rate - sampling_rate = struct.unpack("H", f.read(struct.calcsize("H"))) + sampling_rate = struct.unpack("H", f.read(struct.calcsize("H")))[0] sampling_rate *= Rate_Min chan_id = str(c) signal_channels.append(