Dear all:
With python, I am creating a cell class in a file name "MSP.py".
In the MSP.py, basically I define the cell class like
class Cell(object):
...
self.soma = h.Section(name='soma',cell=self)
self.dend = h.Section(name='dend',cell=self)
self.dend.connect(self.soma(1),0)
...
I can h.run() the model and save data, everything seems fine.
BUT the Model View is NOT working, it generates error as follow:
---------- error ----------
NEURON: syntax error
near line 0
{ModelViewRealCell[0].cellobj = <MSP}
^
ModelViewRealCell[0].execute("ModelViewRealCell[0].cellobj = <MSP")
ModelViewRealCell[0].init(ModelView[0])
ModelView[0].mkrlist()
ModelView[0].init(0)
---------- error ----------
Any suggestions ?
Youwei
PyNeuron Model View Error while calling the Py Class
Moderator: hines
-
- Posts: 41
- Joined: Sun Aug 08, 2010 11:09 am
-
- Posts: 41
- Joined: Sun Aug 08, 2010 11:09 am
Re: PyNeuron Model View Error while calling the Py Class
Hi
Maybe I ask the other way around, how can I generate "mview.hoc" file manually instead of clicking on the GUI->Tools-> Model View ?
Youwei
Maybe I ask the other way around, how can I generate "mview.hoc" file manually instead of clicking on the GUI->Tools-> Model View ?
Youwei
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: PyNeuron Model View Error while calling the Py Class
You have just described how to bring up a Model View tool manually.figoyouwei wrote:how can I generate "mview.hoc" file manually instead of clicking on the GUI->Tools-> Model View ?
Are you asking "how can I bring up a Model View tool by executing code"? If the answer is yes, here's how:
execute these two hoc statements, or their Python equivalents:
Code: Select all
load_file("mview.hoc")
execute("mview()")
-
- Posts: 41
- Joined: Sun Aug 08, 2010 11:09 am
Re: PyNeuron Model View Error while calling the Py Class
Thanks, Ted ! The model view code is useful ~
I guess here the main Python-Neuron problem is that ... when you load a hoc by calling h.load_file("bla.hoc"), the neuron model is callable from hoc. For example, suppose the neuron is called MSN in original hoc implementation. Then you can call it directly using h.MSN.soma, bla...bla...
But in python when I declare in a python class self.soma = h.Section(name='soma'), hoc is not recognizing any section that is created, because soma is created in the python class.
So what shall I do in a python class to make my model neuron callable by hoc ?
Hopefully that makes you better understand the problem.
I guess here the main Python-Neuron problem is that ... when you load a hoc by calling h.load_file("bla.hoc"), the neuron model is callable from hoc. For example, suppose the neuron is called MSN in original hoc implementation. Then you can call it directly using h.MSN.soma, bla...bla...
But in python when I declare in a python class self.soma = h.Section(name='soma'), hoc is not recognizing any section that is created, because soma is created in the python class.
So what shall I do in a python class to make my model neuron callable by hoc ?
Hopefully that makes you better understand the problem.
Re: PyNeuron Model View Error while calling the Py Class
It should work now. Some bugs in ModelView were fixed to allow viewing the properties of python cells.
http://www.neuron.yale.edu/hg/neuron/nr ... 67b0758be5
Note that the string name of a python object does not help one obtain a reference to the object.
http://www.neuron.yale.edu/hg/neuron/nr ... 67b0758be5
Note that the string name of a python object does not help one obtain a reference to the object.