import neuron has side effects?

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

Moderator: hines

Post Reply
aluchko

import neuron has side effects?

Post by aluchko »

Unfortunately I can't post a concise test case since I'm having a lot of trouble with consistent reproducibility.

But I'd had a problem where I import some of my python code from hoc and end up having some trouble with the GUI. No errors or warnings show up, and the all hoc code after the python statement runs fine, but the panel associated with the code (created by a subsequent showopt call) simply doesn't show up.

I've narrowed it down to the python code calling "import neuron". Thus I have cases where I add the line
nrnpython("import neuron")
to my hoc code and do nothing else (I don't even call anymore python), and the panel doesn't show up. Are there some kind of side-effects going on when I import neuron that may be breaking the gui?

Note this isn't very reproducible, I've had a number of cases where I've thought I haven't changed anything and the bug simply vanishes for a while (on that note I'm running neuron straight from the repo and Ubuntu 10.10)
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: import neuron has side effects?

Post by ted »

aluchko wrote:I'm running neuron straight from the repo
Does this mean you obtained the latest development code from the mercurial repository, and built NEURON from that?
aluchko

Re: import neuron has side effects?

Post by aluchko »

ted wrote:
aluchko wrote:I'm running neuron straight from the repo
Does this mean you obtained the latest development code from the mercurial repository, and built NEURON from that?
My repo is based off of Tue Nov 02 12:23:11 2010 -0400
476:3ad72b90db90

I'll pull a newer repo tomorrow but I can't tonight as I just realized my source repo is on a machine that can't reach the outside world :/
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: import neuron has side effects?

Post by hines »

So far things are too vague for me to form an opinion. The only condition I am aware of where there is a problem with the gui is when
one launches nrniv and in the python world invokes
from neuron import gui
That is intended only for launching python when the event loop is controlled by the python world instead of by InterViews. It starts a timer which
calls the InterViews event handler every 0.1 seconds. The problem is that when nrniv is launched, the InterViews event handler and hoc are already
running in thread 0, and suddenly calling the event handler from another thread can cause troubles.
aluchko

Re: import neuron has side effects?

Post by aluchko »

I've tried from neuron import gui, hoc, h, help, and test, and all cause the problem, "import numby" however doesn't cause an issue so it's definitely something going on with the import neuron. Is there somewhere in the code I should look to get a better idea of what's being executed under the hood?

My changes aren't really 7.2 specific so I'll try backporting to 7.1 and see if I still have the problem.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: import neuron has side effects?

Post by hines »

Why don't we take this to email. Send me <michael dot hines at yale.edu> all the code necessary to exhibit
the problem along with instructions about how to launch.
Post Reply