A Tuesday 16 March 2010 11:50:05 Gabriel J.L. Beckers escrigué: > Dear list, > > I ran into the following. > > If you multiply a 10-element pytables array with a 1-element NumPy array > using tables.expr, then the return value has length one. If you do the > same in pure NumPy, the > return value has length 10.
Yes, this seems a bug. I opened a ticket: http://www.pytables.org/trac/ticket/269 Meanwhile, a workaround is to use scalars for constants instead or arrays of length 1. Here it is a working example: import tables as tb import numpy as np f = tb.openFile('test.h5', 'w') factor = np.array([3.]) factor0 = factor[0] ar = np.arange(10.) # PyTables ar = f.createArray(f.root, 'test1', ar) e = tb.Expr('factor0*ar') print e.eval() # [ 0. 3. 6. 9. 12. 15. 18. 21. 24. 27.] # NumPy print factor*ar # [ 0. 3. 6. 9. 12. 15. 18. 21. 24. 27.] f.close() Thanks for reporting! -- Francesc Alted ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users