Hi all,
I’m absolutely new to MNE but was hoping to get some topoplots illustrating the value of an exponent from a prior analysis per electrode. I have 17 electrodes I am satisfied with, and for which I have used mne.channels.read_custom_montage from a .elp file supplied by a colleague to generate the appropriate montage, as in the code below. Given I do not have a fif-formatted eeg dataset with epochs and such, I am struggling to find how to get this to work as the examples online seem to be entirely from fif format data. I have tried supplying the topomap ‘pos’ argument with both the neonatal montage I created and it’s .get_positions argument, and read on stack overflow some users had used .get_positions2d() on a montage ot get the appropriate x and y inputs for this function. I have had no luck in this regard as the documentation and subsequent errors suggest this method is not part of the montage function. I am sure there is a minor mis-specification someone can correct in my code, and I welcome any suggestions in this light.
I had tried using a .set file from EEGLAB which had its values set as the vectors I wanted rather than a timeseries per se, just to enable me to read into MNE and try and get a fif structure, but this quickly identified the file was not epoched or in a typical manner. Ultimately, I am flexible on the approach to get the plot, but I just wanted an MNE version in python rather than having my code locked off in MATLAB and EEGLAB, which I am trying to transition away from.
Any help is very welcome.
Ryan
print(f'{channels}')
import mne
!which mne
#The .set files are imported ok
fname = '/Users/ryanstanyard/Desktop/Research/EEGfMRI/EEG_final/PSDs_extracted/1170_avgPSD_17only.set'
neonatal_montage = '/Users/ryanstanyard/Desktop/Research/EEGfMRI/EEG_final/standard-10-5-cap385.elp'
# mydata = mne.io.read_epochs_eeglab(fname)
mydata = mne.io.read_raw_eeglab(fname)
neonatal_montage = mne.channels.read_custom_montage(neonatal_montage)
#The data look ok, and channel labels are correctly displayed
mydata
# mydata.plot()
mydata.ch_names
#Create a montage based on the standard 1005, unsure if this is appropriate
montage = mne.channels.make_standard_montage('standard_1005')
mydata.set_montage(neonatal_montage)
#But the channel locations are not found
mydata.plot_sensors()
neonatal_montage.get_positions
# fig, ax = plt.subplots(ncols=2, figsize=(8, 4), gridspec_kw=dict(top=0.9),
# sharex=True, sharey=True)
# mne.viz.plot_topomap(averagedElectrodes_aperiodic['Channel_exponent_averages_Corrected'], neonatal_montage.get_positions, vmin=None, vmax=None, cmap=None,
# sensors=True, res=64, axes=ax[0], names=channels, show_names=True, mask=None, mask_params=None, outlines='head',
# show=True)
# mne.viz.plot_topomap(averagedElectrodes_aperiodic['Channel_exponent_averages_Corrected_SD'], montage, vmin=None, vmax=None, cmap=None,
# sensors=True, res=64, axes=ax[1], names=channels, show_names=True, mask=None, mask_params=None, outlines='head',
# show=True)
# ax[0].set_title('Aperiodic Exponent', fontweight='bold')
# ax[1].set_title('Aperiodic Exponent SD Map', fontweight='bold')