pynibs.neuron package¶
Submodules¶
pynibs.neuron.neuron_regression module¶
- pynibs.neuron.neuron_regression.calc_e_effective(e, layerid, theta, gradient=None, neuronmodel='sensitivity_weighting', mep=None, waveform='biphasic', e_thresh_subject=70)¶
Determines the effective electric field using a neuron mean field model. Transforms the electric field by subtracting the threshold map (in V/m) from the original electric field. The remaining field is the effective electric field (e_eff), generating the stimulation effect, i.e. behavioural effects start at e_eff > 0 because lower fields were not able to stimulate neurons.
- Parameters:
e (np.ndarray) – Electric field (matrix) [N_stim x N_ele]
layerid (str) – Choose from the neocortical layers (e.g. “L1”, “L23”, “L4”, “L5”, “L6”)
theta (np.ndarray) – Theta angle (matrix) [N_stim x N_ele] of electric field with respect to surface normal
gradient (np.ndarray, optional, default: None) – Electric field gradient (matrix) [N_stim x N_ele] between layer 1 and layer 6. Optional, the neuron mean field model is more accurate when provided.
neuronmodel (str, optional, default: "threshold") – Select neuron model to modify the electric field values - “sensitivity_weighting”: normalize threshold map and divide raw e-field by it. - “threshold_subtract”: subtract mean threshold from electric field - “threshold_binary”: assign e-field a binary value to predict MEPs (False -> below threshold, True, above threshold) - “IOcurve”: subtract value read from precomputed neuron IO curve from electric field
mep (np.array of float [N_stim], optional, default: None) – MEP data (required in case of “IOcurve” approach (neuronmodel)
waveform (str, optional, default: biphasic) – Waveform of TMS pulse: - “monophasic” - “biphasic”
e_thresh_subject (float, optional, default: 70) – Subject specific stimulation threshold in V/m. Typically between 60 … 80 V/m.
- Returns:
e_eff – Effective electric field (matrix) [N_stim x N_ele] the regression analysis can be performed with.
- Return type:
np.ndarray
- pynibs.neuron.neuron_regression.calc_e_threshold(layerid, theta, gradient=None, mep=None, neuronmodel='sensitivity_weighting', waveform='biphasic', e_thresh_subject=70)¶
Determine sensitivity map of electric field
- Parameters:
layerid (str) – Choose from the neocortical layers (e.g. “L1”, “L23”, “L4”, “L5”, “L6”). The respective threshold model will be loaded.
theta (np.ndarray) – Theta angle (matrix) [N_stim x N_ele] of electric field with respect to surface normal. in degrees [0 .. 180]
gradient (np.ndarray, optional, default: None) – Electric field gradient (matrix) [N_stim x N_ele] between layer 1 and layer 6. Optional, the neuron mean field model is more accurate when provided. Percent [-100 .. 100]
mep (np.array of float [N_stim], optional, default: None) – MEP data (required in case of “IOcurve” approach (neuronmodel)
neuronmodel (str, optional, default: "threshold") – Select neuron model to modify the electric field values - “sensitivity_weighting”: normalize threshold map and divide raw e-field by it. - “threshold_subtract”: subtract mean threshold from electric field - “threshold_binary”: assign e-field a binary value to predict MEPs (False -> below threshold, True, above threshold) - “IOcurve”: subtract value read from precomputed neuron IO curve from electric field
waveform (str, optional, default: biphasic) – Waveform of TMS pulse: - “monophasic” - “biphasic”
e_thresh_subject (float, optional, default: 70) – Subject specific stimulation threshold in V/m. Typically between 60 … 80 V/m.
- Returns:
e_sens – Electric field sensitivity maps [N_stim x N_ele]
- Return type:
np.ndarray
- pynibs.neuron.neuron_regression.load_cell_model(fn_csv)¶
Load interpolation points of the mean field model from the specified CSV file.
- Parameters:
fn_csv (str) – Fully qualified path to the CSV containing the interpolation points of the mean field model.
- Returns:
- scipy.interpolate.LinearNDInterpolator
- interpolation points ‘theta’
- interpolation points ‘gradient’
- pynibs.neuron.neuron_regression.workhorse_interp(idx_list, interp, params)¶
Single core workhorse to interpolate data.
- Parameters:
idx_list (np.array or list of float [n_interpolations]) – Indices in params array where the interpolation has to be performed (subset of all indices in params array)
interp (scipy.interpolate instance) – Interpolator instance
params (np.array of float [N_interpolations x N_params]) – Array containing the parameters the function is evaluated (total array with all parameters)
- Returns:
res – Interpolation results (subset params[idx_list, :])
- Return type:
np.array of float [n_interpolations]