Page 1 of 1

Converting HOC extracellular to Python

Posted: Tue Dec 31, 2019 5:42 pm
by ssrihari
Hi! I am new to the forum and also relatively new to computational neuroscience research. I am currently working on converting the McIntyre MRG axon model from Hoc to Python as part of my initial task as a researcher. In the midst of this process, I realized I needed to convert the following HOC code into Python:

insert extracellular xraxial=Rpn0 xg=1e10 xc=0

However, in Python I believe I have to provide an index (0 or 1) for each xraxial, xg, and xc to specify the layer they are in. I looked over the documentation and the diagram within the documentation for extracellular but am still not quite sure to determine which index to assign since the original HOC code does not provide any such info. I was wondering if one could explain how to determine and/or think about this?

Re: Converting HOC extracellular to Python

Posted: Wed Jan 01, 2020 2:00 pm
by ramcdougal
In HOC, if foo is an array, assigning to foo is a syntactic shortcut for assigning to foo[0].

Re: Converting HOC extracellular to Python

Posted: Wed Jan 01, 2020 2:34 pm
by ted
As ramcdougal notes, the hoc statement
insert extracellular xraxial=Rpn0 xg=1e10 xc=0
will affect xraxial[0], xg[0], and xc[0] of the currently accessed section. extracellular's "0" layer is the one that is right next to the external surface of the section, and it's usually the one whose parameters you would want to specify.

Suppose dend is the Python name of a section that already has extracellular. Then
dend.xraxial[0] = Rpn0
dend.xg[0] = 1e10
dend.xc[0] = 0
will do what you want.

And if you have a list of sections called somelist and you want to specify the values of these three parameters for each section in the list, then

Code: Select all

for foo in somelist:
  foo.xraxial[0] = Rpn0
  foo.xg[0] = 1e10
  foo.xc[0] = 0
should do the job.

Re: Converting HOC extracellular to Python

Posted: Sat Jan 11, 2020 7:36 pm
by ssrihari
Thank you!