You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed with @rob-luke, we think it could be interesting to have the possibility to set a montage with any elc file with MNI coordinates.
Describe your proposed implementation
Given a custom elc montage file my-montage.elc with MNI coordinates standardised the same way as other existing elc files, it would be great to have an API like this:
# Detailed implementationmy_montage=mne.channels.make_standard_montage('path/to/my-montage.elc')
raw.set_montage(my_montage)
# With also the possibility to use it in one stepraw.set_montage('path/to/my-montage.elc')
Describe possible alternatives
Alternatives include having a separate function set_custom_elc_montage which takes the raw or epochs or evoked object and the montage path as arguments.
raw.set_montage can already take a string as parameter. Does it do what you want?
At the moment the string argument is only working with a list of predefined montages, so it could be useful to have also a way to provide a custom montage file.
It could maybe check if there is a file with the name being the string argument and if not check in the built in montages or the other way around. But maybe a separate function could be a safer option.
I'm not worried about the extremely rare corner case where someone has a filename that matches one of our extensionless built-in names. If someone ever hits this the workaround is easy, just pass './whatever' instead of 'whatever'.
Activity
agramfort commentedon Apr 16, 2021
HanBnrd commentedon Apr 16, 2021
At the moment the string argument is only working with a list of predefined montages, so it could be useful to have also a way to provide a custom montage file.
agramfort commentedon Apr 17, 2021
HanBnrd commentedon Apr 17, 2021
It could maybe check if there is a file with the name being the string argument and if not check in the built in montages or the other way around. But maybe a separate function could be a safer option.
larsoner commentedon Apr 17, 2021
I'm not worried about the extremely rare corner case where someone has a filename that matches one of our extensionless built-in names. If someone ever hits this the workaround is easy, just pass './whatever' instead of 'whatever'.
agramfort commentedon Apr 19, 2021
HanBnrd commentedon Apr 22, 2021
Hi, after diving deeper into this I realised that there is already the function read_custom_montage doing this, sorry for not seeing this earlier.
It is not working directly with
set_montage('path/to/file.elc')but like this:which is good enough I think. So I'm closing this issue.
rob-luke commentedon Apr 22, 2021
Great catch. Maybe worth adding to the new tutorial too?