[Scipy-svn] r3128 - trunk/Lib/sandbox/pyem/examples

scipy-svn@scip... scipy-svn@scip...
Sun Jul 1 05:04:12 CDT 2007


Author: cdavid
Date: 2007-07-01 05:04:07 -0500 (Sun, 01 Jul 2007)
New Revision: 3128

Modified:
   trunk/Lib/sandbox/pyem/examples/utils.py
Log:
Add utils function to easily load pendigits data

Modified: trunk/Lib/sandbox/pyem/examples/utils.py
===================================================================
--- trunk/Lib/sandbox/pyem/examples/utils.py	2007-07-01 09:52:06 UTC (rev 3127)
+++ trunk/Lib/sandbox/pyem/examples/utils.py	2007-07-01 10:04:07 UTC (rev 3128)
@@ -1,5 +1,5 @@
 #! /usr/bin/env python
-# Last Change: Fri Jun 08 04:00 PM 2007 J
+# Last Change: Wed Jun 27 05:00 PM 2007 J
 
 # Various utilities for examples 
 
@@ -8,7 +8,7 @@
 
 # XXX: Bouah, hackish... Will go away once scipydata found its way
 set_package_path()
-from pyem.data import oldfaithful
+from pyem.data import oldfaithful, pendigits
 restore_path()
 
 def get_faithful():
@@ -31,6 +31,13 @@
 
     return N.concatenate((waiting, duration), 1)
 
+def get_pendigits():
+    """Return faithful data as a nx2 array, first column being duration, second
+    being waiting time."""
+    # Load faithful data, convert waiting into integer, remove L, M and S data
+    data = pendigits.load()
+    return data['training']['x'], data['training']['y']
+
 def scale(data):
     """ Scale data such as each col is in the range [0..1].
 



More information about the Scipy-svn mailing list