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
ENH, FIX: Make eyelink occular annotations "channel aware", and call blink annotations "BAD" #11746
ENH, FIX: Make eyelink occular annotations "channel aware", and call blink annotations "BAD" #11746
Conversation
- and added a test
To clena up the module with read_raw_eyelink
- This required slight changes to the eyelink tests to account for the new description
- added an example of the ch_names annotation key. and mentioned that blinks are considered bad
Note: Updated change log and updated the eye-tracking tutorials to mention/display the |
mne/io/eyelink/_utils.py
Outdated
token : str | ||
Single element from tokens list. | ||
""" | ||
if isinstance(token, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead let's use convenience functions as much as possible, like
_validate_type(token, (str, 'numeric'), 'token')
Then you can just do your try/except without any type business
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, to clarify, that would be:
try:
_validate_type(token, (str, 'numeric'), 'token')
return True
except ValueError:
return False
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently you raise an error for anything other than str
, then try to convert to float and return True/False based on floatiness. So I guess it should be:
_validate_type(token, str, 'token')
try:
float(token)
except ValueError:
return False
else:
return True
... and as a general follow-up comment, please do look at the coverage after your next commit and take a look at the missed (red) lines and see if there is some way to get them covered. |
I'll pull these down, make the remaining suggested changes, and test locally before pushing back up Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Will do. I may need to add one or 2 more 1-second test files to Also see my other comment about whether it would be worth taking another pass at this function (to see where things can be tightened up), as part of my GSoC. |
Another option if it's feasible -- since these are ASCII files right? -- is to just use mne-python/mne/io/edf/tests/test_edf.py Lines 212 to 225 in 1d776cb
Yes code coverage and using better / more pythonic / more MNE-Pythonic coding practices would definitely fit! Maybe a good thing to do when you're waiting on any slow-to-respond devs to get around to reviewing your code :) |
... so in other words you don't have to spend hours trying to improve coverage here. We can leave it as a longer-term goal on your TODO list somewhere |
Sounds good I can give that a shot!
Ha free time is always short but I I can start a separate branch and pick at it over the next few weeks. For now I'll take a pass and look for some low hanging fruit to increase the coverage. I can open a ticket regarding general improvements for |
@larsoner just a heads up, since all ocular annotations are channel aware now, I will remove the "eye" name from their description (i.e. all blink annotations will be |
- Will check codecov after this commit
…ead_raw_eyelink_annots Merged main into branch. There was a conflict in doc/changes/latest, I resolved by moving my changes update below The added line from the last PR on main (mathieus fix in 11748)
- now that the channel (and thus eye) name is in the ch_names key. - the ocular annots can be uniform (i.e. alwasy BAD_blink, fixation, etc). - These changes required some revisions to the tests
- removed some if-statement to error code, that has never been hit and shouldnt be hit given the way the code is setting up the data structures before the line. - added a test for apply_offsets
Can't replicate the failed test locally, could have be related to pandas development version
M1 failure is unrelated, thanks @scott-huberty ! |
Reference issue
This PR is in reference to the discussion in PR #11740 , see this comment
What does this implement/fix?
annotations
('fixations'
,'saccades'
,'blinks'
) are now channel aware.BAD_
mne.io.eyelink
, I moved them to the_utils.py
file that sits in the same directory.Example: