Page 1 of 1

Nice tutorials, one minor question

Posted: Tue Aug 16, 2016 12:53 pm
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: http://neuron.yale.edu/neuron/static/do ... 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_
ExpSyn[0]
>>> 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!

Re: Nice tutorials, one minor question

Posted: Wed Aug 17, 2016 12:36 pm
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.