Schoenborn, Oliver wrote:
You're right numeric or numarry is not required for small sets, but it would
be the quickest just to use it. If you don't like that, it would be easy to modify the code to do without it.
Actually removing the dependency of wxplyplot on numarray is no easy task
That said, it sure would be nice to have a "wxPyPlotLite"
It's a pitty the developer didn't factor out the "container type" (as would
likely have happened in C++).
Huh? it is factored out, the "container type" is a Numeric array. All you need any container that supports the Numeric operations and methods that wxPyPlot uses. As an example, you can probably just drop numarray in in place of Numeric, and have it just work. Of course, numarray was designed specifically to do this...
What would be different in C++ ?. Were one to write a similar app using Blitz++ arrays, it would be equally ugly to re-factor it not to use them.
it sure would be nice to have a "wxPyPlotLite"
The best way to do this would be to make a "Numeric Lite", and then just use that in wxPyPlot. Then I could use it with FloatCanvas as well. If anyone wants to work on this, I have a good chunk of it done (courtesy of some folks on the NumPy list)
One thing to keep in mind here is that the benefits of NumPy go beyond performance. Numeric provides a very nice syntax for working with arrays of numbers, even if they are small. I use it all over the place, even with what are often just two element arrays. For example, from FloatCanvas, to move a polygon whose points are represented by a (N,2) NumPy array, and Delta is a (dx,dy) array:
self.Points += Delta
as apposed to:
for point in points:
point[0] += delta[0]
point[1] += delta[1]
besides being faster, the former is cleaner and less error prone. Maybe not a huge difference, but it adds up.
-Chris