Cannot access range variable from external mechanism

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

Moderator: hines

Post Reply
sgratiy
Posts: 41
Joined: Tue Mar 30, 2010 5:33 pm

Cannot access range variable from external mechanism

Post by sgratiy »

I have problems with accessing a range variable defined in the custom mechanism when using python as a interpreter. However, when working directly in neuron I have no problem:

I create a cell object L2_BC[0] from class where I insert a custom mechanism xtra.mod (see at the end of file for the code)
which basically creates x,y,z range variables for coordinates of segment centers. I also have a member function which I call from

Code: Select all

proc init()
to calculate those segment centers. Unfortunately, when running the code with python as interpreters I get this error:

Code: Select all

>>> h.L2_BC[0].dend[17].x_xtra(0.3)
Traceback (most recent call last):
  File "stdin", line 1, in <module>
TypeError: 'float' object is not callable
when using neuron only however, my code works:

Code: Select all

oc>L2_BC[0].dend[17].x_xtra(0.3)
        69.102923
Could you please help me resolve the issue, so that I could run the code with python as an interpreter

below is my xtra.mod:

Code: Select all

NEURON {
	SUFFIX xtra
	RANGE x, y, z
}

PARAMETER {
	x = 0 (1) : spatial coords
	y = 0 (1)
	z = 0 (1)
}

ASSIGNED {
	v (millivolts)
	area (micron2)
}

INITIAL {

}

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

Re: Cannot access range variable from external mechanism

Post by ted »

If L2_BC[0].dend[17].x_xtra(0.3) is the hoc name of the variable you want, I bet the Python name is something like
L2_BC[0].dend[17](0.3).xtra.x
or
h.L2_BC[0].dend[17](0.3).xtra.x
sgratiy
Posts: 41
Joined: Tue Mar 30, 2010 5:33 pm

Re: Cannot access range variable from external mechanism

Post by sgratiy »

thanks
Post Reply