simnibs.simulation.tdcs_leadfield

simnibs.simulation.tdcs_leadfield(mesh, cond, electrode_surface, fn_hdf5, dataset, current=1.0, roi=None, post_pro=None, field='E', solver_options=None, n_workers=1, input_type='tag')

Simulates tDCS fields using Neumann boundary conditions and writes the output Electric fields to an HDF5 file

Parameters
  • mesh (simnibs.msh.mesh_io.Msh) – Mesh file with geometry information

  • cond (simnibs.msh.mesh_io.ElementData) – An ElementData field with conductivity information

  • electrode_surface (list) – A list of the tag of the electrode surfaces (if input_type=’tag’) or of nodes (if input_type=’node’). The first will be used as a reference

  • fn_hdf5 (str) – Name of hdf5 where simulations will be saved

  • dataset (str) – Name of dataset where data is to be saved

  • current (float (optional)) – Current to use in each simulation. Default: 1 A

  • roi (list or None (optional)) – Regions of interest where the fields is to be saved. If set to None, will save the electric field in all tissues. Default: None

  • field ('E' or 'J' (optional)) – Which field to save (electric field E or current density J). Default: ‘E’

  • post_pro (callable (optional)) – callable f_post = post_pro(f), where f is an input field in the ROI and f_post is an Nx3 ndarray. The postprocessing result will be saved instead of the field

  • solver_options (str (optional)) – Options to be used by the solver. Default: Hypre solver

  • n_workers (int) – Number of workers to use

  • input_type ('tag' or 'node' (optional)) – Wether electrode_surface refers to surface tags (default) or nodes.

Returns

  • Writes the field resulting from each simulation to a dataset called

  • fn_dataset in an hdf5 file called fn_hdf5