[Simnibs-discuss] First steps into Simnibs
Quentin Mesnildrey
quentin.mesnildrey at corstim.com
Wed Mar 30 17:19:16 CEST 2022
Dear all,
please find the very basic simulation I tried to run and the associated
error message.
Note that the same code works when I add a TMS section.
Best
Quentin
Le 29/03/2022 à 09:44, Axel Thielscher a écrit :
> Dear Quentin,
>
> can you please send the matlab script where the error occured?
>
> Best,
>
> Axel
>
>
> On 3/25/2022 4:54 PM, Quentin Mesnildrey wrote:
>> Dear community,
>>
>> I am just beginning to run simulations using simnibs so I apologize
>> in advance if my question has been answered in the past. If so,
>> please redirect me to a previous discussion.
>>
>> I have managed to run tDCS simulation using the GUI. My next step is
>> to run it using matlab scripts. I started using the tutorial script
>> provided on the website. Everything seems to work well when I do not
>> change anything but when I remove the TMS component (which I am not
>> interested in), I end up with the following error message :
>>
>> **************
>> if PL['type'][0] == 'TMSLIST':
>> IndexError: only integers, slices (`:`), ellipsis (`...`),
>> numpy.newaxis (`None`) and integer or boolean arrays are
>> valid indices
>> **************
>> Which seems to indicate that not having the TMS is problematic.
>>
>> I would deeply appriciate any advice on this (beginner) issue.
>>
>> Best regards,
>>
--
Quentin Mesnildrey
Chef de projet R&D - CorStim
quentin.mesnildrey at corstim.com
+33688875685
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.drcmr.dk/pipermail/simnibs-discuss/attachments/20220330/47906730/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FMgOExUVWP0WWpHy.png
Type: image/png
Size: 19192 bytes
Desc: not available
URL: <https://mailman.drcmr.dk/pipermail/simnibs-discuss/attachments/20220330/47906730/attachment-0001.png>
-------------- next part --------------
Error using run_simnibs (line 30)
There was an error running SimNIBS:
Traceback (most recent call last):
File "C:\Users\quent\SimNIBS-3.2\simnibs_env\lib\site-packages\simnibs\cli\run_simnibs.py", line
29, in <module>
main()
File "C:\Users\quent\SimNIBS-3.2\simnibs_env\lib\site-packages\simnibs\cli\run_simnibs.py", line
25, in main
run_simnibs(args.simnibs_file, args.cpus)
File
"C:\Users\quent\SimNIBS-3.2\simnibs_env\lib\site-packages\simnibs\simulation\run_simnibs.py",
line 23, in run_simnibs
p = read_mat(simnibs_struct)
File "C:\Users\quent\SimNIBS-3.2\simnibs_env\lib\site-packages\simnibs\utils\matlab_read.py",
line 80, in read_mat
structure = SESSION(matlab_struct=mat)
File "C:\Users\quent\SimNIBS-3.2\simnibs_env\lib\site-packages\simnibs\simulation\sim_struct.py",
line 116, in __init__
self.read_mat_struct(matlab_struct)
File "C:\Users\quent\SimNIBS-3.2\simnibs_env\lib\site-packages\simnibs\simulation\sim_struct.py",
line 362, in read_mat_struct
if PL['type'][0] == 'TMSLIST':
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or
boolean arrays are valid indice
-------------- next part --------------
clear
p=genpath('C:\Users\quent\SimNIBS-3.2\');
addpath(p)
% Initialize a session
s = sim_struct('SESSION');
% Name of head mesh
s.fnamehead = 'ernie.msh';
% Output folder
s.pathfem = 'testsimu/';
S.map_to_surf = true;
S.open_in_gmsh = true;
num_elecs = 2;
% Initialize a tDCS simulation
s.poslist{num_elecs} = sim_struct('TDCSLIST');
% Set currents
s.poslist{num_elecs}.currents = [1e-3 -1e-3];
%% STIM1
s.poslist{num_elecs}.electrode(1).channelnr = 1;
% Electrode dimension
s.poslist{num_elecs}.electrode(1).dimensions = [20 20];
% Rectangular shape
s.poslist{num_elecs}.electrode(1).shape = 'ellipse';
% 5mm thickness
s.poslist{num_elecs}.electrode(1).thickness = 5;
% Electrode Position
s.poslist{num_elecs}.electrode(1).centre = 'AFz';
% Electrode direction
s.poslist{num_elecs}.electrode(1).pos_ydir = 'Cz';
%% STIM2
s.poslist{num_elecs}.electrode(2).channelnr = 2;
% Electrode dimension
s.poslist{num_elecs}.electrode(2).dimensions = [20 20];
% shape
s.poslist{num_elecs}.electrode(2).shape = 'ellipse';
% 5mm thickness
s.poslist{num_elecs}.electrode(2).thickness = 5;
% Electrode Position
s.poslist{num_elecs}.electrode(2).centre = 'POz';
% Electrode direction
s.poslist{num_elecs}.electrode(2).pos_ydir = 'Cz';
%% run
run_simnibs(s)
More information about the Simnibs-discuss
mailing list