-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[MRG] EDF stim_channels #5841
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
[MRG] EDF stim_channels #5841
Conversation
|
After writting the thest I think that and |
Codecov Report
@@ Coverage Diff @@
## master #5841 +/- ##
==========================================
+ Coverage 88.63% 88.64% +0.01%
==========================================
Files 373 373
Lines 69317 69468 +151
Branches 11665 11727 +62
==========================================
+ Hits 61436 61580 +144
- Misses 5030 5038 +8
+ Partials 2851 2850 -1 |
|
I'm -1 on having to supply a list, because at least in my use cases I have only one stim channel. But since we also accept a list, we could resolve this ambiguity by issuing a warning if the user passes |
|
I wouldn't worry about the |
|
eog, misc etc. can be lists so stim_channel could be a list and it would
make explicit the default valid options that get mapped automatically to
stim channels.
|
If we do
Neither |
|
Both work for me. No strong feelings
|
|
I agree that we should treat a string the same way as a list with a single string. But we need to make sure to issue a warning if there is a channel called "auto" in the data. In that case, the only way to specify that channel as the stim channel would be to use its index in the array (i.e. an int), right? |
|
if we allow for list than we can say that ['auto'] works if a channel is
called 'auto' but stim_channel='auto' raises an error to suggest to pass a
list instead. This way everything can be done.
|
|
That's what I was suggesting but @larsoner wanted to have consistent behavior for this case. I'm fine with anything as long as I can provide |
|
I'm fine with the probably-never-happening corner case |
ValueError - The impact of a user parameter is responsible to trigger it.
|
This should be green, and do what we said. At this point, the warning of passing a list of integers |
mne/io/edf/edf.py
Outdated
| # the type of channel it is. | ||
| stim_name_ends_with_annotations = [ch for ch in valid_stim_ch_names | ||
| if ch.endswith('annotations')] | ||
| if len(stim_name_ends_with_annotations): |
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.
When does this evaluate to True? If someone has a channel ending with "annotations"? If so, shouldn't this channel be treated as a stim channel (i.e. set its type to stim and don't synthesize)?
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.
This is true when someone passes 'EDF Annotations' or 'BDF Annotations', in that case the user should take it out from the stim_channel. Therefore the ValueError.
Then, if an annotations channel is present in the file it gets loaded as annotations, and there is no stim channel with such name.
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.
Ah, of course, you are right!
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.
However, this also includes other channels ending with "annotations", which is probably not what we want. I'd exclude only these 2 particular names.
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.
Again, the right thing to do would be to actually get a list of TAL channels when _read_edf_header and raise the error based on that. But at this point, I think that we can do that in a different PR (if we ever get to it).
But sure, we can check for those specific names only.
mne/io/edf/edf.py
Outdated
| if stim_channel == 'auto': | ||
| valid_stim_ch_names = DEFAULT_STIM_CH_NAMES | ||
| if 'auto' in ch_names: | ||
| warn(RuntimeWarning, 'Using `stim_channel=\'auto\'` when auto' |
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.
You could use a raw string here to avoid the backslashes. Also, the comma in the first sentence should be removed, and there should be a period after the last sentence.
|
@cbrnr let me know when you are happy, and I'll take a look and merge |
|
What about passing an int (or a list of ints)? Previously, I liked to do |
|
This raises error. I'll add it
…On Wed, Jan 23, 2019, 09:12 Clemens Brunner ***@***.***> wrote:
What about passing an int (or a list of ints)? Previously, I liked to do
stim_channel=-1, because the stim channel is usually the last one. Does
this work again?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5841 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGt-41Axzsz9NeQZ-1xZ7FSjUifWXDCeks5vGBlmgaJpZM4aGWvf>
.
|
larsoner
left a comment
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.
@cbrnr feel free to merge if you're happy
|
I fixed a pep8 error that was there. The rest of the CI errors in travis are network timeouts when fetching physionet data. |
|
Thanks @massich! |
|
cool thanks @massich can you now backport this? maybe it's a simple as removing the deprecation warning on 0.17 branch and see how what's new needs to be adjusted? thx |
|
This appears to have broken CircleCI: Can you look into it? It seems like there is some bug, and some use case not caught by our tests (only by an example). It should be fixed before backporting in #5861 |
|
@larsoner yes I just saw it as well, what I don't understand is why circle CI was not red. I guess that we don't build the entire documentation. |
This PR allows to use
stim_channelagain when callingmne.io.read_raw_edf.Reference issue
Fixes #5738
What does this implement/fix?
More
Additional information
The test file has been created using this code.
Most probably we want to review all the files we are shipping and modify them to do the testing. Even some of the test files
we are not using them.