Hmm I’m guessing that it has to do with this line raw.set_montage(current_montage,on_missing = “ignore”). It might be the case that one of these channels without a corresponding x/y coordinate in your montage is getting used in the head radius calculation.
As a test, you can confirm my hunch by setting on_missing="raise", and then explicitly dropping channels that don’t have a montage location until set_montage no longer throws an error.
Thanks, that worked partially. I had deleted the EKG channel that had NA values. It worked when I added it back. I set it to 1,1,1 for x,y,z (not sure what the correct values would be). However, I then had to divide all the x,y,z co-ordinates by 1000 to get an acceptable head radius (maybe measurement in mm expected to be in m?). Having done that, the interpolation looks really bad though, much more jagged and uneven than the original data and the neighbouring data. Not sure what to do next.
There is no reason to give a position for EKG channels, just set their types correctly like "ecg", "emg", "eog", … and yes all units in MNE are SI, so distance is in meters.
I’ve set the EKG channel type to “ecg”, but
mne.channels.read_custom_montage(filename,head_size = 0.095, coord_frame = None)
still gives an error that it cannot convert the n/a in the EKG channel to a float.