bmtk icon indicating copy to clipboard operation
bmtk copied to clipboard

Extracellular Stimulation - Electrode Mesh file - KeyError

Open CatarinaM17 opened this issue 3 years ago • 1 comments

Dear

I tried to run the Extracellular Stimulation by creating my own space-separated CSV file. However, when trying so I ran into a KeyError on line 3363 in get loc. I think it has something to do with the way I create the CSV file.

I replace 'xstim_electrode.csv' by the name of my CSV file in the code below.

{ "extra_stim": { "input_type": "lfp", "module": "xstim", "node_set": "all", "positions_file": "./inputs/xstim_electrode.csv", "waveform": { "shape": "sin", "del": 1000.0, "amp": 0.100, "dur": 2000.0, "freq": 8.0 } } }

I create the CSV file in excel by putting each block of

ip pos_x pos_y pos_z rotation_x rotation_y rotation_z 0 6.1803398874989481 0.0 19.021130325903069 0.0 0.0 0.0

in a separate cell, so A1 = ip , B2 = pos_x , ... and A2 = 0 , B2 = 6.1803398874989481, ...

The CSV file is saved in a folder "inputs", that I store in the bio14_cells directory.

Yet the KeyError keeps appearing!

Any suggestions?!

Kind regards

Laurens Goyvaerts

CatarinaM17 avatar Feb 08 '22 16:02 CatarinaM17

Hi @CatarinaM17, Sorry for not getting back to you sooner.

It looks like your xstim_electrode.csv file is missing a "electrode_mesh_file" column. so in that file change it to:

ip pos_x pos_y pos_z rotation_x rotation_y rotation_z electrode_mesh_file
0 6.1803 0.0 19.0211 0.0 0.0 0.0 mesh_file.csv

Then create a separate mesh_file.csv file with the following:

x_pos y_pos z_pos
0.0 0.0 0.0

Basically the mesh_file allows us to treat the electrode as a mesh with the center at (6.1803, 0.0, 19.0211). But in your case I think you just want the treat the electrode as a single point - hence a mesh_file with only one point at the origin. It's inconvenient and I will change bmtk so it can handle single-point electrodes better, but for now adding the mesh_file.csv is the only option.

kaeldai avatar Feb 16 '22 17:02 kaeldai