Forward solution from simulated signale

  • MNE version: e.g. 1.70.0
  • operating system: macOS

Hello everyone.
I have some simulated electrical activity (time series of mean membrane potential) of 34+34 nodes. Each node corresponds to an area in the Desikan-Killiany Atlas.
From these simulated signals, I want to produce an EEG signal in a basic 10-20 system placement.
To do so, I am using MNE forward solution tutorial (Forward models and source spaces — MNE 1.7.1 documentation). I have my patient’s FreeSurfer brain parcellation, the BEM, I produced the -trans.fif file with the GUI, I can plot the sources nicely within the brain volume of my patient, and I can compute the forward solution. The problem is:

  1. I do not know what to put in the raw file names, so I am using some random one available in mne example material
  2. I do not know how to interpret the gain matrix: the result gives me a 60 (eeg channels) x 516 (n of sources) matrix, but why aren’t they 68 like the parcellation I am using? How can I know to which brain parcel every column of the gain matrix corresponds? How can I only get 20 eeg channels?
    Here is the code that I am using (you can see that I am using my patient’s data for everything except for the raw file):
sample_data_folder ='/Users/giacomopreti/Desktop/mne-sub-001'
subjects_dir = sample_data_folder + "/sub-001"
mne.bem.make_scalp_surfaces(subject='sub-001', subjects_dir='/Users/giacomopreti/Desktop/mne-sub-001/sub-001')
raw_fname = data_path + "/MEG/sample/sample_audvis_raw.fif" # uploading mne tutorials samples
raw = mne.io.read_raw_fif(raw_fname)
t1w = nib.load(subjects_dir+ '/sub-001'/mri/T1.mgz')
t1w = nib.Nifti1Image(t1w.dataobj, t1w.affine)
t1w.header["xyzt_units"] = np.array(10, dtype="uint8")
t1_mgh = nib.MGHImage(t1w.dataobj, t1w.affine)

mne.gui.coregistration(subject='sub-001', subjects_dir=subjects_dir)
trans = '/Users/giacomopreti/Desktop/mne-sub-001/sub-001/sample/bem/pat-001-trans.fif' # here is the trans.fif file saved after the coregistration
src = mne.setup_source_space(
    subject, spacing="oct4", add_dist="patch", subjects_dir=subjects_dir # use oct6 for real analyses
)
mne.viz.plot_bem(src=src, **plot_bem_kwargs)

conductivity = (0.3, 0.006, 0.3)  # for three layers, for EEG
model = mne.make_bem_model(
    subject="sub-001", ico=4, conductivity=conductivity, subjects_dir=subjects_dir)

bem = mne.make_bem_solution(model)
fwd = mne.make_forward_solution(
    raw_fname,
    trans=trans,
    src=src,
    bem=bem,
    meg=False,
    eeg=True,
    mindist=5.0,
    n_jobs=None,
    verbose=True,)

fwd_fixed = mne.convert_forward_solution(
    fwd, surf_ori=True, force_fixed=True, use_cps=True
)
leadfield = fwd_fixed["sol"]["data"]
print("Leadfield size : %d sensors x %d dipoles" % leadfield.shape)

I am a bit confused about what should go in raw_fname and if my sources where created correctly, because I do not understand why the resulting gain matrix is 60x516 and not 60x68. Also, I would like less than 60 eeg sensor.
Thanks a lot for the help
Best
Giacomo