[BioPython] Do you mean Numpy or Numeric?

Wolfgang Meyer wolfgang.meyer at gmail.com
Fri Feb 2 18:03:22 UTC 2007


Hi,

I read the previous posts about numpy / numeric confusions. I were also
stumbled by it very much and wanted some issues to be clarified.

In the documentation for BioPython on web, many input/output arrays
are specified as "Numpy arrays". However, I think it should be "Numeric
arrays".

Say in module KDTree


set_coords(self, coords)

Add the coordinates of the points.

o coords - two dimensional Numpy array of type "f". E.g. if the
points have dimensionality D and there are N points, the coords
array should be NxD dimensional.


If some users (e.g. me) takes this for serious and use a Numpy array as
input, the user will get nothing but an error:

File "KDTree.py", line 135, in set_coords
    if min(coords)<=-1e6 or max(coords)>=1e6:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()


Why? Because the function is expecting a Numeric array,
rather than Numpy array, which is specified in the documentation.

So why is this the case? I know Numeric is not under development
anymore, and Numpy is a "new" Numeric. But according to my
experiences they are really different in many aspects so far. If one
mixes them in programs, one can really have a lot headaches.
So I suggest to give real instructions in documentation, instead
of causing more confusions.

Thanks!
-- 
Wolfgang Meyer



More information about the Biopython mailing list