Two instances of Neuron in a Python script
Posted: Wed Aug 20, 2008 12:28 pm
I tried to create a python class, that should create an instance of neuron:
Here a very simple example:
class neuron():
def __init__(self, tstop):
import neuron
self.h = neuron.h
self.h("tstop = %d"%tstop)
n1 = neuron(100)
n2 = neuron(500)
print n1.h.tstop
print n2.h.tstop
I expected that once a new object is created also a new neuron object will be created.. The neuron.h variable however seems to be kind of global: the result of this script ist:
500.0
500.0
Is it possible to create different hoc objects that do not see each other??
Thank you,
Armin
Here a very simple example:
class neuron():
def __init__(self, tstop):
import neuron
self.h = neuron.h
self.h("tstop = %d"%tstop)
n1 = neuron(100)
n2 = neuron(500)
print n1.h.tstop
print n2.h.tstop
I expected that once a new object is created also a new neuron object will be created.. The neuron.h variable however seems to be kind of global: the result of this script ist:
500.0
500.0
Is it possible to create different hoc objects that do not see each other??
Thank you,
Armin