trouble with "import neuron"

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

Moderator: hines

Post Reply
davidlmorton
Posts: 10
Joined: Fri Apr 11, 2008 11:07 pm

trouble with "import neuron"

Post by davidlmorton »

With your help from before, nrniv -python loads okay but now when I
import neuron I have some strange behavior. After the import, the command line interpreter stops processing arrow command movement
keys and anything I type gets echoed back in an odd way. Here is an
example:

Code: Select all

[1:08am]@Sakurai:~>nrniv -python
NEURON -- VERSION 6.0.pygetsetcall.23 (35) 2007-05-23
by John W. Moore, Michael Hines, and Ted Carnevale
Duke and Yale University -- Copyright 1984-2007

>>> import neuron
>>> neuron.h("create soma")
neuron.h("create soma")
euron.h("create soma")
uron.h("create soma")
ron.h("create soma")
on.h("create soma")
n.h("create soma")
.h("create soma")
h("create soma")
("create soma")
"create soma")
create soma")
reate soma")
eate soma")
ate soma")
te soma")
e soma")
 soma")
soma")
oma")
ma")
a")
")
)

1
>>> neuron.h("soma.v")
neuron.h("soma.v")
euron.h("soma.v")
uron.h("soma.v")
ron.h("soma.v")
on.h("soma.v")
n.h("soma.v")
.h("soma.v")
h("soma.v")
("soma.v")
"soma.v")
soma.v")
oma.v")
ma.v")
a.v")
.v")
v")
")
)

        -65 
1
Any ideas?

As an asside, I tried to get the nrnpython/setup.py to install and it tries to use a -R/path/to/something switch which mac gcc can't handle.

Thanks in advance,

David Morton[/code]
Last edited by davidlmorton on Tue Apr 15, 2008 2:16 pm, edited 3 times in total.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Reminds me of walking in total darkness in an unfamiliar room. Suggest that you work
your way through Andrew Davison's tutorials, specifically
Accessing hoc from Python
and
Modelling single cells in NEURON with the Python interpreter
You'll find them on the Documentation page:
http://www.neuron.yale.edu/neuron/docs
davidlmorton
Posts: 10
Joined: Fri Apr 11, 2008 11:07 pm

Tutorials have the same issue

Post by davidlmorton »

I tried running through the tutorial and here is the result:

Code: Select all


[1:03pm]@Sakurai:~>nrniv -python
NEURON -- VERSION 6.0.pygetsetcall.23 (35) 2007-05-23
by John W. Moore, Michael Hines, and Ted Carnevale
Duke and Yale University -- Copyright 1984-2007

>>> from neuron import h
>>> h
h

TopLevelHocInterpreter
>>> h.dt
h.dt
.dt
dt
t

0.025000000000000001
>>> h.finitialize()
h.finitialize()
.finitialize()
finitialize()
initialize()
nitialize()
itialize()
tialize()
ialize()
alize()
lize()
ize()
ze()
e()
()
)

1.0
>>> h('x = 2')
h('x = 2')
('x = 2')
'x = 2')
x = 2')
 = 2')
= 2')
 2')
2')
')
)

first instance of x
1
As soon as I import the neuron module it messes up the CLI and I can't even ctrl-D to exit I have to import sys and sys.exit(). If I import some other module it does not have this issue.

Code: Select all

[1:04pm]@Sakurai:~>nrniv -python
NEURON -- VERSION 6.0.pygetsetcall.23 (35) 2007-05-23
by John W. Moore, Michael Hines, and Ted Carnevale
Duke and Yale University -- Copyright 1984-2007

>>> import numpy
>>> numpy.test()
  Found 5 tests for numpy.distutils.misc_util
  Found 3 tests for numpy.lib.getlimits
  Found 31 tests for numpy.core.numerictypes
  Found 32 tests for numpy.linalg
  Found 13 tests for numpy.core.umath
  Found 4 tests for numpy.core.scalarmath
  Found 9 tests for numpy.lib.arraysetops
  Found 42 tests for numpy.lib.type_check
  Found 188 tests for numpy.core.multiarray
  Found 3 tests for numpy.fft.helper
  Found 36 tests for numpy.core.ma
  Found 1 tests for numpy.fft.fftpack
  Found 12 tests for numpy.lib.twodim_base
  Found 10 tests for numpy.core.defmatrix
  Found 1 tests for numpy.lib.ufunclike
  Found 4 tests for numpy.ctypeslib
  Found 41 tests for numpy.lib.function_base
  Found 2 tests for numpy.lib.polynomial
  Found 9 tests for numpy.core.records
  Found 26 tests for numpy.core.numeric
  Found 4 tests for numpy.lib.index_tricks
  Found 47 tests for numpy.lib.shape_base
  Found 0 tests for __main__
......................................................................................................
......................................................................................................
......................................................................................................
......................................................................................................
......................................................................................................
.............
----------------------------------------------------------------------
Ran 523 tests in 1.737s

OK
<unittest.TextTestRunner object at 0x348dbb0>
>>> 
[1:08pm]@Sakurai:~>
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Post by hines »

NEURON -- VERSION 6.0.pygetsetcall.23 (35) 2007-05-23
You are using an old development branch that is very far out of date. Try the latest
alpha version at
http://www.neuron.yale.edu/ftp/neuron/versions/alpha/
davidlmorton
Posts: 10
Joined: Fri Apr 11, 2008 11:07 pm

Thanks again

Post by davidlmorton »

I guess I followed some bad advice about getting the latest svn version (or I got a developement branch instead of a release branch). Thanks again for the information. I couldn't get it to compile universal and then had troubles running it, but the .dmg for 10.4 seems to be working great.

I really appreciate that you are responsive and that you make binaries for the mac available.
Post Reply