[Numpy-discussion] [Newbie] Fast plotting
John Hunter
jdh2358@gmail....
Wed Jan 7 10:14:44 CST 2009
On Wed, Jan 7, 2009 at 6:37 AM, Franck Pommereau
<pommereau@univ-paris12.fr> wrote:
> def f4 (x, y) :
> """Jean-Baptiste Rudant <boogaloojb@yahoo.fr>
>
> test 1 CPU times: 111.21s
> test 2 CPU times: 13.48s
>
> As Jean-Baptiste noticed, this solution is not very efficient (but
> works almost of-the-shelf).
> """
> recXY = numpy.rec.fromarrays((x, x), names='x, y')
> return matplotlib.mlab.rec_groupby(recXY, ('x',),
> (('y', numpy.mean, 'y_avg'),))
This probably will have no impact on your tests, but this looks like a
bug. You probably mean:
recXY = numpy.rec.fromarrays((x, y), names='x, y')
Could you post the code you use to generate you inputs (ie what is x?)
I will look into trying some of the suggestions here to improve the
performance on rec_groupby. One thing that slows it down is that it
supports an arbitrary number of keys -- eg groupby ('year', 'month')
-- whereas the examples above are using a single value lookup.
JDH
More information about the Numpy-discussion
mailing list