Nice tutorials, one minor question

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

Moderator: hines

Post Reply
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Nice tutorials, one minor question

Post by neuromau »

I enjoyed going through the very clear and through neuron+python tutorials. I think there is one line that needs to be updated, or (more likely) it was some sort of user error on my part, being new to python. It is the ball-and-stick network tutorial at: ... tick3.html

Everything was going well until I got to this line:
syn_ = h.ExpSyn(cells[0].dend(0.5), name='syn_')
Where I got this error:

Code: Select all

>>> stim = h.NetStim() # Make a new stimulator
>>> syn_ = h.ExpSyn(cells[0].dend(0.5), name='syn_')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: invalid keyword argument
I omitted the name argument, and now it works fine:

Code: Select all

>>> syn_ = h.ExpSyn(cells[0].dend(0.5))
>>> syn_
>>> dir(syn_)
['Section', '__call__', '__class__', '__delattr__', '__delitem__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__nonzero__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', 'allsec', 'baseattr', 'cas', 'e', 'g', 'get_loc', 'has_loc', 'hname', 'hocobjptr', 'i', 'loc', 'next', 'ref', 'same', 'setpointer', 'tau']
I was able to complete the rest of the tutorials just fine, too. So what is/was the purpose of that 'name' argument? I am just (finally) learning Python and various searches in the Python section of the forum returned nothing for this, so I want to make sure I'm not missing anything important here. Thanks!
Site Admin
Posts: 5935
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: Nice tutorials, one minor question

Post by ted »

I haven't followed the integration of NEURON with Python in close detail, so can only say that it may have seemed like a good idea in the past. Maybe it was used to assign a meaningful hoc name for an objref that references the class instance? (might be helpful if you were doing exploratory simulations and wanted to set up an InterViews graph that showed the time course of current generated by a particular synaptic mechanism, but wanted to avoid putting the mechanism's class name in the graph's plotlist).

That said, it isn't working now and the example should be revised accordingly.
Post Reply