HD-tDCS parametric simulationΒΆ

As for the EEG leadfield matrix, a parametric solution can be computed with respect to the distributions of values set for the electrical conductivity of the tissues butalso for the injected current value.

The first steps are the same as for the single problem.

[ ]:
from shamo import FEM

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

problem = ProbParamHDTDCSSim()

The only differences are the values used to determine the conductivity and the injected current since DistABC are used.

[ ]:
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.source.add("P3")
[ ]:
problem.references.adds(["T5", "C3", "PZ", "O1"])
[ ]:
problem.current.set(DistUniform(0.002, 0.008))
[ ]:
import nibabel as nib

img = nib.load(model.path / f"{model.name}.nii")
problem.grid.set(img.affine, img.shape)

Similarly to any parametric problem in shamo, the number of evaluations and the method used to solve the sub-solutions is up to the user.

[ ]:
solution = problem.solve("parametric", "../../derivatives/hd_tdcs_simulation", model, n_evals=4, method="multiprocessing", n_proc=4)