Current implementation of **mne.grand_average API equalizes channels across subjects before performing a grand average. Is there any way to construct/interpolate the missing channels based on the neighboring channels on grand average data similarly to a single subject?
The problem that I am facing is something similar:
sub1 has grad channels (physical) : 1, 2, …50, 51, 52, 53
sub2 has grad channels : 1,2, … 50, 51, 53 (ch 52 is missing, it’s not registered as bad that can be interpolated)
sub3 has grad channels: 1, 2, …51, 52, 53 (50 is missing)
… and so on!
now, if you do grand average, the output becomes: 1, 2, …51, 53 (50 and 52 are not there due to channel equalization across subjects). How can I interpolate or retreat back the missing channels in the grand average unless the missing channels across subjects can be labeled/marked as bad in the grand average? At the moment, MNE doesn’t offer this option. I hope I am clearer with the explanation.
Can the missing channel locations be known somehow? I.e., if they’re grad channels in a SQUID system then the location is fixed, and you could add an all-zero channel to the montage of subject 2, getting its location from the montage of subject 1. Be mindful of coordinate system transforms if you take this approach (e.g., look at montage.dig[0]['coord_frame'] of both subjects)
@dasdiptyajit the mne.grand_average() function accepts a combination of the interpolate_bads and drop_bads parameters. I think what you’re looking for is
The solution that I am looking for is something similar what @drammock has proposed. The channels were physically turned off due to high noise. So, they aren’t marked as bads that can be interpolated.
I will give it a go and try to post the intermediate results.
@richard@drammock feel free to run the code and perhaps this/similar codes can be added in the tutorial section for MNE. I am happy to help further if needed.
@dasdiptyajit I had a look at your script and I think it’s a great candidate for our examples gallery.
side note: the examples are meant to be “quick-how-to recipes for common needs” and the tutorials are meant to be “step-by-step learning resources that show many options / discuss tradeoffs / model best practices”
I think this would be good as an example because it answers one straightforward question: “how do I interpolate a sensor that was completely missing from a recording?” and because the answer is fairly straightforward: step 1 simulates data with a missing sensor; step 2 adds a flat sensor in its place and interpolates it. You’ve got a lot of code comments in there already so I think it’s mostly a matter of tidying up to make it render nicely in HTML.
Can you open a PR to put your example in examples/preprocessing? There’s already an “interpolate bad channels” example, so adding an “interpolate missing sensors” example would be a good complement.
@drammock sounds great to me. Thanks for looking up the script. I will open a PR soon. Currently, I am working on a similar issue (remapping gradiometers activity to virtual magnetometers (i.e., creating virtual magnetometers). Gradiometers maps are difficult to understand. Currently, MNE doesn’t provide a solution to create virtual magnetometers (only remapping is allowed between existing sensor types). This can be really useful during ICA decomposition. I will tag you in MNE-Github once I have an example solution.