Closed nilsvanrompaey closed 1 year ago
Hi @nilsvanrompaey. Sorry for the confusion, the mesh_file is an option to represent an electrical source to act like a mesh-grid on a plane of individual points. If the mesh-grid is used then the coordinates inside the mesh_file.csv
will be relative to each other and used to create a plane, while the coordinates in the positions_file.csv
will be used as absolute coordinates in the real/cell coordinate system. In other words, bmtk will first set-up a 2D grid of coordinates as specified in mesh_file.csv
, then do a translation using (pos_x
, pos_y
, pos_z
) followed by a rotation of (rotation_x
, rotation_y
, rotation_z
).
However, if you just want to stimulate the cells using a series of single-point sources, you can just remove the mesh_file
option. For example if you have you population of cells centered at the origin, and want to provide stimulus at +100 and -100 microns along the z-axis, you could do the following:
ip | pos_x | pos_y | pos_z | rotation_x | rotation_y | rotation_z | waveform |
---|---|---|---|---|---|---|---|
0 | 0.0 | 0.0 | -100.0 | 0.0 | 0.0 | 0.0 | None |
1 | 0.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | None |
Since the source stimuli is a single point the rotations
will not matter.
To calculate the extracellular stimulus for each source, you are correct that it calculate the euclidean distance between each electrode and each neuron compartment (the center of the compartment). Then uses the inverse-square law to determine the effect it has on the external cell membrane potential. Right now it looks like it does have a hard-coded transfer resistance of 300.0 Ohm/cm. Although we can make that value an option to modify by the user if you think it will be helpful?
Thanks, Kael
Dear @kaeldai,
Thanks for your response, it cleared up some things! I do think it could be helpful if the resistivity could be adapted by the user, although the value that is hard-coded right now seems fairly realistic and I don't think it should be a priority for you to implement this.
However, I am still not sure whether the xstim module takes a current or voltage profile as input.
You caulcate $V{ext} = \frac{A{stim} \rho}{4\pi*R}$ in xstim.py
, which only makes sense if $A$ is a current, but it would be nice if you could confirm this.
Also, what would be the units of this current as there seems to be some confusion about this from the comment on this line of code in xstim_waveforms.py
:
self.amp = float(waveform_config["amp"]) # units? mA?
Best regards, Nils
Hi @nilsvanrompaey - I'm pretty positive the stimulus electrode has to be a current with units mA. What ends up happening is that at each step of the simulation it uses the electrode to update the e_extracellular variable for each segment/compartment, which uses units of [mV]. So if the R is in [Ohm]'s and V_ext is in [mV] then like you intuit A must be [mA].
I will go ahead update bmtk so that the extracellular Resitance is a value that can be modified, as long it's still a constant value it shouldn't be that hard. If resistance is a function/distribution in space should also be possible, but will likely be a bit more tricky to implement - but if you think it will be useful in your research let us know and we can look into it more.
Hi @kaeldai, My main goal is to simulate current steering, which will probably require some Finite Element Model to be solved. In this case I will have to model the resistivity in the FEM anyway. Nonetheless I think it is a good idea to make the resistivity a constant that can be modified. Thank you!
Hi Nils,
I'm going to close this issue for now, but feel free to reopen, or start a new issue, or reach out by email if needed. Excited to see what happens with your extracellular stimulation!
Dear,
I am using extracellular stimulation and would like to model the physical dimensions of the electrode in the simulation. I specify the electrode location in a .csv file, and I know there is
mesh_file.csv
file (which for now just contains a single row of zeros) . Should this mesh file be used to model the electrode shape? If so, how can this be done most efficiently? If not, what should/can themesh_file.csv
be used for?Similarly, I was wondering what the meaning of the rotations (
rotation_x
,rotation_y
,rotation_z
) is in the electrodepositions_file.csv
? I assume the electrode is modeled as a point source in which case the rotation should not matter. Unless this rotation is also related to themesh_file.csv
?On another note, it seems that as of now it is only possible to define voltage profiles for extracellular stimulation. Is it also possible to define current stimulation directly? I was also wondering how exactly the toolkit calculates how the voltage/current profile in the network spreads? Does it somehow account for intercellular fluid or how does the voltage/current spread? From
xstim.py
I would guess that it just takes into account the distance to the electrode and the resistivity and uses that to calculate how the voltage spreads in the tissue.Thank you in advance.
Best regards, Nils Van Rompaey