Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow _ to separate signal and sensor spec in labels #71

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/import_edf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function match_edf_label(label, signal_names, channel_name, canonical_names)
# - if the signal name itself contains whitespace or one of `",[]"`, it
# will not match. the fix for this is to preprocess signal headers before
# `plan_edf_to_onda_samples` to normalize known instances (after reviewing the plan)
m = match(r"[\s\[,\]]*(?<signal>.+?)[\s,\]]*\s+(?<spec>.+)"i, label)
m = match(r"[\s\[,\]]*(?<signal>.+?)[\s,\]]*[\s_]+(?<spec>.+)"i, label)
if !isnothing(m) && m[:signal] in signal_names
label = m[:spec]
end
Expand Down
2 changes: 2 additions & 0 deletions test/signal_labels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
@test name == "avr" ? x == "avr" : x == nothing
end
end
# #70
@test OndaEDF.match_edf_label("EEG_C3-A2", signal_names, "c3", canonical_names) == "c3-a2"
@test OndaEDF.export_edf_label("eeg", "t4") == "EEG T4-Ref"
@test OndaEDF.export_edf_label("eeg", "t4-a1") == "EEG T4-A1"
@test OndaEDF.export_edf_label("emg", "lat") == "EMG LAT"
Expand Down