def dip2meg(self): """ Create an OpenMEEG Matrix that can be used to map OpenMEEG dipole sources to an OpenMEEG MEG Sensors object. NOTE: This source to sensor mapping is not required for EEG. """ LOG.info("Computing DipSource2MEGMat...") dip2meg_mat = om.DipSource2MEGMat(self.om_sources, self.om_sensors) LOG.info("dip2meg: %d x %d" % (dip2meg_mat.nlin(), dip2meg_mat.ncol())) return dip2meg_mat
############################################################################### # Compute forward problem (Build Gain Matrices) gauss_order = 3 use_adaptive_integration = True dipole_in_cortex = True hm = om.HeadMat(geom, gauss_order) #hm.invert() # invert hm inplace (no copy) #hminv = hm hminv = hm.inverse() # invert hm with a copy ssm = om.SurfSourceMat(geom, mesh) ss2mm = om.SurfSource2MEGMat(mesh, sensors) dsm = om.DipSourceMat(geom, dipoles, gauss_order, use_adaptive_integration, "") ds2mm = om.DipSource2MEGMat(dipoles, sensors) h2mm = om.Head2MEGMat(geom, sensors) h2em = om.Head2EEGMat(geom, patches) gain_meg_surf = om.GainMEG(hminv, ssm, h2mm, ss2mm) gain_eeg_surf = om.GainEEG(hminv, ssm, h2em) gain_meg_dip = om.GainMEG(hminv, dsm, h2mm, ds2mm) gain_adjoint_meg_dip = om.GainMEGadjoint(geom, dipoles, hm, h2mm, ds2mm) gain_eeg_dip = om.GainEEG(hminv, dsm, h2em) gain_adjoint_eeg_dip = om.GainEEGadjoint(geom, dipoles, hm, h2em) gain_adjoint_eeg_meg_dip = om.GainEEGMEGadjoint(geom, dipoles, hm, h2em, h2mm, ds2mm) print "hm : %d x %d" % (hm.nlin(), hm.ncol()) print "hminv : %d x %d" % (hminv.nlin(), hminv.ncol()) print "ssm : %d x %d" % (ssm.nlin(), ssm.ncol()) print "ss2mm : %d x %d" % (ss2mm.nlin(), ss2mm.ncol())