-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Preload subset of channels or channel types from raw.fif #1766
Comments
There is now a simple preload_data function in master. Whatever you do, I'm I suspect that adding these options will make things quite a bit more If we do go this route, you'll probably have to make a ton of tests to make |
something along these lines: raw = mne.io.Raw(...) ? but currently you cannot pick_channels on non-preloaded data.... |
The API I'm proposing is more like this:
And the raw data fetching functions, and all functions that use You're right that doing |
I like what you suggest. +1 for picks argument in preload_data |
Ah... This is more complex than I imagined.. I just learnt about raw.preload_data()... +1 for picks arg in preload_data().. Is it Ok that the raw object would be left with a sort of out-dated info? |
No -- the idea is that the info would still be correct, as all channels would still be present. But doing this would only load the selected data from disk into memory:
So that this operation would be immediate:
And things like filtering only the EEG channels would work. But operations like this would still be permitted:
This would thus read from disk, instead of memory. And filtering the MEG channels would not be permitted, at least not until someone did this:
Which would cause the MEG data to also be preloaded (kind of like an append operation). Eventually we could add a |
Got it! So if the |
I'm sure that would be part of it, but the overall job would be much more complex. You'd probably need to, at a minimum:
There are probably other things, but this is what comes to mind when I think about how I'd implement it. |
let's keep it simple: preload_data can only be called once and everything |
Do we really need this? If so please keep it as simple as possible.
|
@agramfort, @dengemann: So you would suggest the
workflow? |
@haribharadwaj we could make our pick/drop_channels function make return self I'm also fine with only allowing to call preload_data onece and add a picks etc argument. |
I would do: raw = mne.io.Raw(...) and no later possibility to load other channels |
FWIW I don't think the possibility of later loading channels is the really challenging part of the coding. Most of the challenge lies in keeping track of which channels are preloaded and which are not, and triaging behavior appropriately. Adding more channels to preload later is pretty trivial by comparison (append/mix matrices, and extend list of loaded channels)... |
doable but it's more work. You'd need to have raw._data maybe as a list of |
As a user I wouldn't expect the function |
+1 let's add one basic version now. it's a rare usecase anyways, I suppose
|
I would say as long as it's documented and error message are clear |
I see how it would be simpler from an implementation/developer perspective, but I don't think it makes sense from an API/user perspective. To me, channel picking/restricting should be done by Maybe it's not so difficult to have |
I agree with hari that chaining would be maximum clean and self-documenting It's already supported as is I think, so nothing to add. just make sure that the pick/drop methods return self if copy=False --- if not a minimum change
|
I'll review the PR :) |
@dengemann IIUC the challenge with this approach is that |
In any case, @haribharadwaj feel free to take a stab at it. If you're too busy I'll try to find time this week or next. |
Thanks all.. |
but we could change that policy. I don't remember the exact reaosons why we introduced that in the first place. If data are not preloaded it would amount to picking the info and some attributes. |
simplicity was the reason. |
no there was another reason .... I remember havin opened an issue once / added this constraint. |
@haribharadwaj do you still need this, or were there suitable workarounds? |
I think most of these use cases can (hopefully) be solved by doing allowing |
+1
…On 28 February 2017 at 19:26, Eric Larson ***@***.***> wrote:
I think most of these use cases can (hopefully) be solved by doing
allowing pick_channels without data being loaded. @jaeilepp
<https://github.com/jaeilepp> did something similar for EDF or some other
reader recently, so hopefully it can be generalized.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1766 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEp7DHM2bR23NaaumNt9tq89hvFtul-_ks5rhLtBgaJpZM4DYaS3>
.
|
I have simultaneous MEG/EEG data sampled at 5 kHz (because I'm also recording brainstem activity) and it would nice to be able to preload say only EEG or only subsets of channels etc. and do analysis/eye-balling.. There are probably other good use cases for this too..
I can see this being possible quickly in a few different ways:
(1) Add kwargs like eeg=True, meg=False etc. to pick only certain channel types..
(2) Take channel names (as opposed to indices) list for a pickNames argument..
(3) Add a regular picks argument and then the user does two steps... (i) load with preload=False and determine picks from the info and then (ii) re-run the file read with preload=True and picks=picks
Thoughts?
The text was updated successfully, but these errors were encountered: