I am reporting here an issue that I have specifically with ipython, while *the same code in python seems to work fine*.
I have converted an .swc cell morphology file to a .hoc file using the Neuron GUI (Import 3D _ cell builder).
With an ipython console I then load this file into neuron using
import neuron
neuron.h.load_file(<FileName>)
This runs without errors, but all dimensions of the loaded sections have been truncated to the lowest integer. For example, I get zero for
neuron.h.dend[0].diam3d(k)
for any k within the acceptable range of this section.
A zero diameter obviously leads to further errors.
I tested on 2 unix machines with
ubuntu 16.4 LTS/ubuntu 17.10
python 2.7 and python 3
ipython 6.0 and ipython 5.0
I could not figure out what in ipython causes this issue. I would assume it has to do with division, but imposing
from __future__ import division
does not seem to fix it.
Do you have any idea what can cause this behavior. Not being able to use ipython poses challenges, besides it takes a lot of time to figure out ipython is the issue, has for example spyder only has ipython console support (no python console anymore).
I am pasting below the parts of my .hoc file
Many thanks,
Michel
Code: Select all
%%%%% .hoc file %%%%
proc celldef() {
topol()
subsets()
geom()
biophys()
geom_nseg()
}
create soma, dend[57], apic[101]
proc topol() { local i
connect dend(0), soma(0.5)
for i = 1, 4 connect dend[i](0), dend[i-1](1)
connect dend[5](0), dend[3](1)
connect dend[6](0), dend[2](1)
for i = 7, 8 connect dend[i](0), dend[6](1)
connect dend[9](0), dend[1](1)
for i = 10, 11 connect dend[i](0), dend[9](1)
connect dend[12](0), dend(1)
%%%%%%%%% skipping many lines here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%
for i = 96, 97 connect apic[i](0), apic[95](1)
connect apic[98](0), apic[6](1)
for i = 99, 100 connect apic[i](0), apic[98](1)
basic_shape()
}
proc shape3d_1() {
soma {pt3dclear()
pt3dadd(0, 0, 30, 20)
pt3dadd(10, 0, 30, 20)
pt3dadd(20, 0, 30, 20)
}
dend {pt3dclear()
pt3dstyle(1, 10, 0, 30)
pt3dadd(-0.09, 1.2, 30, 0.7)
pt3dadd(-0.8, 2, 30.2, 0.7)
pt3dadd(-2.1, 2.6, 30.7, 0.7)
pt3dadd(-3.1, 3, 31.1, 0.7)
pt3dadd(-4.09, 3.3, 31.6, 0.7)
pt3dadd(-4.9, 3.5, 32.1, 0.7)
pt3dadd(-6.7, 3.8, 33.29, 0.7)
pt3dadd(-7.3, 4.09, 33.79, 0.7)
pt3dadd(-7.8, 4.59, 34.29, 0.7)
pt3dadd(-8.5, 5.2, 35, 0.7)
pt3dadd(-8.9, 5.7, 35.5, 0.7)
pt3dadd(-9.5, 6.5, 36.29, 0.7)
pt3dadd(-10.4, 7.1, 37.2, 0.7)
pt3dadd(-11.1, 7.3, 37.79, 0.7)
pt3dadd(-11.9, 7.7, 38.6, 0.7)
pt3dadd(-12.5, 8.1, 39.2, 0.7)
pt3dadd(-13.3, 8.4, 39.9, 0.7)
pt3dadd(-14.9, 9.1, 41.4, 0.7)
pt3dadd(-16.7, 10.1, 43.1, 0.7)
pt3dadd(-17.6, 10.6, 43.9, 0.7)
pt3dadd(-19.1, 11.3, 45, 0.7)
pt3dadd(-19.89, 11.9, 45.7, 0.7)
pt3dadd(-20.39, 12.2, 46, 0.7)
pt3dadd(-21.2, 12.2, 46.4, 0.7)
pt3dadd(-24.8, 12.2, 47.8, 0.7)
pt3dadd(-26, 12.2, 48, 0.7)
pt3dadd(-26.8, 12.6, 48, 0.7)
}
%%%%%%%% skipping many lines here %%%%%%%%%
%%%%%%%%%%%%%%%%%%%
proc basic_shape() {
shape3d_1()
shape3d_2()
shape3d_3()
shape3d_4()
shape3d_5()
shape3d_6()
shape3d_7()
shape3d_8()
shape3d_9()
shape3d_10()
shape3d_11()
shape3d_12()
shape3d_13()
shape3d_14()
shape3d_15()
shape3d_16()
shape3d_17()
shape3d_18()
shape3d_19()
shape3d_20()
shape3d_21()
shape3d_22()
shape3d_23()
shape3d_24()
shape3d_25()
shape3d_26()
shape3d_27()
shape3d_28()
shape3d_29()
shape3d_30()
shape3d_31()
shape3d_32()
shape3d_33()
shape3d_34()
shape3d_35()
shape3d_36()
shape3d_37()
shape3d_38()
}
objref all, somatic, basal, apical
proc subsets() { local i
objref all, somatic, basal, apical
all = new SectionList()
soma all.append()
for i=0, 56 dend[i] all.append()
for i=0, 100 apic[i] all.append()
somatic = new SectionList()
soma somatic.append()
basal = new SectionList()
for i=0, 56 dend[i] basal.append()
apical = new SectionList()
for i=0, 100 apic[i] apical.append()
}
proc geom() {
}
proc geom_nseg() {
}
proc biophys() {
}
access soma
celldef()