Changeset 45

Show
Ignore:
Timestamp:
03/26/08 12:08:24 (10 months ago)
Author:
emuller
Message:

array conditional on numpy support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/nrnpython/neuron/__init__.py

    r44 r45  
    168168        return self.size() 
    169169 
    170     def __array__(self): 
    171         return self.x.__array__() 
     170    # define the __array__ method 
     171    # if numpy support is available 
     172    if not hoc.test_numpy()==None: 
     173        def __array__(self): 
     174            return self.x.__array__() 
    172175    
    173176    def __str__(self): 
  • trunk/src/nrnpython/nrnpy_hoc.cpp

    r44 r45  
    12051205 
    12061206static PyMethodDef hocobj_methods[] = { 
    1207   {"__array__",hocobj_tonumpy,METH_VARARGS,"__array__ returns a numpy array of self, for use with numpy.array function."}, 
     1207  {"__array__",hocobj_tonumpy,METH_VARARGS,"__array__ returns a numpy array of self, for use with numpy.array function.  Vector.x is currently supported."}, 
    12081208  {NULL, NULL, 0, NULL} 
    12091209};