Neuron+Python+Gui

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

Moderator: hines

Post Reply
tfoutz99
Posts: 12
Joined: Wed Dec 12, 2007 3:15 pm

Neuron+Python+Gui

Post by tfoutz99 » Wed Jun 16, 2010 4:37 pm

If I create a section in python:

"python"

Code: Select all

from neuron import h,gui
soma = h.Section()
dend = h.Section()
and then create a Voltage axis graph, "Plot what?" doesn't list any sections.

I get an even stranger response when I launch "nrngui -python". "Plot what?" displays a really messed up picture, which appears to be empty.

I have tried to fix this by giving the section a name:

Code: Select all

from neuron import h,gui
soma = h.Section(name='soma')
print soma.name()
To no avail.

The following method does work:

Code: Select all

from neuron import h,gui
h('create soma')
soma = h.soma
I don't know how hard this is to fix. This might be confusing to those new to Neuron+Python.

On a related note, the "Distributed Mechanisms" menu item does list sections created via the "soma = h.Section(name='soma')" method. However, when I try to access them, I get:

Code: Select all

NEURON: syntax error
 near line 2
 {.L}
  ^
        nrnsecmenu(-1, 1)
      MenuExplore[0].execute("nrnsecmenu(-1,1)")
    MenuExplore[0].make_menu()
  doNotify()
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/threading.py", line 525, in __bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/neuron/gui.py", line 36, in run
    self.fun()
  File "/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/neuron/gui.py", line 17, in process_events
    h.doNotify()
RuntimeError: hoc error
I am not sure if this is a related bug.
As always, thanks for all the work on Neuron!

hines
Site Admin
Posts: 1577
Joined: Wed May 18, 2005 3:32 pm

Re: Neuron+Python+Gui

Post by hines » Thu Jun 17, 2010 10:58 am

Thanks for reminding me about those issues. Several gui elements do not know how to handle anonymous python sections
and my hope that merely giving the section a name with name=... would solve the problem was unfullfilled.
I'll look into extending the gui elements to handle these issues. For now the only sections that are fully integrated with
the gui are those using the 'create ...' hoc statement.

With regard to the strange appearance of the SymbolChooser, I have seen that on one other machine but have
not been able to reproduce it on my machines. What is your machine type and OS?

tfoutz99
Posts: 12
Joined: Wed Dec 12, 2007 3:15 pm

Re: Neuron+Python+Gui

Post by tfoutz99 » Tue Jul 06, 2010 12:31 am

Thanks for the reply!
I'm running a macbook pro, Mac OS 10.6.3, and using the enthought distribution of python (2.6.4)

Post Reply