-
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
Reading in bvct digitizer file without LPA and RPA throws key error #13115
Comments
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴 |
Thanks for the report. Out of curiosity: How did you get a BrainVision CapTrak file without LPA and RPA? As far as I know, the CapTrak device always collects data on LPA and RPA, as the internally used coordinate system depends on these two points. |
I am working with the dataset from this paper: https://www.nature.com/articles/sdata201874. I received the dataset after contacting the authors, so I am not sure how they modified the bvct files to remove those two electrodes. |
Thanks, I also downloaded that data now and had a look. It seems to be organized slightly differently to the CapTrak data that I collected some years back, see for example: https://gin.g-node.org/sappelhoff/mpib_sp_eeg/src/master/sourcedata/sub-01/coords/CapTrakResultFile_sub-01.bvct I think we should
Would you be willing to do that @MatthewChen37 ? |
Sure, I'll try to see if I can contact the authors first. |
Describe the new feature or enhancement
Hi,
I was trying to read a .bvct file and make a DigitMontage from it, but I noticed that
_parse_brainvision_dig_montage
in_dig_montage_utils.py
assumes that an LPA and RPA coordinate is in the CapTrackElectrodeList. I don’t think this should be a rigid assumption sincemne.channels.make_dig_montage
can take in an LPA and RPA that are none. I was wondering if it was possible to change the implementation in_parse_brainvision_dig_montage
from:return dict( # BVCT stuff nasion=fids["nasion"], lpa=fids["lpa"], rpa=fids["rpa"], ch_pos=dig_ch_pos, coord_frame="unknown", )
to
return dict( # BVCT stuff nasion=fids.get("nasion", None), lpa=fids.get("lpa", None), rpa=fids.get("rpa", None), ch_pos=dig_ch_pos, coord_frame="unknown", )
as this would prevent the function from throwing a key error if no LPA or RPA exist within the bvct file.
Describe your proposed implementation
return dict( # BVCT stuff nasion=fids["nasion"], lpa=fids["lpa"], rpa=fids["rpa"], ch_pos=dig_ch_pos, coord_frame="unknown", )
to
return dict( # BVCT stuff nasion=fids.get("nasion", None), lpa=fids.get("lpa", None), rpa=fids.get("rpa", None), ch_pos=dig_ch_pos, coord_frame="unknown", )
Describe possible alternatives
Please let me know if there are alternatives for defaulting dictionary key access values in Python as I typically use this to resolve to access a key that doesn't exist
Additional context
No response
The text was updated successfully, but these errors were encountered: