Page 1 of 1

Stimulation in ephaptic example

Posted: Fri Oct 13, 2017 11:28 am
by mcapllonchj

I have been going over your example for Bokil & al. (2001): ... hoc#tabs-1
and I was wondering, where do you define the stimulation of the axons? I haven't seen any "IClamp" in the entire folder. Is there another way you have to do so?

The motivation of my question is that I am trying to do this example in Python, but I don't know how to stimulated the Ns stimulated axons.

Best Regards

Re: Stimulation in ephaptic example

Posted: Sun Oct 15, 2017 11:56 am
by ted
The stimulus is produced by a voltage clamp (Fig 2) or current clamp (Fig 3B) located at the middle of section a. The clamps are implemented by an instance of the LinearCircuit class as an ideal voltage or current source, respectively. LinearCircuit is a GUI tool. NEURON's GUI tools can be used with Python quite easily as long as
1. at the beginning of your Python code, import both h and gui
from neuron import h, gui
(that's easy and not at all non-pythonic)
2. make sure that the sections that the GUI tools will reference have been created with hoc. This is not as ugly as you might imagine. For models like this one, whose sections that are at the top level of the interpreter (i.e. the sections are not members of an object), just do this
h('create a,b') # or whatever section names you prefer
a = h.a
b = h.b
and then you can use Python and/or NEURON's GUI tools to do whatever you like with these two sections.

It's also easy to use the GUI with models whose cells are instances of classes, as long as the class definitions create the sections in hoc.

Re: Stimulation in ephaptic example

Posted: Mon Oct 16, 2017 2:52 pm
by mcapllonchj
Hi Ted,
Thanks for your quick response. I see, as you say, that this is a GUI tool. I have been practising today and I have managed to create and simulate a simple RC circuit, and I have saved it into a hoc file with the Create Class button. However, I am not sure how this can be implemented programatically. I have seen how you do it in the .ses files, but I can't see very clearly what the arguments of mkelm are and how it works altogether. Is there any documentation specifically for this?

Alternatively, I have tried to make the current clamp with a h.IClamp instance, but I get noise in the results. Does that have anything to do with your choice of LinearCircuit for the current clamp (meaning is there a reason why using h.IClamp would not make sense for this specific example) or am I doing something wrong?

Re: Stimulation in ephaptic example

Posted: Mon Oct 16, 2017 4:11 pm
by ted
First a question: before you created the class file (by clicking on the "Create class" button on the LinearCircuit builder's Parameters page), did you read the hints revealed by the "Hints" button on that page, especially the last bit that starts with
"'Create class' button . . . "

The "Hints," the contents of the class definitions you export (especially the comments in those files), and the Programmer's Reference documentation of the classes, methods, and variables contained in those class definitions, are what there is in the way of documentation for programmatic use of the LinearMechanism class. It's not hopelessly opaque; indeed, some users who are expert in computational modeling of electronic circuits might have little or no difficulty at all using LinearMechanism. However, there is a practical limit to the amount of effort one can be expected to invest in learning about any given feature of a simulation environment before starting to use that feature productively, and LinearMechanism will quickly bring most users to that limit. The class definition exported by a LinearCircuit tool is basically a "wrapper" for the LinearMechanism class that is intended to make it easier to include linear circuits in a model.

IClamp injects a current whose return path must flow to ground (one side of the current source is grounded). The linear circuit in the model has a floating current source, i.e. neither electrode is grounded, so the return path of the injected current does not flow to ground. The numerical values of vext will be very different; this may account for the "noise" that you see when IClamp is used to stimulate the axon. Might it be that the longitudinal extracellular potential gradient is very small compared to vext, so that roundoff error appears as "noise"?

Re: Stimulation in ephaptic example

Posted: Fri Oct 20, 2017 7:25 am
by mcapllonchj
Hi Ted,

Yes, I did. Actually, that's how I realised I could create the code from the LinearCircuit builder. My question was more in the line of figuring out how the code you made in translated into Python. Although that's sorted. I needed to add a label to one of the nodes of the circuit. Then I created the class file and I saw the new process "label"_loc right there, so together with the hints I understood how to connect it to the section. So everything is working now.
Indeed, LinearMechanism is taking me a great deal of effort, but as I get to understand it, I see that it's quite powerful to model ephaptic interactions between cells, so I'll stick with it.

I haven't tested yet the IClamp to see if the "noise" comes from the round-off errors, but I will come back to you with news once I do.
Thanks a lot!