[Scipy-svn] r4103 - in trunk/scipy/io/arff: . tests

scipy-svn@scip... scipy-svn@scip...
Mon Apr 7 19:15:56 CDT 2008


Author: cdavid
Date: 2008-04-07 19:15:48 -0500 (Mon, 07 Apr 2008)
New Revision: 4103

Modified:
   trunk/scipy/io/arff/arffread.py
   trunk/scipy/io/arff/tests/test_data.py
Log:
Rename read_arff to loadarff to be consistent with matlab io code.

Modified: trunk/scipy/io/arff/arffread.py
===================================================================
--- trunk/scipy/io/arff/arffread.py	2008-04-07 22:53:14 UTC (rev 4102)
+++ trunk/scipy/io/arff/arffread.py	2008-04-08 00:15:48 UTC (rev 4103)
@@ -10,7 +10,7 @@
 
 """A module to read arff files."""
 
-__all__ = ['MetaData', 'read_arff', 'ArffError', 'ParseArffError']
+__all__ = ['MetaData', 'loadarff', 'ArffError', 'ParseArffError']
 
 # An Arff file is basically two parts: 
 #   - header
@@ -333,7 +333,7 @@
     def __getitem__(self, key):
         return self._attributes[key]
 
-def read_arff(filename):
+def loadarff(filename):
     """Read an arff file.
 
     :Note:
@@ -474,14 +474,14 @@
         print msg
 
 def test_weka(filename):
-    data, meta = read_arff(filename)
+    data, meta = loadarff(filename)
     print len(data.dtype)
     print data.size
     for i in meta:
         print_attribute(i,meta[i],data[i])
 
 def floupi(filename):
-    data, meta = read_arff(filename)
+    data, meta = loadarff(filename)
     from attrselect import print_dataset_info
     print_dataset_info(data)
     print "relation %s, has %d instances" % (meta.name, data.size)

Modified: trunk/scipy/io/arff/tests/test_data.py
===================================================================
--- trunk/scipy/io/arff/tests/test_data.py	2008-04-07 22:53:14 UTC (rev 4102)
+++ trunk/scipy/io/arff/tests/test_data.py	2008-04-08 00:15:48 UTC (rev 4103)
@@ -5,7 +5,7 @@
 import numpy as N
 from scipy.testing import *
 
-from scipy.io.arff.arffread import read_arff
+from scipy.io.arff.arffread import loadarff
 
 data_path = os.path.join(os.path.dirname(__file__), 'data')
 
@@ -31,14 +31,14 @@
         self._test(test5)
 
     def _test(self, test_file):
-        data, meta = read_arff(test_file)
+        data, meta = loadarff(test_file)
         for i in range(len(data)):
             for j in range(4):
                 assert_array_almost_equal(expect4_data[i][j], data[i][j])
 
 class MissingDataTest(TestCase):
     def test_missing(self):
-        data, meta = read_arff(missing)
+        data, meta = loadarff(missing)
         for i in ['yop', 'yap']:
             assert_array_almost_equal(data[i], expect_missing[i])
 



More information about the Scipy-svn mailing list