コード例 #1
0
 def meg_gain(self, meg_file=None):
     """
     Call OpenMEEG's GainMEG method to calculate the final projection matrix.
     Optionaly saving the matrix for later use. The OpenMEEG matrix is 
     converted to a Numpy array before return. 
     """
     LOG.info("Computing GainMEG...")
     meg_gain = om.GainMEG(self.om_inverse_head, self.om_source_matrix,
                           self.om_head2sensor, self.om_source2sensor)
     LOG.info("meg_gain: %d x %d" % (meg_gain.nlin(), meg_gain.ncol()))
     if meg_file is not None:
         LOG.info("Saving meg_gain as %s..." % meg_file)
         meg_gain.save(
             os.path.join(OM_STORAGE_DIR, meg_file + OM_SAVE_SUFFIX))
     return om.asarray(meg_gain)
コード例 #2
0
ファイル: test_python.py プロジェクト: piandpower/openmeeg
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())
print "dsm                 : %d x %d" % (ssm.nlin(), ssm.ncol())
print "ds2mm               : %d x %d" % (ss2mm.nlin(), ss2mm.ncol())
print "h2mm                : %d x %d" % (h2mm.nlin(), h2mm.ncol())