Bar charts

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
(except for developer of wxpyplot) without some good code
analysis/refactoring tools (which I haven't found for Python). With Python
it is a heck of a lot of work to figure out what numeric.array methods are
used in each function, and even once you do that, you have to change things
like Numeric.max.reduce() with equivalent code, appearing in several places
in wxpyplot. That said, it sure would be nice to have a "wxPyPlotLite" :slight_smile:
It's a pitty the developer didn't factor out the "container type" (as would
likely have happened in C++).

Oliver

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" :slight_smile:
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

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
(except for developer of wxpyplot) without some good code
analysis/refactoring tools (which I haven't found for Python). With Python
it is a heck of a lot of work to figure out what numeric.array methods are
used in each function, and even once you do that, you have to change things
like Numeric.max.reduce() with equivalent code, appearing in several places
in wxpyplot. That said, it sure would be nice to have a "wxPyPlotLite" :slight_smile:

I agree, Its not as easy as it looks. A few months ago I took a stab at removing numarray dependency and I soon realized that its more trouble than its worth. OTOH, its not that hard living with the dependency.

Bob

Chris Barker wrote:

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...

I'm learning the beauty of numarray right now. :slight_smile: For a real simple example, to add two lists:

- python: seq = map(add, seq, seq)

- numarray: seq = seq + seq

or

seq = add(seq, seq)

Either way its easier in numarray.

Bob