EEG parametric leadfield computation - On equidistant elementsΒΆ

It is also possible to compute the parametric solution for a subset of the elements of the region of interest. Compared to the single solution, here, the elements must be precomputed to avoid computing it at each iteration.

The solution is thus to compute a reference single solution and provide the resulting elements. In this example, we use the subset of elements generated for the single solution of a previous example.

[ ]:
from shamo import FEM

model = FEM.load("../../derivatives/fem_from_labels/fem_from_labels.json")
[ ]:
from shamo.eeg import ProbParamEEGLeadfield

problem = ProbParamEEGLeadfield()
[ ]:
from shamo import DistUniform

problem.sigmas.set("scalp", DistUniform(0.137, 2.1))
problem.sigmas.set("gm", DistUniform(0.06, 2.47))
problem.sigmas.set("wm", DistUniform(0.0646, 0.81))
[ ]:
problem.reference.add("IZ")
[ ]:
problem.markers.adds(["NZ", "LeftEar", "RightEar"])
[ ]:
problem.rois.add("gm")

First, we load the solution that serves as a reference.

[ ]:
from shamo.eeg import SolEEGLeadfield

ref_solution = SolEEGLeadfield.load("../../derivatives/eeg_leadfield/single_ssp-dist/single_ssp-dist.json")

And pass the path to the elements file to the new parametric problem.

[ ]:
problem.elems_path.set(ref_solution.source_sp_path)
[ ]:
solution = problem.solve("parametric_ssp-dist", "../../derivatives/eeg_leadfield", model, n_evals=4, method="multiprocessing", n_proc=4)