Vector.as_numpy() error in Anaconda IPython

Post Reply
luke

Vector.as_numpy() error in Anaconda IPython

Post by luke »

Hi all,

We've installed the latest neuron 64 bit as recommended (in the guide https://www.neuron.yale.edu/ftp/neuron/ ... nstall.pdf) on two machines (one windows 7, one windows 10). Neuron works fine, also when not started via the nrniv_python shortcut but imported inside an IPython console session. However, in the latter case the function Vector.as_numpy() throws the following error:

Code: Select all

In [1]: from neuron import h
NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits


In [2]: import numpy

In [3]: ta = h.Vector(range(10))

In [4]: tb = ta.as_numpy()
NEURON: Vector.as_numpy() error
 near line 0
 objref hoc_obj_[2]
                   ^
        Vector[0].as_numpy()
oc_restore_code tobj_count=1 should be 0
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-4-5dd7ac0d1976> in <module>()
----> 1 tb = ta.as_numpy()

RuntimeError: hoc error
If neuron is run via the nrniv_python shortcut, it works fine and gives the following output:

Code: Select all

>>> from neuron import h
>>> import numpy
>>> ta = h.Vector(range(10))
>>> tb = ta.as_numpy()
>>> tb
array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.])
Is there any way to fix this? It would be convenient to run our NEURON code with the IPython console and e.g. the Spyder IDE that comes with Anaconda.

Cheers,
Lucas.
luke

Re: Vector.as_numpy() error in Anaconda IPython

Post by luke »

Update: this seems to be fixed in the 7.5 alpha release downloaded at https://www.neuron.yale.edu/ftp/neuron/ ... -setup.exe
Post Reply