Converting HOC extracellular to Python

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
ssrihari
Posts: 4
Joined: Mon Dec 30, 2019 11:05 pm

Converting HOC extracellular to Python

Post by ssrihari » Tue Dec 31, 2019 5:42 pm

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?

ramcdougal
Posts: 211
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: Converting HOC extracellular to Python

Post by ramcdougal » Wed Jan 01, 2020 2:00 pm

In HOC, if foo is an array, assigning to foo is a syntactic shortcut for assigning to foo[0].

ted
Site Admin
Posts: 5740
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Converting HOC extracellular to Python

Post by ted » Wed Jan 01, 2020 2:34 pm

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.

ssrihari
Posts: 4
Joined: Mon Dec 30, 2019 11:05 pm

Re: Converting HOC extracellular to Python

Post by ssrihari » Sat Jan 11, 2020 7:36 pm

Thank you!

Post Reply