Skip to content

Commit 43c6415

Browse files
authored
Merge pull request #1779 from h-mayorquin/add_key_to_neuralynx
Fix, Neuralynx encoding error
2 parents 9d251f0 + f81a7a1 commit 43c6415

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

neo/rawio/neuralynxrawio/nlxheader.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ def _to_bool(txt):
5555
("DspHighCutNumTaps", "", None),
5656
("DspHighCutFilterType", "", None),
5757
("DspDelayCompensation", "", None),
58-
("DspFilterDelay_µs", "", None),
58+
# DspFilterDelay key with flexible µ symbol matching
59+
# Different Neuralynx versions encode the µ (micro) symbol differently:
60+
# - Some files use single-byte encoding (latin-1): DspFilterDelay_µs (raw bytes: \xb5)
61+
# - Other files use UTF-8 encoding: DspFilterDelay_µs (raw bytes: \xc2\xb5)
62+
# When UTF-8 encoded µ (\xc2\xb5) is decoded with latin-1, it becomes "µ"
63+
# This regex matches both variants: "µs" and "µs" but normalizes to "DspFilterDelay_µs"
64+
(r"DspFilterDelay_[Â]?µs", "DspFilterDelay_µs", None),
5965
("DisabledSubChannels", "", None),
6066
("WaveformLength", "", int),
6167
("AlignmentPt", "", None),

neo/test/rawiotest/test_neuralynxrawio.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class TestNeuralynxRawIO(
3131
"neuralynx/Cheetah_v5.6.3/original_data",
3232
"neuralynx/Cheetah_v5.7.4/original_data",
3333
"neuralynx/Cheetah_v6.3.2/incomplete_blocks",
34+
"neuralynx/two_streams_different_header_encoding",
3435
]
3536

3637
def test_scan_ncs_files(self):

0 commit comments

Comments
 (0)