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

help users avoid a common foot gun of specifying labels with references #56

Open
kleinschmidt opened this issue Sep 7, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@kleinschmidt
Copy link
Member

A common failure mode of creating custom labels is to specify the labels including references (e.g., just copying and pasting the labels seen in the EDF signal headers), whereas match_edf_label passes the EDF label through _normalize_references which extracts and compares the first part (without reference) with the custom label:

initial, normalized_label = _normalize_references(label, canonical_names)
initial == channel_name && return normalized_label

As a concrete example, handling an unusual channel label like 2A-M1 that is known to be left EOG, you might be tempted to use a custom labels spec like

["eog"] => ["left" => ["2a-m1"]]

but this silently fails, sicne the correct specification is

["eog"] => ["left" => ["2a"]]

One way to catch things like this would be to check for whether the channel name is unchanged after passing through _normalize_reference, and raise an error/warning if not. another, trickier approach would be to somehow ALSO handle the "with reference" version so that both "2a" and "2a-m1" would match "2A-M1". but that may introduce subtly breaking changes since we use a greedy approach to matching (return the first thing that matches).

@kleinschmidt kleinschmidt added the enhancement New feature or request label Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant