From: Francesc A. <fa...@py...> - 2004-11-19 08:09:06
|
Hi Andrea, A Dijous 18 Novembre 2004 18:42, vareu escriure: > For many reason that are not important here, I'd like to have PyTables > compiled against Numeric and not numarray. Searching PyTables site and > docs, I've found the following lines in the README.txt: [snip] > > # Finally, check for numarray > > try: > > import numarray > > except: > > print """\ > > Can't find a local numarray > > Python installation. > > Please, read carefully the README and remember > > that PyTables needs the numarray package to > > compile and run.""" > > Could you explain this a little further? If I change the setup.py > script to check against Numeric instead of against numarray will > PyTables compile anyway? No, you *need* numarray installed. numarray objects are supported natively, while Numeric is supported through conversions, i.e. when saving, the Numeric arrays are converted to numarray objects. This conversion tries to be as efficient as possible, and for contiguous Numeric objects, the same buffer area is used: naarr = numarray.array(buffer(Narr), type=Narr.typecode(), shape=Narr.shape) However, when the Numarray object is non-contiguous, a memory-copy is done: naarr = numarray.array(buffer(Narr.copy()), type=Narr.typecode(), shape=Narr.shape) When retrieving the object, the FLAVOR attribute is checked, and if the object saved was Numeric, then a converion from numarray to Numeric is done. In this case, a memory-copy is always made, though: Narr=Numeric.array(naarr.tolist(), typecode=naarr.typecode()) Hope that helps to understand what happens behind the scenes, -- Francesc Altet |