[Scipy-svn] r5307 - in trunk/scipy: io/matlab ndimage ndimage/tests signal/tests stats stats/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Wed Dec 31 02:13:07 EST 2008
Author: jarrod.millman
Date: 2008-12-31 01:13:05 -0600 (Wed, 31 Dec 2008)
New Revision: 5307
Modified:
trunk/scipy/io/matlab/gzipstreams.py
trunk/scipy/io/matlab/mio5.py
trunk/scipy/ndimage/doccer.py
trunk/scipy/ndimage/filters.py
trunk/scipy/ndimage/tests/test_doccer.py
trunk/scipy/signal/tests/test_signaltools.py
trunk/scipy/stats/stats.py
trunk/scipy/stats/tests/test_stats.py
Log:
ran reindent
Modified: trunk/scipy/io/matlab/gzipstreams.py
===================================================================
--- trunk/scipy/io/matlab/gzipstreams.py 2008-12-31 07:02:20 UTC (rev 5306)
+++ trunk/scipy/io/matlab/gzipstreams.py 2008-12-31 07:13:05 UTC (rev 5307)
@@ -61,9 +61,9 @@
''
>>> ZF.tell()
6
- >>>
+ >>>
'''
-
+
blocksize = 16384 # 16K
def __init__(self, fileobj, length=None):
''' Initialize GzipInputStream
@@ -164,7 +164,7 @@
-------
data : string
string containing read data
-
+
'''
self.__fill(bytes)
if bytes == -1:
@@ -217,4 +217,3 @@
break
lines.append(s)
return lines
-
Modified: trunk/scipy/io/matlab/mio5.py
===================================================================
--- trunk/scipy/io/matlab/mio5.py 2008-12-31 07:02:20 UTC (rev 5306)
+++ trunk/scipy/io/matlab/mio5.py 2008-12-31 07:13:05 UTC (rev 5307)
@@ -799,7 +799,7 @@
def write(self):
self.write_header()
self._write_items()
-
+
def _write_items(self):
# loop over data, column major
A = np.atleast_2d(self.arr).flatten('F')
@@ -893,11 +893,11 @@
# No interesting conversion possible
raise TypeError('Could not convert %s (type %s) to array'
% (arr, type(arr)))
- args = (self.stream,
- narr,
- name,
- is_global,
- self.unicode_strings,
+ args = (self.stream,
+ narr,
+ name,
+ is_global,
+ self.unicode_strings,
self.long_field_names)
if isinstance(narr, MatlabFunction):
return Mat5FunctionWriter(*args)
Modified: trunk/scipy/ndimage/doccer.py
===================================================================
--- trunk/scipy/ndimage/doccer.py 2008-12-31 07:02:20 UTC (rev 5306)
+++ trunk/scipy/ndimage/doccer.py 2008-12-31 07:13:05 UTC (rev 5307)
@@ -94,7 +94,7 @@
unindent_params : {False, True}, boolean, optional
If True, strip common indentation from all parameters in
docdict
-
+
Returns
-------
decfunc : function
Modified: trunk/scipy/ndimage/filters.py
===================================================================
--- trunk/scipy/ndimage/filters.py 2008-12-31 07:02:20 UTC (rev 5306)
+++ trunk/scipy/ndimage/filters.py 2008-12-31 07:13:05 UTC (rev 5307)
@@ -89,7 +89,7 @@
'extra_arguments':_extra_arguments_doc,
'extra_keywords':_extra_keywords_doc,
}
-
+
docfiller = doccer.filldoc(docdict)
@docfiller
@@ -99,7 +99,7 @@
The lines of the array along the given axis are correlated with the
given weights.
-
+
Parameters
----------
%(input)s
@@ -921,7 +921,7 @@
%(cval)s
%(origin)s
%(extra_arguments)s
- %(extra_keywords)s
+ %(extra_keywords)s
"""
if extra_keywords is None:
extra_keywords = {}
@@ -962,7 +962,7 @@
%(cval)s
%(origin)s
%(extra_arguments)s
- %(extra_keywords)s
+ %(extra_keywords)s
"""
if extra_keywords is None:
extra_keywords = {}
Modified: trunk/scipy/ndimage/tests/test_doccer.py
===================================================================
--- trunk/scipy/ndimage/tests/test_doccer.py 2008-12-31 07:02:20 UTC (rev 5306)
+++ trunk/scipy/ndimage/tests/test_doccer.py 2008-12-31 07:13:05 UTC (rev 5307)
@@ -62,8 +62,8 @@
# affect subsequent indent of inserted parameter
yield assert_equal, formatted, """Single line doc Another test
with some indent"""
-
+
def test_decorator():
# with unindentation of parameters
decorator = sndd.filldoc(doc_dict, True)
Modified: trunk/scipy/signal/tests/test_signaltools.py
===================================================================
--- trunk/scipy/signal/tests/test_signaltools.py 2008-12-31 07:02:20 UTC (rev 5306)
+++ trunk/scipy/signal/tests/test_signaltools.py 2008-12-31 07:13:05 UTC (rev 5307)
@@ -38,7 +38,7 @@
[ 3, 33, 53, 67, 1, 78, 74, 55, 12, 83],
[ 7, 11, 46, 70, 60, 47, 24, 43, 61, 26],
[32, 61, 88, 7, 39, 4, 92, 64, 45, 61]]
-
+
d = signal.medfilt(f, [7, 3])
e = signal.medfilt2d(np.array(f, np.float), [7, 3])
assert_array_equal(d, [[ 0, 50, 50, 50, 42, 15, 15, 18, 27, 0],
Modified: trunk/scipy/stats/stats.py
===================================================================
--- trunk/scipy/stats/stats.py 2008-12-31 07:02:20 UTC (rev 5306)
+++ trunk/scipy/stats/stats.py 2008-12-31 07:13:05 UTC (rev 5307)
@@ -1904,7 +1904,7 @@
>>> from scipy import stats
>>> import numpy as np
-
+
>>> #fix seed to get the same result
>>> np.random.seed(7654567)
>>> rvs = stats.norm.rvs(loc=5,scale=10,size=(50,2))
@@ -1938,14 +1938,14 @@
d = np.mean(a,axis) - popmean
v = np.var(a, axis, ddof=1)
-
+
t = d / np.sqrt(v/float(n))
t = np.where((d==0)*(v==0), 1.0, t) #define t=0/0 = 1, identical mean, var
prob = distributions.t.sf(np.abs(t),df)*2 #use np.abs to get upper tail
#distributions.t.sf currently does not propagate nans
#this can be dropped, if distributions.t.sf propagates nans
#if this is removed, then prob = prob[()] needs to be removed
- prob = np.where(np.isnan(t), np.nan, prob)
+ prob = np.where(np.isnan(t), np.nan, prob)
if t.ndim == 0:
t = t[()]
@@ -2004,7 +2004,7 @@
>>> np.random.seed(12345678)
test with sample with identical means
-
+
>>> rvs1 = stats.norm.rvs(loc=5,scale=10,size=500)
>>> rvs2 = stats.norm.rvs(loc=5,scale=10,size=500)
>>> stats.ttest_ind(rvs1,rvs2)
@@ -2012,7 +2012,7 @@
test with sample with different means
-
+
>>> rvs3 = stats.norm.rvs(loc=8,scale=10,size=500)
>>> stats.ttest_ind(rvs1,rvs3)
(-5.0434013458585092, 5.4302979468623391e-007)
@@ -2032,7 +2032,7 @@
t = d/np.sqrt(svar*(1.0/n1 + 1.0/n2))
t = np.where((d==0)*(svar==0), 1.0, t) #define t=0/0 = 0, identical means
prob = distributions.t.sf(np.abs(t),df)*2#use np.abs to get upper tail
-
+
#distributions.t.sf currently does not propagate nans
#this can be dropped, if distributions.t.sf propagates nans
#if this is removed, then prob = prob[()] needs to be removed
@@ -2041,7 +2041,7 @@
if t.ndim == 0:
t = t[()]
prob = prob[()]
-
+
return t, prob
@@ -2113,15 +2113,15 @@
d = (a-b).astype('d')
v = np.var(d,axis,ddof=1)
dm = np.mean(d, axis)
-
+
t = dm / np.sqrt(v/float(n))
- t = np.where((dm==0)*(v==0), 1.0, t) #define t=0/0 = 1, zero mean and var
+ t = np.where((dm==0)*(v==0), 1.0, t) #define t=0/0 = 1, zero mean and var
prob = distributions.t.sf(np.abs(t),df)*2 #use np.abs to get upper tail
#distributions.t.sf currently does not propagate nans
#this can be dropped, if distributions.t.sf propagates nans
#if this is removed, then prob = prob[()] needs to be removed
prob = np.where(np.isnan(t), np.nan, prob)
-
+
## if not np.isscalar(t):
## probs = np.reshape(probs, t.shape) # this should be redundant
## if not np.isscalar(prob) and len(prob) == 1:
Modified: trunk/scipy/stats/tests/test_stats.py
===================================================================
--- trunk/scipy/stats/tests/test_stats.py 2008-12-31 07:02:20 UTC (rev 5306)
+++ trunk/scipy/stats/tests/test_stats.py 2008-12-31 07:13:05 UTC (rev 5307)
@@ -1088,18 +1088,18 @@
t,p = stats.ttest_rel([0,0,0],[1,1,1])
assert_equal((np.abs(t),p), (np.inf, 0))
assert_equal(stats.ttest_rel([0,0,0], [0,0,0]), (1.0, 0.42264973081037427))
-
+
#check that nan in input array result in nan output
anan = np.array([[1,np.nan],[-1,1]])
assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan]))
-
-
+
+
def test_ttest_ind():
#regression test
tr = 1.0912746897927283
pr = 0.27647818616351882
tpr = ([tr,-tr],[pr,pr])
-
+
rvs2 = np.linspace(1,100,100)
rvs1 = np.linspace(5,105,100)
rvs1_2D = np.array([rvs1, rvs2])
@@ -1133,15 +1133,15 @@
#check that nan in input array result in nan output
anan = np.array([[1,np.nan],[-1,1]])
assert_equal(stats.ttest_ind(anan, np.zeros((2,2))),([0, np.nan], [1,np.nan]))
-
-
+
+
def test_ttest_1samp_new():
n1, n2, n3 = (10,15,20)
rvn1 = stats.norm.rvs(loc=5,scale=10,size=(n1,n2,n3))
rvn2 = stats.norm.rvs(loc=5,scale=10,size=(n1,n2,n3))
-
+
#check multidimensional array and correct axis handling
#deterministic rvn1 and rvn2 would be better as in test_ttest_rel
t1,p1 = stats.ttest_1samp(rvn1[:,:,:], np.ones((n2,n3)),axis=0)
More information about the Scipy-svn
mailing list