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

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

Moderator: hines

Post Reply
alexandrapierri
Posts: 21
Joined: Wed Jun 17, 2015 5:31 pm

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

Post by alexandrapierri » Fri May 31, 2019 4:56 pm

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
Last edited by alexandrapierri on Mon Jun 03, 2019 9:15 pm, edited 1 time in total.

ted
Site Admin
Posts: 5633
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: NEURON: a template cannot be redefined

Post by ted » Sat Jun 01, 2019 12:52 am

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.

alexandrapierri
Posts: 21
Joined: Wed Jun 17, 2015 5:31 pm

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

Post by alexandrapierri » Mon Jun 03, 2019 9:23 pm

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.
Last edited by alexandrapierri on Tue Jun 04, 2019 2:22 pm, edited 1 time in total.

ted
Site Admin
Posts: 5633
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

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

Post by ted » Tue Jun 04, 2019 1:55 pm

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.

Post Reply