Revision: 5987
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5987&view=rev
Author: jdh2358
Date: 2008-08-07 00:15:55 +0000 (Thu, 07 Aug 2008)
Log Message:
-----------
add inf handling to rec2excel
Modified Paths:
--------------
trunk/matplotlib/lib/mpl_toolkits/exceltools.py
Modified: trunk/matplotlib/lib/mpl_toolkits/exceltools.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/exceltools.py 2008-08-07 00:14:15 UTC
(rev 5986)
+++ trunk/matplotlib/lib/mpl_toolkits/exceltools.py 2008-08-07 00:15:55 UTC
(rev 5987)
@@ -52,7 +52,7 @@
return format
-def rec2excel(r, ws, formatd=None, rownum=0, colnum=0, nanstr='NaN'):
+def rec2excel(r, ws, formatd=None, rownum=0, colnum=0, nanstr='NaN',
infstr='Inf'):
"""
save record array r to excel pyExcelerator worksheet ws
starting at rownum. if ws is string like, assume it is a
@@ -103,13 +103,17 @@
val = row[i]
format = formats[i]
val = format.toval(val)
- if format.xlstyle is None:
+ if mlab.safe_isnan(val):
+ ws.write(rownum, colnum+i, nanstr)
+ elif mlab.safe_isinf(val):
+ sgn = np.sign(val)
+ if sgn<0: s = infstr
+ else: s = '-%s'%infstr
+ ws.write(rownum, colnum+i, s)
+ elif format.xlstyle is None:
ws.write(rownum, colnum+i, val)
else:
- if mlab.safe_isnan(val):
- ws.write(rownum, colnum+i, nanstr)
- else:
- ws.write(rownum, colnum+i, val, format.xlstyle)
+ ws.write(rownum, colnum+i, val, format.xlstyle)
rownum += 1
if autosave:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins