Page 1 of 1

'hoc.HocObject' object has no attribute 'instantiate'

Posted: Fri May 31, 2019 4:56 pm
by alexandrapierri
Hello

What is the general meaning behind the error: "a template cannot be redefined"?
In my case I am trying to stimulate a neuron written in a hoc template using a python script.
Is it because stimulating my cell modifies the template and modifying a template is not allowed?

thank you,
Alexandra

Re: NEURON: a template cannot be redefined

Posted: Sat Jun 01, 2019 12:52 am
by ted
What is the general meaning behind the error: "a template cannot be redefined"?
The general meaning is exactly what it says. The particular meaning is that someone may have to look at your code in order to discover the specific cause.
Is it because stimulating my cell modifies the template and modifying a template is not allowed?
Well, does it? Or, if you are just asking a general question about whether executing a simulation modifies a template, the answer is "not unless one is executing buggy user-written code." One example of the latter would be a program that includes two templates with the same name.

Re: 'hoc.HocObject' object has no attribute 'instantiate'

Posted: Mon Jun 03, 2019 9:23 pm
by alexandrapierri
Thank you Ted

I have done some further digging into the problem and I realize the the issue is with the instantiation of my cell model in python.
I changed the title to reflect the issue more accurately.

So I want to instantiate my cell model whose morphology is given in a cell template.
I get the error : 'hoc.HocObject' object has no attribute 'instantiate' when I try to instantiate my cell class.

What might be prohibiting me from instantiating my class model from python given that I have already adjusted my code to make sure it accepts cell morphologies written in hoc.

any input is appreciated, thank you.

Re: 'hoc.HocObject' object has no attribute 'instantiate'

Posted: Tue Jun 04, 2019 1:55 pm
by ted
Is there any fundamental problem when trying to instantiate a cell morphology written in a hoc template format instead of swc format for example?
No, but there are fundamental problems with all human-written code, specifically
* it is prone to contain errors
* a narrative description is generally not equivalent to the code that it seeks to describe
This is one such case. To provide further advice, I will have to see and execute the code that is giving you problems. If you zip it up and email it to me
ted dot carnevale at yale dot edu
I will be able to tell you what I find out.