Inverse model#

This module inverts the forward model.

src_rec.inv_mdl.Inv_mdl(trans, noise_norm)#

Container class, populed with the following items:

src_rec.inv_mdl.trans#

Inverse model.

Type:

numpy.ndarray, shape(valid_vtx_cnt, meg_ch_cnt)

src_rec.inv_mdl.noise_norm#

Noise normalization vector.

Type:

numpy.ndarray, shape(valid_vtx_cnt,)

src_rec.inv_mdl.compute(sen_cov, fwd_sol, rec_meta_info, method='dSPM')#

Converts a forward model into an inverse model.

Parameters:
  • sen_cov (finnpy.src_rec.sen_cov.Sen_cov class) – Container class.

  • fwd_sol (numpy.ndarray, shape(meg_ch_cnt, valid_vtx_cnt)) – Forward model.

  • rec_meta_info (mne.io.read_info) – MEG scan meta information, obtainable through mne.io.read_info.

  • method (string) – Method used to calculate the noise normalization vector, defaults to “dSPM”.

Returns:

inv_mdl – Container class.

Return type:

finnpy.src_rec.inv_mdl.Inv_mdl

src_rec.inv_mdl.apply(sensor_data, inv_mdl)#

Applies an inverse model and noise normalization vector to sensor space data.

Parameters:
  • sensor_data (numpy.ndarray, shape(sensor_ch_cnt, samp_cnt)) – Sensor space data

  • inv_mdl (finnpy.src_rec.inv_mdl.Inv_mdl) – Container class.

Returns:

source_data – Source space data.

Return type:

numpy.ndarray, shape(source_ch_cnt, samp_cnt)

src_rec.inv_mdl._calc_whitener(eigen_val, eigen_vec)#

alculate PCA based whitener from provided eigenvalues and eigenvectors.

Parameters:
  • eigen_val (numpy.ndarray, shape(n,)) – Eigenvalues.

  • eigen_vec (numpy.ndarray, shape(n, n)) – Eigenvectors.

Returns:

whitener – Whitener.

Return type:

numpy.ndarray, shape(n, n)

src_rec.inv_mdl._get_meg_channel_type_idx(rec_meta_info)#

Returns the channel names of the MEG channels.

Parameters:

rec_meta_info (mne.io.read_info) – MEG scan meta information, obtainable through mne.io.read_info.

Returns:

sensor_cov_names – Names of the channels.

Return type:

list, len(ch_cnt,), string