read_custom_montage neuroscan compumedics file

Hello,

I am trying to get MNE to read my montage from a compumedics neuroscan EEG system, but it cannot seem to identify the channel locations from my file. I have Windows 11 and am using Curry 9 to record EEG data. My ā€œchanlocsā€ file is a .csv with ā€˜labelā€™ for channels, x,y,z coordinates and other measures.

Here is my code:
fname = ā€˜chanlocsā€™
path_chan = rā€™C:\Users.ā€¦\chanlocs.csvā€™
montage = mne.channels.read_custom_montage(path_chan)

And the error:
ValueError Traceback (most recent call last)
Input In [58], in <cell line: 4>()
1 fname = ā€˜chanlocsā€™
2 path_chan = rā€™C:\Users\Louise\Desktop\eeg data\n-back\chanlocs.csvā€™
----> 4 montage = mne.channels.read_custom_montage(path_chan)

File ~\Anaconda3\envs\mne\lib\site-packages\mne\channels\montage.py:1399, in read_custom_montage(fname, head_size, coord_frame)
1396 montage = _read_brainvision(fname, head_size)
1398 elif ext in SUPPORTED_FILE_EXT[ā€˜xyzā€™]:
ā†’ 1399 montage = _read_xyz(fname)
1401 if coord_frame is not None:
1402 coord_frame = _coord_frame_const(coord_frame)

File ~\Anaconda3\envs\mne\lib\site-packages\mne\channels_standard_montage_utils.py:392, in _read_xyz(fname)
390 ch_names.append(ch_name)
391 pos.append((x, y, z))
ā†’ 392 d = _check_dupes_odict(ch_names, np.array(pos, dtype=float))
393 return make_dig_montage(ch_pos=d)

ValueError: could not convert string to float: ā€˜ā€™

Here is a snapshot of what the csv file looks like:

I have edited the csv file to have x,y,z in the first columns and channel labels in the last. Same error occurs. Any help is greatly appreciated!

Hello @louisestolz and welcome to the forum!

Could you please share the original CSV file here? Open it in a text editor (not in a spreadsheet program), paste the contents here, select what youā€™ve pasted, and click on the Preformatted text button in the toolbar. Thanks!

Richard

Hi Richard,

Thank you for your response! I actually resolved the issue since the code was correct, but I had an outdated file from Compumedics - attached is the updated QuickCap64 montage for future reference.

Louise

|Label|x (mm)|y (mm)|z (mm)|
|---|---|---|---|
|Fp1|-29|104.536|33.1255|
|Fpz|1|109.203|38.6223|
|Fp2|30|104.651|34.1187|
|AF3|-34|101.932|62.625|
|AF4|36|101.054|63.734|
|F11|-74|46.771|-30.6181|
|F7|-70|61.8921|30.0395|
|F5|-66|68.4593|60.4841|
|F3|-52|76.7816|88.7107|
|F1|-28|84.0625|107.998|
|Fz|2|88.7299|113.494|
|F2|31|84.8243|105.895|
|F4|53|78.6525|87.4859|
|F6|66|69.684|62.3549|
|F8|70|61.2459|33.1351|
|F12|74|44.4855|-24.3113|
|FT11|-80|18.5638|-39.413|
|FC5|-77|39.5866|71.902|
|FC3|-62|47.61|106.204|
|FC1|-34|54.3605|129.58|
|FCz|3|57.2728|137.295|
|FC2|37|54.129|127.593|
|FC4|63|48.3719|104.102|
|FC6|77|40.6956|72.7796|
|FT12|79|16.394|-32.1129|
|T7|-84|3.51988|38.8537|
|C5|-83|8.38021|80.5715|
|C3|-69|14.7642|118.085|
|C1|-37|18.882|144.788|
|Cz|3|22.0258|154.489|
|C2|40|19.6438|142.685|
|C4|69|15.7575|117.969|
|C6|83|9.48921|81.4491|
|T8|84|3.98277|42.8268|
|TP7|-82|-26.0471|44.3119|
|CP5|-81|-25.3914|84.5061|
|CP3|-67|-22.9805|122.482|
|CP1|-36|-20.8493|149.417|
|CPz|3|-17.8212|158.125|
|CP2|40|-18.1009|147.083|
|CP4|67|-19.0074|122.019|
|CP6|80|-21.1868|86.0298|
|TP8|82|-24.591|48.1693|
|M1|-76|-41.2549|8.83346|
|M2|77|-38.4583|15.555|
|P7|-73|-54.5051|50.6477|
|P5|-68|-55.6527|84.0046|
|P3|-56|-55.1609|114.15|
|P1|-30|-54.7173|135.241|
|Pz|2|-52.9139|142.078|
|P2|32|-52.7307|135.009|
|P4|56|-53.1743|113.919|
|P6|68|-52.5571|84.6507|
|P8|72|-52.1714|53.3961|
|PO7|-54|-77.6496|59.3847|
|PO3|-37|-79.559|94.8439|
|POz|2|-78.7007|110.852|
|PO4|37|-78.6814|93.7349|
|PO8|55|-75.5473|60.1466|
|O1|-29|-91.8544|67.0803|
|Oz|1|-94.0242|74.3804|
|O2|30|-90.7454|67.9578|
|Cb1|-28|-92.8091|32.9615|
|Cb2|31|-90.7069|33.7234|

Thanks for sharing! So the file contains literally those | characters??? You sure this wasnā€™t edited by hand by someone?