[Scipy-svn] r4426 - in trunk/scipy/stats: . tests

scipy-svn@scip... scipy-svn@scip...
Wed Jun 11 10:38:27 CDT 2008


Author: cdavid
Date: 2008-06-11 10:38:20 -0500 (Wed, 11 Jun 2008)
New Revision: 4426

Modified:
   trunk/scipy/stats/stats.py
   trunk/scipy/stats/tests/test_stats.py
Log:
Put nanmean, nanstd and nanmedian into scipy.stats namespace + adapt tests.

Modified: trunk/scipy/stats/stats.py
===================================================================
--- trunk/scipy/stats/stats.py	2008-06-11 15:36:30 UTC (rev 4425)
+++ trunk/scipy/stats/stats.py	2008-06-11 15:38:20 UTC (rev 4426)
@@ -50,6 +50,10 @@
           kurtosis
           normaltest (for arrays only)
 
+MOMENTS HANDLING NAN: nanmean
+                      nanmedian
+                      nanstd
+
 ALTERED VERSIONS:  tmean
                    tvar
                    tstd
@@ -214,6 +218,7 @@
            'f_value', 'f_value_multivariate',
            'ss', 'square_of_sums',
            'fastsort', 'rankdata',
+           'nanmean', 'nanstd', 'nanmedian',
           ]
 
 

Modified: trunk/scipy/stats/tests/test_stats.py
===================================================================
--- trunk/scipy/stats/tests/test_stats.py	2008-06-11 15:36:30 UTC (rev 4425)
+++ trunk/scipy/stats/tests/test_stats.py	2008-06-11 15:38:20 UTC (rev 4426)
@@ -197,47 +197,47 @@
 
     def test_nanmean_none(self):
         """Check nanmean when no values are nan."""
-        m = stats.stats.nanmean(X)
+        m = stats.nanmean(X)
         assert_approx_equal(m, X[4])
 
     def test_nanmean_some(self):
         """Check nanmean when some values only are nan."""
-        m = stats.stats.nanmean(self.Xsome)
+        m = stats.nanmean(self.Xsome)
         assert_approx_equal(m, 5.5)
 
     def test_nanmean_all(self):
         """Check nanmean when all values are nan."""
-        m = stats.stats.nanmean(self.Xall)
+        m = stats.nanmean(self.Xall)
         assert numpy.isnan(m)
 
     def test_nanstd_none(self):
         """Check nanstd when no values are nan."""
-        s = stats.stats.nanstd(self.X)
-        assert_approx_equal(s, stats.stats.std(self.X))
+        s = stats.nanstd(self.X)
+        assert_approx_equal(s, stats.std(self.X))
 
     def test_nanstd_some(self):
         """Check nanstd when some values only are nan."""
-        s = stats.stats.nanstd(self.Xsome)
-        assert_approx_equal(s, stats.stats.std(self.Xsomet))
+        s = stats.nanstd(self.Xsome)
+        assert_approx_equal(s, stats.std(self.Xsomet))
 
     def test_nanstd_all(self):
         """Check nanstd when all values are nan."""
-        s = stats.stats.nanstd(self.Xall)
+        s = stats.nanstd(self.Xall)
         assert numpy.isnan(s)
 
     def test_nanmedian_none(self):
         """Check nanmedian when no values are nan."""
-        m = stats.stats.nanmedian(self.X)
-        assert_approx_equal(m, stats.stats.median(self.X))
+        m = stats.nanmedian(self.X)
+        assert_approx_equal(m, stats.median(self.X))
 
     def test_nanmedian_some(self):
         """Check nanmedian when some values only are nan."""
-        m = stats.stats.nanmedian(self.Xsome)
-        assert_approx_equal(m, stats.stats.median(self.Xsomet))
+        m = stats.nanmedian(self.Xsome)
+        assert_approx_equal(m, stats.median(self.Xsomet))
 
     def test_nanmedian_all(self):
         """Check nanmedian when all values are nan."""
-        m = stats.stats.nanmedian(self.Xall)
+        m = stats.nanmedian(self.Xall)
         assert numpy.isnan(m)
 
 class TestCorr(TestCase):



More information about the Scipy-svn mailing list