Ejemplo n.º 1
0
 def surface_source(self, gauss_order = 3, surf_source_file=None):
     """ 
     Call OpenMEEG's SurfSourceMat method to calculate a surface source 
     matrix. Optionaly saving the matrix for later use.
     """
     LOG.info("Computing SurfSourceMat...")
     ssm = om.SurfSourceMat(self.om_head, self.om_sources, gauss_order)
     LOG.info("surface_source_mat: %d x %d" % (ssm.nlin(), ssm.ncol()))
     if surf_source_file is not None:
         LOG.info("Saving surface_source matrix as %s..." % surf_source_file)
         ssm.save(os.path.join(OM_STORAGE_DIR,
                               surf_source_file + OM_SAVE_SUFFIX)) #~3GB
     return ssm
Ejemplo n.º 2
0
patches = om.Sensors()
patches.load(patches_file)

###############################################################################
# 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())
Ejemplo n.º 3
0
sensors.load(squidsFile)

patches = om.Sensors()
patches.load(patches_file)

# 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()))