Electrode and array layouts for TesFlexOptimization¶
TesFlexOptimization supports two layout types: ElectrodeArrayPair and CircularArray
ElectrodeArrayPair¶
Initialization¶
Python
from simnibs import opt_struct opt = opt_struct.TesFlexOptimization() electrode_layout = opt.add_electrode_layout("ElectrodeArrayPair")
MATLAB
opt = opt_struct('TesFlexOptimization'); opt.electrode{1} = opt_struct('ElectrodeArrayPair');
Parameters and attributes¶
- class simnibs.optimization.tes_flex_optimization.electrode_layout.ElectrodeArrayPair(settings_dict=None)¶
Symmetric pair of electrode arrays with n_x * n_y electrodes each.
Notes:¶
Contains 2 ElectrodeArray instances with n_x * n_y Electrode instances each. Circular and rectangular electrodes can be mixed.
Example: Array with 2 circular electrode of radius 1 and 2 and one rectangular electrode of size 2x2: radius = [1, None, 2 ]; length_x = [None, 2, None]; length_y = [None, 2, None];
Parameters:¶
- centernp.ndarray of float [n_ele/2 x 2]
Center2 positions of electrodes in normalized x/y plane (z=0). Values will be copied for second array.
- radiusnp.ndarray of float [n_ele/2] or None
Radii of circular electrodes in array (in mm). Array will be copied for second electrode array.
- length_xnp.ndarray of float [n_ele/2] or None
x-dimension of rectangular electrodes in array (in mm). Values will be copied for second array.
- length_ynp.ndarray of float [n_ele/2] or None
y-dimension of rectangular electrodes in array (in mm). Values will be copied for second array.
- radius_boundslist or np.ndarray of float [2]
(min, max) values of electrode radius for optimization (applied to all electrodes in array).
- length_x_boundslist or np.ndarray of float [2]
(min, max) values of electrode x-dimension for optimization (applied to all electrodes in array).
- length_y_boundslist or np.ndarray of float [2]
(min, max) values of electrode y-dimension for optimization (applied to all electrodes in array).
- currentnp.ndarray of float [n_ele] or None
Current through electrodes. Has to sum up to zero net current.
- current_estimator_methodstr, optional, default: “linear”
Method to estimate the electrode currents:
“linear”: linear regression
“gpc”: generalized polynomial chaos
- dirichlet_correctionbool, optional, default: True
If electrodes are connected to the same channel, they have to have the same voltage. This is ensured by setting this flag.
- dirichlet_correction_detailedbool, optional, default: False
Apply detailed Dirichlet correction such that every node current is optimized separately to match the equal voltage constraint of an electrode (recommended for large electrodes as in regular TES applications)
- current_outlier_correctionbool, optional, default: False
Apply current outlier correction after node-wise dirichlet approximation (only for dirichlet_correction_detailed=True).
Attributes:¶
- n_eleint
Total number of electrodes including all channels and arrays
- centernp.ndarray of float [n_ele/2, 3]
Center of electrodes (in mm). Same for second array, so we save it only once.
- radiuslist of float
Radii of electrodes (in mm). Same for second array, so we save it only once.
- electrode_arrayslist of ElectrodeArray instances [2]
Two ElectrodeArray instances
CircularArray¶
Initialization¶
Python
from simnibs import opt_struct opt = opt_struct.TesFlexOptimization() electrode_layout = opt.add_electrode_layout("CircularArray")
MATLAB
opt = opt_struct('TesFlexOptimization'); opt.electrode{1} = opt_struct('CircularArray');
Parameters and attributes¶
- class simnibs.optimization.tes_flex_optimization.electrode_layout.CircularArray(settings_dict=None)¶
Generates a circular electrode array with one center electrode and n_outer equally spaced electrodes. Generates one ElectrodeArray instance because it can only be moved together.
Parameters:¶
- radius_innerfloat
Radius of inner electrodes or (min, max) values for optimization.
- distancefloat
Distance between inner and outer electrodes (from center) (in mm)
- n_outerint
Number of outer electrodes or (min, max) values for optimization.
- radius_outerfloat
Radius of outer electrodes, default: same radius as inner electrodes or (min, max) values for optimization.
- radius_inner_boundslist or np.ndarray of float [2], optional, default: None
(min, max) values of radius of inner electrodes for optimization.
- distance_boundslist or np.ndarray of float [2], optional, default: None
(min, max) values of distance between inner and outer electrodes (from center) (in mm) for optimization.
- n_outer_boundslist or np.ndarray of int [2], optional, default: None
(min, max) values of number of outer electrodes for optimization.
- radius_outer_boundslist or np.ndarray of float [2], optional, default: None
(min, max) values radius of outer electrodes for optimization.
- currentnp.ndarray of float [n_ele]
Current through electrodes (First entry is central electrode). Has to sum up to zero net current.
- current_estimator_methodstr, optional, default: “linear”
Method to estimate the electrode currents:
“linear”: linear regression
“gpc”: generalized polynomial chaos
- dirichlet_correctionbool, optional, default: True
If electrodes are connected to the same channel, they have to have the same voltage. This is ensured by setting this flag.
- dirichlet_correction_detailedbool, optional, default: False
Apply detailed Dirichlet correction such that every node current is optimized separately to match the equal voltage constraint of an electrode (recommended for large electrodes as in regular TES applications)
- current_outlier_correctionbool, optional, default: False
Apply current outlier correction after node-wise dirichlet approximation (dirichlet_correction_detailed=True).
Attributes:¶
- n_eleint
Number of electrodes
- centernp.ndarray of float [n_ele, 3]
Center of electrodes (in mm)
- radiuslist of float
Radii of electrodes (in mm)
- electrode_arrayslist of ElectrodeArray instances [1]
One ElectrodeArray instance containing the Electrode instances