Hi,

While testing Psyco V2 to see if it would offer any speed improvements I 
tried it with some applications using matplotlib. Exceptions were raised 
that were easily resolved by replacing calls to min() and max() with 
their numpy equivalents numpy.amin() and numpy.amax() in the matplotlib 
code.

Simply demonstrated by inserting at the beginning of, say, matplotlib's 
examples/api/barchart_demo.py :

import psyco
psyco.full()

which caused:

Traceback (most recent call last):
   File "barchart_demo.py", line 29, in <module>
     ax.set_xticks(ind+width)
   File "c:\python26\lib\site-packages\matplotlib\axes.py", line 2064, 
in set_xticks
     return self.xaxis.set_ticks(ticks, minor=minor)
   File "c:\python26\lib\site-packages\matplotlib\axis.py", line 1154, 
in set_ticks
     self.set_view_interval(min(ticks), max(ticks))
   File "c:\python26\lib\site-packages\psyco\builtin.py", line 75, in min
     return _min(*args)
   File "c:\python26\lib\site-packages\psyco\builtin.py", line 34, in _min
     if not iterable:
ValueError: The truth value of an array with more than one element is 
ambiguous. Use a.any() or a.all()


software used:

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import psyco
 >>> psyco.version_info
(2, 0, 0, 'final', 0)
 >>> import numpy
 >>> numpy.version.version
'1.4.1'
 >>> import matplotlib
 >>> matplotlib.__version__
'0.99.3'


Psyco V2 is available from: http://codespeak.net/svn/psyco/v2/dist/

Should numpy.min()/numpy.amin() be used on array like objects within 
matplotlib, or is min() adequate ? Ditto max().


Stephen Evans

(Out of interest I came across numpy ticket #1286 while looking for this 
issue.)






------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to