Closed cbrnr closed 7 years ago
So why not add a field to the info structure?
we'll have to see how to serialize this info when saving data as the writing of the info is quite rigid.
@wmvanvliet @jona-sassenhagen presently there is no way to recover what channel was used for referencing?
Another thing came to my mind. Instead of changing raw.set_eeg_reference
as discussed above, why don't we create a new method raw.create_projection
(or something like that) to create an average reference projection? This way, set_eeg_reference
would always apply any re-referencing and there's no need for a new projection
argument. On the other hand, create_projection
would always create a projection for average reference which can be used in the inverse modeling. What do you think?
create_projection is not explicit
there are different mne functions that output projections
how do you educate a user who wants to use average ref + then inverse modelling?
when thinking about API, I step into the shoes of someone who needs to make/write a tutorial. That's when you write an example or the doc of your software that you realise that what you propose is not clear or too complicated.
there are different mne functions that output projections
Why don't we use an existing function to create an average projection then?
how do you educate a user who wants to use average ref + then inverse modelling?
It's done automatically in the modeling. How do you tell EEG users how to set average reference? Same problem here.
when thinking about API, I step into the shoes of someone who needs to make/write a tutorial. That's when you write an example or the doc of your software that you realise that what you propose is not clear or too complicated.
Right now re-referencing is too complicated because projections are involved. If you think the proposed projection
argument is less confusing then let's go for that instead. If the defaults are set accordingly (so projection=False
), then everything is fine for EEG people, but you still need to educate inverse modeling people that they need to set projection=True
.
Anyway, this was just an idea, I'm happy about any improvement to re-referencing.
I don't have time to structure the ideas here sorry.
We need someone to take the lead on this by:
OK, so why the need to overload the set_eeg_reference
function with this projection then?
because we wanted to write "use the set_eeg_reference
function to set the desired EEG reference". So, remind me again what the big problem is with the function as it is now?
Is it that an average reference is not applied directly but instead is added as a projection? Having it as a projection actually makes a lot of sense, but we need to have better documentation for it.
Why does it make sense? Well, to do an average reference properly, it is vital that bad channels are properly marked, otherwise all your channels are corrupted. Whenever you use an average reference, it is very important to check the result. A good way to do this is to put the projections in "delayed" mode, so when plotting the evoked potential, you can turn the average reference projection on and off, see the effect of the reference, and verify it behaves properly.
An upcoming tutorial on referencing should do the above, instead of immediately applying the average reference projection without checking.
because we wanted to write "use the set_eeg_reference function to set the desired EEG reference". So, remind me again what the big problem is with the function as it is now?
Is it that an average reference is not applied directly but instead is added as a projection?
Yes.
Having it as a projection actually makes a lot of sense, but we need to have better documentation for it.
Why does it make sense? [...]
True, but a projection is not necessary to do this. If you immediately apply the average reference, but you add the previous reference channels to the data before you apply it, then you can also undo the average referencing. Bad channels can also be excluded.
I think the main problem with the current behavior is that most EEG people have no idea what an SSP projection is, and - this is the real problem - that the average reference projection is not automatically applied. When I say set_eeg_reference
I expect that I actually set the reference. I agree that adding a projection=False
argument to set_eeg_reference
more or less solves this problem once the default is False
.
@cbrnr I also don't get what is the remaining problem here: default of projection=False
is what Eric suggested (but this will need a deprecation cycle).
Yes, this was just an alternative suggestion that would be cleaner IMO (having one function do projections and the other function do re-referencing).
I prefer having both in one function - this differentiates it from other kinds of projections done in mne.
True, but a projection is not necessary to do this. If you immediately apply the average reference, but you add the previous reference channels to the data before you apply it, then you can also undo the average referencing. Bad channels can also be excluded.
That is all very true, but projections is how this is currently implemented and it works quite elegantly.
I think the main problem with the current behavior is that most EEG people have no idea what an SSP projection is, and - this is the real problem - that the average reference projection is not automatically applied.
I agree. But I'm not sure the best solution here is to automatically apply the average reference, because otherwise users get confused. It would solve the problem of users being confused, but it leaves them with possibly corrupted data.
I agree. But I'm not sure the best solution here is to automatically apply the average reference, because otherwise users get confused. It would solve the problem of users being confused, but it leaves them with possibly corrupted data.
But I though that's what we agreed upon? I think it clears up confusion. How could it leave them with corrupted data? If they want to to inverse modeling and they need an average reference projector, but they applied the projection instead, they will get an error saying that the projector is not found.
I'm computing ICA on continous raw EEG data. In my pipeline, I set
before doing
Does this imply that I fit ICA on average referenced
raw
data? Or do I need to explicitly invokeraw.apply_proj()
before fitting ICA?Similarly, if I only have the three lines described above, when I call
raw.get_data()
, is the average reference projection applied automatically?From what I've seen in the code, it seems that the average reference projection is NOT applied automatically except for in
raw.plot
(where it can be switched on and off).