Permalink
Browse files

MAINT: run reindent on all .py files.

  • Loading branch information...
1 parent 164c7c8 commit f57eec9db5ac008264b0f9938b61a44a3b2e9f3d @rgommers rgommers committed Aug 30, 2011
Showing with 1,079 additions and 1,108 deletions.
  1. +0 −1 scipy/constants/codata.py
  2. +0 −1 scipy/constants/constants.py
  3. +1 −1 scipy/integrate/setup.py
  4. +2 −2 scipy/integrate/tests/test_integrate.py
  5. +3 −3 scipy/integrate/tests/test_quadrature.py
  6. +0 −2 scipy/interpolate/polyint.py
  7. +18 −18 scipy/interpolate/rbf.py
  8. +9 −10 scipy/interpolate/tests/test_interpolate_wrapper.py
  9. +0 −1 scipy/io/data_store.py
  10. +1 −1 scipy/io/matlab/benchmarks/bench_structarr.py
  11. +12 −12 scipy/io/matlab/mio4.py
  12. +1 −1 scipy/io/matlab/tests/test_mio5_utils.py
  13. +3 −4 scipy/io/matlab/tests/test_mio_utils.py
  14. +1 −1 scipy/io/matlab/tests/test_streams.py
  15. +1 −1 scipy/io/netcdf.py
  16. +0 −1 scipy/io/tests/test_netcdf.py
  17. +6 −6 scipy/linalg/decomp_schur.py
  18. +4 −4 scipy/linalg/special_matrices.py
  19. +9 −9 scipy/linalg/tests/test_special_matrices.py
  20. +0 −1 scipy/ndimage/tests/test_filters.py
  21. +18 −18 scipy/optimize/cobyla.py
  22. +0 −1 scipy/optimize/linesearch.py
  23. +6 −6 scipy/optimize/nnls.py
  24. +11 −11 scipy/optimize/nonlin.py
  25. +1 −1 scipy/optimize/slsqp.py
  26. +3 −3 scipy/optimize/tests/test_nonlin.py
  27. +3 −3 scipy/optimize/tests/test_regression.py
  28. +17 −17 scipy/optimize/tnc.py
  29. +2 −2 scipy/signal/fir_filter_design.py
  30. +25 −25 scipy/signal/tests/test_fir_filter_design.py
  31. +0 −1 scipy/signal/tests/test_spectral.py
  32. +11 −11 scipy/signal/tests/test_waveforms.py
  33. +0 −1 scipy/sparse/construct.py
  34. +0 −2 scipy/sparse/csgraph.py
  35. +12 −12 scipy/sparse/lil.py
  36. +2 −2 scipy/sparse/linalg/dsolve/umfpack/umfpack.py
  37. +17 −17 scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py
  38. +1 −1 scipy/sparse/linalg/isolve/tests/test_lgmres.py
  39. +0 −1 scipy/sparse/sparsetools/__init__.py
  40. +278 −281 scipy/sparse/sparsetools/bsr.py
  41. +62 −63 scipy/sparse/sparsetools/coo.py
  42. +197 −198 scipy/sparse/sparsetools/csc.py
  43. +2 −4 scipy/sparse/sparsetools/csgraph.py
  44. +284 −285 scipy/sparse/sparsetools/csr.py
  45. +21 −24 scipy/sparse/sparsetools/dia.py
  46. +9 −9 scipy/sparse/tests/test_base.py
  47. +2 −2 scipy/spatial/tests/test_distance.py
  48. +1 −1 scipy/spatial/tests/test_qhull.py
  49. +3 −3 scipy/special/tests/test_basic.py
  50. +0 −1 scipy/special/tests/test_orthogonal.py
  51. +0 −1 scipy/special/utils/convert.py
  52. +1 −1 scipy/special/utils/makenpz.py
  53. +0 −1 scipy/stats/_support.py
  54. +3 −3 scipy/stats/contingency.py
  55. +1 −1 scipy/stats/distributions.py
  56. +5 −5 scipy/stats/stats.py
  57. +1 −1 scipy/stats/tests/test_continuous_extra.py
  58. +5 −5 scipy/stats/tests/test_fit.py
  59. +4 −4 scipy/stats/tests/test_kdeoth.py
@@ -977,4 +977,3 @@ def find(sub=None, disp=False):
physical_constants[k] = physical_constants[v]
else:
del _aliases[k]
-
@@ -396,4 +396,3 @@ def nu2lambda(nu):
"""
return c / _np.asanyarray(nu)
-
View
@@ -35,7 +35,7 @@ def configuration(parent_package='',top_path=None):
depends=['quadpack.h','__quadpack.h'])
# odepack
libs = ['odepack','linpack_lite','mach']
-
+
# Remove libraries key from blas_opt
if 'libraries' in blas_opt: # key doesn't exist on OS X ...
@@ -78,7 +78,7 @@ def test_dopri5(self):
if problem.stiff: continue
if hasattr(problem, 'jac'): continue
self._do_problem(problem, 'dopri5')
-
+
def test_dop853(self):
"""Check the dop853 solver"""
for problem_cls in PROBLEMS:
@@ -175,7 +175,7 @@ def test_dopri5(self):
if problem.stiff: continue
if hasattr(problem, 'jac'): continue
self._do_problem(problem, 'dopri5')
-
+
def test_dop853(self):
"""Check the dop853 solver"""
for problem_cls in PROBLEMS:
@@ -74,20 +74,20 @@ def test_newton_cotes(self):
def test_newton_cotes2(self):
"""Test newton_cotes with points that are not evenly spaced."""
-
+
x = numpy.array([0.0, 1.5, 2.0])
y = x**2
wts, errcoff = newton_cotes(x)
exact_integral = 8.0/3
numeric_integral = numpy.dot(wts, y)
assert_almost_equal(numeric_integral, exact_integral)
-
+
x = numpy.array([0.0, 1.4, 2.1, 3.0])
y = x**2
wts, errcoff = newton_cotes(x)
exact_integral = 9.0
numeric_integral = numpy.dot(wts, y)
- assert_almost_equal(numeric_integral, exact_integral)
+ assert_almost_equal(numeric_integral, exact_integral)
if __name__ == "__main__":
@@ -965,5 +965,3 @@ def pchip(x, y):
"""
derivs = _find_derivatives(x,y)
return PiecewisePolynomial(x, zip(y, derivs), orders=3, direction=None)
-
-
View
@@ -110,11 +110,11 @@ def _euclidean_norm(self, x1, x2):
return sqrt( ((x1 - x2)**2).sum(axis=0) )
def _h_multiquadric(self, r):
- return sqrt((1.0/self.epsilon*r)**2 + 1)
+ return sqrt((1.0/self.epsilon*r)**2 + 1)
def _h_inverse_multiquadric(self, r):
- return 1.0/sqrt((1.0/self.epsilon*r)**2 + 1)
+ return 1.0/sqrt((1.0/self.epsilon*r)**2 + 1)
def _h_gaussian(self, r):
- return exp(-(1.0/self.epsilon*r)**2)
+ return exp(-(1.0/self.epsilon*r)**2)
def _h_linear(self, r):
return r
def _h_cubic(self, r):
@@ -129,21 +129,21 @@ def _h_thin_plate(self, r):
# Setup self._function and do smoke test on initial r
def _init_function(self, r):
if isinstance(self.function, str):
- self.function = self.function.lower()
- _mapped = {'inverse': 'inverse_multiquadric',
- 'inverse multiquadric': 'inverse_multiquadric',
- 'thin-plate': 'thin_plate'}
- if self.function in _mapped:
- self.function = _mapped[self.function]
-
- func_name = "_h_" + self.function
- if hasattr(self, func_name):
- self._function = getattr(self, func_name)
- else:
- functionlist = [x[3:] for x in dir(self) if x.startswith('_h_')]
- raise ValueError("function must be a callable or one of " +
- ", ".join(functionlist))
- self._function = getattr(self, "_h_"+self.function)
+ self.function = self.function.lower()
+ _mapped = {'inverse': 'inverse_multiquadric',
+ 'inverse multiquadric': 'inverse_multiquadric',
+ 'thin-plate': 'thin_plate'}
+ if self.function in _mapped:
+ self.function = _mapped[self.function]
+
+ func_name = "_h_" + self.function
+ if hasattr(self, func_name):
+ self._function = getattr(self, func_name)
+ else:
+ functionlist = [x[3:] for x in dir(self) if x.startswith('_h_')]
+ raise ValueError("function must be a callable or one of " +
+ ", ".join(functionlist))
+ self._function = getattr(self, "_h_"+self.function)
elif callable(self.function):
allow_one = False
if hasattr(self.function, 'func_code') or \
@@ -12,18 +12,18 @@
linear, logarithmic, block_average_above, block, nearest
class Test(unittest.TestCase):
-
+
def assertAllclose(self, x, y, rtol=1.0e-5):
for i, xi in enumerate(x):
self.assert_(allclose(xi, y[i], rtol) or (isnan(xi) and isnan(y[i])))
-
+
def test_nearest(self):
N = 5
x = arange(N)
y = arange(N)
self.assertAllclose(y, nearest(x, y, x+.1))
self.assertAllclose(y, nearest(x, y, x-.1))
-
+
def test_linear(self):
N = 3000.
x = arange(N)
@@ -33,14 +33,14 @@ def test_linear(self):
new_y = linear(x, y, new_x)
t2 = time.clock()
#print "time for linear interpolation with N = %i:" % N, t2 - t1
-
+
self.assertAllclose(new_y[:5], [0.5, 1.5, 2.5, 3.5, 4.5])
-
+
def test_block_average_above(self):
N = 3000.
x = arange(N)
y = arange(N)
-
+
new_x = arange(N/2)*2
t1 = time.clock()
new_y = block_average_above(x, y, new_x)
@@ -63,7 +63,7 @@ def test_linear2(self):
[ 0.5, 1.5, 2.5, 3.5, 4.5],
[ 0.5, 1.5, 2.5, 3.5, 4.5],
[ 0.5, 1.5, 2.5, 3.5, 4.5]])
-
+
def test_logarithmic(self):
N = 4000.
x = arange(N)
@@ -75,12 +75,11 @@ def test_logarithmic(self):
#print "time for logarithmic interpolation with N = %i:" % N, t2 - t1
correct_y = [np.NaN, 1.41421356, 2.44948974, 3.46410162, 4.47213595]
self.assertAllclose(new_y[:5], correct_y)
-
+
def runTest(self):
test_list = [name for name in dir(self) if name.find('test_')==0]
for test_name in test_list:
exec("self.%s()" % test_name)
-
+
if __name__ == '__main__':
unittest.main()
-
View
@@ -70,4 +70,3 @@ def save_as_module(file_name=None,data=None):
"""
_create_module(file_name)
_create_shelf(file_name,data)
-
@@ -17,7 +17,7 @@ def make_structarr(n_vars, n_fields, n_structs):
return var_dict
-def bench_run():
+def bench_run():
str_io = StringIO()
print
print 'Read / writing matlab structs'
View
@@ -82,18 +82,18 @@ def __init__(self,
self.mclass = mclass
self.dims = dims
self.is_complex = is_complex
-
+
class VarReader4(object):
''' Class to read matlab 4 variables '''
-
+
def __init__(self, file_reader):
self.file_reader = file_reader
self.mat_stream = file_reader.mat_stream
self.dtypes = file_reader.dtypes
self.chars_as_strings = file_reader.chars_as_strings
self.squeeze_me = file_reader.squeeze_me
-
+
def read_header(self):
''' Reads and return header for variable '''
data = read_dtype(self.mat_stream, self.dtypes['header'])
@@ -115,7 +115,7 @@ def read_header(self):
T,
dims,
is_complex)
-
+
def array_from_header(self, hdr, process=True):
mclass = hdr.mclass
if mclass == mxFULL_CLASS:
@@ -132,7 +132,7 @@ def array_from_header(self, hdr, process=True):
if process and self.squeeze_me:
return squeeze_element(arr)
return arr
-
+
def read_sub_array(self, hdr, copy=True):
''' Mat4 read always uses header dtype and dims
hdr : object
@@ -220,7 +220,7 @@ def __init__(self, mat_stream, *args, **kwargs):
'''
super(MatFile4Reader, self).__init__(mat_stream, *args, **kwargs)
self._matrix_reader = None
-
+
def guess_byte_order(self):
self.mat_stream.seek(0)
mopt = read_dtype(self.mat_stream, np.dtype('i4'))
@@ -236,7 +236,7 @@ def initialize_read(self):
'''
self.dtypes = convert_dtypes(mdtypes_template, self.byte_order)
self._matrix_reader = VarReader4(self)
-
+
def read_var_header(self):
''' Read header, return header, next position
@@ -261,7 +261,7 @@ def read_var_header(self):
remaining_bytes *= 2
next_position = self.mat_stream.tell() + remaining_bytes
return hdr, next_position
-
+
def read_var_array(self, header, process=True):
''' Read array, given `header`
@@ -271,13 +271,13 @@ def read_var_array(self, header, process=True):
object with fields defining variable header
process : {True, False} bool, optional
If True, apply recursive post-processing during loading of
- array.
-
+ array.
+
Returns
-------
arr : array
array with post-processing applied or not according to
- `process`.
+ `process`.
'''
return self._matrix_reader.array_from_header(header, process)
@@ -451,7 +451,7 @@ def write_char(self, arr, name):
def write_sparse(self, arr, name):
''' Sparse matrices are 2D
-
+
See docstring for VarReader4.read_sparse_array
'''
A = arr.tocoo() #convert to sparse COO format (ijv)
@@ -1,4 +1,4 @@
-""" Testing
+""" Testing
"""
import sys
@@ -1,4 +1,4 @@
-""" Testing
+""" Testing
"""
@@ -32,8 +32,8 @@ def test_squeeze_element():
# Unless it's a structured array
sq_sa = squeeze_element(np.zeros((1,1),dtype=[('f1', 'f')]))
yield assert_true, isinstance(sq_sa, np.ndarray)
-
-
+
+
def test_chars_strings():
# chars as strings
strings = ['learn ', 'python', 'fast ', 'here ']
@@ -57,4 +57,3 @@ def test_chars_strings():
if __name__ == "__main__":
run_module_suite()
-
@@ -1,4 +1,4 @@
-""" Testing
+""" Testing
"""
View
@@ -217,7 +217,7 @@ def close(self):
"""Closes the NetCDF file."""
if not self.fp.closed:
try:
- self.flush()
+ self.flush()
finally:
self.fp.close()
__del__ = close
@@ -123,4 +123,3 @@ def test_read_example_data():
for fname in glob(pjoin(TEST_DATA_PATH, '*.nc')):
f = netcdf_file(fname, 'r')
f = netcdf_file(fname, 'r', mmap=False)
-
@@ -62,7 +62,7 @@ def schur(a, output='real', lwork=None, overwrite_a=False, sort=None):
------
LinAlgError
Error raised under three conditions:
- 1. The algorithm failed due to a failure of the QR algorithm to
+ 1. The algorithm failed due to a failure of the QR algorithm to
compute all eigenvalues
2. If eigenvalue sorting was requested, the eigenvalues could not be
reordered due to a failure to separate eigenvalues, usually because
@@ -94,7 +94,7 @@ def schur(a, output='real', lwork=None, overwrite_a=False, sort=None):
# get optimal work array
result = gees(lambda x: None, a1, lwork=-1)
lwork = result[-2][0].real.astype(numpy.int)
-
+
if sort is None:
sort_t = 0
sfunction = lambda x: None
@@ -113,10 +113,10 @@ def schur(a, output='real', lwork=None, overwrite_a=False, sort=None):
else:
raise ValueError("sort parameter must be None, a callable, or " +
"one of ('lhp','rhp','iuc','ouc')")
-
- result = gees(sfunction, a1, lwork=lwork, overwrite_a=overwrite_a,
+
+ result = gees(sfunction, a1, lwork=lwork, overwrite_a=overwrite_a,
sort_t=sort_t)
-
+
info = result[-1]
if info < 0:
raise ValueError('illegal value in %d-th argument of internal gees'
@@ -127,7 +127,7 @@ def schur(a, output='real', lwork=None, overwrite_a=False, sort=None):
raise LinAlgError('Leading eigenvalues do not satisfy sort condition.')
elif info > 0:
raise LinAlgError("Schur form not found. Possibly ill-conditioned.")
-
+
if sort_t == 0:
return result[0], result[-3]
else:
Oops, something went wrong.

0 comments on commit f57eec9

Please sign in to comment.