Page 1 of 2
h.n3d() returns 0
Posted: Tue Sep 03, 2013 2:25 am
by ioannisv
Hi
I have followed your instructions about the temperature dependence.
(moderator's comment: see
viewtopic.php?f=15&t=2107)
The problem is that every time I compile the mod file the h.n3d() function returns 0
I thought it was because I did something wrong but apparently every file that I compile returns zero. I even took some mod and hoc files from the modeldb database, like the original fh.mod and the are not compiling correctly.
Any idea what might be not working correctly?
Thanks!
Re: h.n3d() returns 0
Posted: Tue Sep 03, 2013 9:32 am
by ted
ioannisv wrote:every time I compile the mod file the h.n3d() function returns 0
n3d() has nothing to do with any mod file. Was there something in this thread that suggested otherwise? For n3d() to return a nonzero value, a section's geometry must either have been specified with pt3dadd statements, or define_shape() must have been called. For more information about these and related facts, please read the Programmer's Reference documentation regarding Geometry.
http://www.neuron.yale.edu/neuron/stati ... l#Geometry
I even took some mod and hoc files from the modeldb database, like the original fh.mod and the are not compiling correctly.
This sounds like a serious problem. Specifically what files did you evaluate, and what was the evidence that they "are not compiling correctly"?
Re: h.n3d() returns 0
Posted: Tue Sep 03, 2013 9:44 am
by ioannisv
I am more than shure that I am defining geometries in the hoc file.
I compiled both the original Frakenhauser Huxley (fh.mod) and the original Hodgkin Huxley (hh.mod) from the database.
After loading the dll and the hoc files every time when I called the h.n3d() command it kept returning zero.
Re: h.n3d() returns 0
Posted: Tue Sep 03, 2013 10:02 am
by ted
ioannisv wrote:I am more than shure that I am defining geometries in the hoc file.
That's not the issue. The issue is whether you defined section geometry by executing pt3dadd statements or simply by assigning values to L and diam (and then didn't call define_shape()). Suggest you read the material that I mentioned.
I compiled both the original Frakenhauser Huxley (fh.mod) and the original Hodgkin Huxley (hh.mod) from the database.
After loading the dll and the hoc files every time when I called the h.n3d() command it kept returning zero.
That's like saying "I put air in the tires, but the gas tank is still empty." Code in mod files is used to add new biophysical mechanisms to NEURON, or to define new classes of artificial spiking cells, or to add arbitrary C or NMODL code. It has no effect on the specification of geometry.
Re: h.n3d() returns 0
Posted: Tue Sep 03, 2013 10:21 am
by ioannisv
pt3dadd is called in my hoc file:
Code: Select all
proc basic_shape() { local x, y, z
x = -0.5*(_axoninter*_Li - _w)
y = _dEl
z = 0
for i=0, _axonnodes-1 {
internode[i] { pt3dclear()
pt3dadd(x, y, z, _d)
x = x + _Li - _w
pt3dadd(x, y, z, _d)
}
node[i] { pt3dclear()
pt3dadd(x, y, z, _d)
x = x + _w
pt3dadd(x, y, z, _d)
}
}
internode[_axonnodes] { pt3dclear()
pt3dadd(x, y, z, _d)
x = x + _Li - _w
pt3dadd(x, y, z, _d)
}
}
_axonnodes is defined as a predetermined variable of value 9, _axoninter = _axonnodes+1
Re: h.n3d() returns 0
Posted: Tue Sep 03, 2013 10:45 am
by ted
Looks like those sections should have nonzero n3d(). How are you calling n3d()?
Re: h.n3d() returns 0
Posted: Tue Sep 03, 2013 11:06 am
by ioannisv
Code: Select all
from neuron import h
Section = h.Section
h.load_file(0, "C:\nrn73w64\lib\hoc\stdlib.hoc")
h.nrn_load_dll("C:/Users/Ioannis/Desktop/fh(T)/nrnmech.dll")
h.load_file(1,"C:/Users/Ioannis/Desktop/fhT)/fht.hoc")
nn = h.n3d()
Re: h.n3d() returns 0
Posted: Tue Sep 03, 2013 11:05 pm
by ted
I really don't know what to say, except that it seems likely that the geometry of the default section that your hoc code creates was specified with the stylized method and therefore has no 3d points. Here is a sequence of commands I just now executed, along with NEURON's replies:
Code: Select all
>>> from neuron import h
>>> h.load_file("cell.hoc") # has many sections, all geometries specified with 3d points
>>> h.psection()
soma { nseg=1 L=37.101 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert morphology { diam=22.0682}
insert capacitance { cm=1}
}
1.0
>>> h.n3d() # I already know that soma has 28 pt3d points
28.0
>>> for sec in h.allsec():
... print h.secname(), h.n3d()
...
soma 28.0
dendrite_8 38.0
dendrite_7[0] 6.0
dendrite_7[1] 7.0
. . . etc. usw ad not quite infinitum . . .
It would be quite a surprise to discover that someone has managed to create a mod file, written entirely in NMODL code and including no vicous C statements in VERBATIM blocks, that destroys pt3d data. Have you examined the hoc file that contains the statements that define your model cell's geometry? Is the problem perhaps that there is no default section (in which case I would expect h.psection() to return an error message).
Re: h.n3d() returns 0
Posted: Wed Sep 04, 2013 2:16 am
by ioannisv
The thing is that I have some files from previous people and they are working, they are not returning zero.
In the beginning I thought I had something wrong with my hoc/mod files but then when I recompiled the files that were working before they are now returning zero as well
That's why I said at my first post about compiling "error".
Thanks anyway.
Re: h.n3d() returns 0
Posted: Wed Sep 04, 2013 11:06 am
by ted
Something is definitely wrong, but it looks like I'll have to be able to reproduce the problem myself in order to advise you properly. Could you please zip up just enough source code (hoc, mod, ses, py files) to reproduce the problem and email it to ted dot carnevale at yale dot edu?
Re: h.n3d() returns 0
Posted: Thu Sep 05, 2013 4:49 am
by ioannisv
They are in your email with subject h.n3d()
Thanks
Re: h.n3d() returns 0
Posted: Thu Sep 05, 2013 12:44 pm
by ted
First I just compiled the mod files and executed the hoc file that defines the model cell.
Code: Select all
[ted@loki ioannis]$ nrngui SENNT.hoc
NEURON -- Release 7.3 (927:f3dcf53fbe74) 2013-07-27
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2013
See http://www.neuron.yale.edu/neuron/credits
loading membrane mechanisms from /home/ted/myhoc/ioannis/i686/.libs/libnrnmech.so
Additional mechanisms from files
SENNT.mod
Note that there was no need for load_dll because I was in the same directory as the hoc, py, and compiled mod file, so NEURON automatically knew where to find the compiled mechanisms.
Next I verified that a default section exists and that all sections have pt3d data.
Code: Select all
oc>secname()
node[0]
oc>forall print secname(), " ", n3d()
node[0] 2
node[1] 2
node[2] 2
node[3] 2
node[4] 2
node[5] 2
node[6] 2
node[7] 2
node[8] 2
internode[0] 2
internode[1] 2
internode[2] 2
internode[3] 2
internode[4] 2
internode[5] 2
internode[6] 2
internode[7] 2
internode[8] 2
internode[9] 2
Next I used test.py. Since I was running NEURON from the directory that contained the hoc, py, and compiled mod file, I changed test.py to
Code: Select all
from neuron import h
Section = h.Section
# h.load_file("C:/nrn73w64/lib/hoc/stdlib.hoc")
# h.nrn_load_dll("C:/Users/Ioannis/Desktop/SENN(T)/nrnmech.dll")
# h.load_file(1,"C:/Users/Ioannis/Desktop/SENN(T)/SENNT.hoc")
h.load_file("SENNT.hoc")
print h.n3d()
After making those changes, I executed test.py by
Code: Select all
[ted@loki ioannis]$ nrngui -python test.py
NEURON -- Release 7.3 (927:f3dcf53fbe74) 2013-07-27
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2013
See http://www.neuron.yale.edu/neuron/credits
loading membrane mechanisms from /home/ted/myhoc/ioannis/i686/.libs/libnrnmech.so
Additional mechanisms from files
SENNT.mod
2.0
So h.n3d() returned a nonzero value.
Next I wanted to double check that the default section existed and was known to Python
so the answers are yes and yes.
Finally, I wanted to verify that all sections had pt3d data
Code: Select all
>>> for sec in h.allsec():
... print h.secname(), h.n3d()
...
node[0] 2.0
node[1] 2.0
node[2] 2.0
node[3] 2.0
node[4] 2.0
node[5] 2.0
node[6] 2.0
node[7] 2.0
node[8] 2.0
internode[0] 2.0
internode[1] 2.0
internode[2] 2.0
internode[3] 2.0
internode[4] 2.0
internode[5] 2.0
internode[6] 2.0
internode[7] 2.0
internode[8] 2.0
internode[9] 2.0
and indeed they do.
So now the question is why your experience was different. Are you sure that NEURON loaded your dll (should have printed a msg like "additional mechanisms from ...") and your hoc code? Were there any error messages, like "section access not specified"?
Re: h.n3d() returns 0
Posted: Mon Sep 09, 2013 5:18 am
by ioannisv
running the functions through hoc returned 2
running the functions through python when trying to load the compiled dll file the console now returns
Ladlibrary failed with error 193 dlopen failed
Re: h.n3d() returns 0
Posted: Mon Sep 09, 2013 10:09 am
by ted
Exactly what is the first line that NEURON prints to its terminal when it starts? Should look something like this:
NEURON -- Release 7.3 (927:f3dcf53fbe74) 2013-07-27
Why do you have to explicity load the dll? Aren't your hoc and py files in the same directory as the dll, so that NEURON loads the dll automatically? Does NEURON print a statement that looks like this?
Code: Select all
loading membrane mechanisms from . . . [name of some file here]
Additional mechanisms from files
SENNT.mod
(should be a few lines after the one that tells which release of NEURON you're using)
Re: h.n3d() returns 0
Posted: Wed Sep 11, 2013 3:11 am
by ioannisv
I finally figured it out.
It was a conflict with my pythonpath, the neuron module imported and the python platform I was using.
Thanks for all the help.