a caveat

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

Moderator: hines

Post Reply
eacheon
Posts: 97
Joined: Wed Jan 18, 2006 2:20 pm

a caveat

Post by eacheon »

From a python shell, if I do

Code: Select all

>> import neuron
>> h = neuron.HocObject()
>> h("a = 10")
>> h("print a")
10

>> h.quit()  # this quits the python shell.
While I would rather destroy h instead of quit my python shell. Is it possible at all?

I was actually trying to clear everything I did with this session and would like to start a new simulation, however, it seems hard to manage without restarting a python shell:

Code: Select all

...
>> print h.a
10
>> "Let's try to clean up things"
>> del h
>> from sys import modules
>> del neuron
>> del modules['neuron.hoc']
>> del modules['neuron']

>> "try it again, will there be a fresh session?"
>> import neuron
>> h = neuron.HocObject()
>> print h.a
10
>> "nothing got cleaned. :("
So the h still points to the same HocObject that has everything I've done which has not been cleaned.
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Post by hines »

Restarting the hoc interpreter in a pristine
state is not supported. See
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=1029
However, since I don't know anything about ipython, I can assume you can easily unexport neuron and start over that
way.
eacheon
Posts: 97
Joined: Wed Jan 18, 2006 2:20 pm

Post by eacheon »

hines wrote:Restarting the hoc interpreter in a pristine
state is not supported. See
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=1029
However, since I don't know anything about ipython, I can assume you can easily unexport neuron and start over that
way.
That doesn't seem to be the case: it is pretty hard for python to do it:

http://groups.google.com/group/comp.lan ... d671363234
henriklinden

Post by henriklinden »

Hi,

I have the same problem as above. I have so far not found a way to successfully unimport NEURON from python in a way that a get a "fresh" NEURON process when I restart it.

Therefore, is there any other command besides quit() that would shut down the NEURON process?

Alternatively, is there a simple way to delete all variables and object within NEURON?
Post Reply