summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorcookedm <cookedm@localhost>2006-03-10 21:31:27 +0000
committercookedm <cookedm@localhost>2006-03-10 21:31:27 +0000
commitbf57380caa818b73a4c41409de6ff260425f9bb6 (patch)
treeb2c42e0fde172de5def0c91811845808c00e296e /numpy/core
parentf2db317c1fad63f1c85944ba8443b465e32774dc (diff)
downloadnumpy-bf57380caa818b73a4c41409de6ff260425f9bb6.tar.gz
Run reindent.py (script distributed with Python) over the source to remove extraneous whitespace
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/__init__.py2
-rw-r--r--numpy/core/_internal.py24
-rw-r--r--numpy/core/arrayprint.py30
-rw-r--r--numpy/core/code_generators/generate_array_api.py2
-rw-r--r--numpy/core/code_generators/generate_umath.py6
-rw-r--r--numpy/core/defchararray.py56
-rw-r--r--numpy/core/defmatrix.py24
-rw-r--r--numpy/core/info.py42
-rw-r--r--numpy/core/ma.py30
-rw-r--r--numpy/core/memmap.py2
-rw-r--r--numpy/core/numeric.py4
-rw-r--r--numpy/core/numerictypes.py9
-rw-r--r--numpy/core/oldnumeric.py6
-rw-r--r--numpy/core/records.py41
-rw-r--r--numpy/core/setup.py10
-rw-r--r--numpy/core/tests/test_defmatrix.py28
-rw-r--r--numpy/core/tests/test_ma.py96
-rw-r--r--numpy/core/tests/test_multiarray.py22
-rw-r--r--numpy/core/tests/test_numeric.py11
-rw-r--r--numpy/core/tests/test_numerictypes.py20
-rw-r--r--numpy/core/tests/test_records.py4
-rw-r--r--numpy/core/tests/test_umath.py6
-rw-r--r--numpy/core/tests/test_unicode.py2
23 files changed, 236 insertions, 241 deletions
diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py
index 429e423c5..65bd1c149 100644
--- a/numpy/core/__init__.py
+++ b/numpy/core/__init__.py
@@ -26,5 +26,5 @@ __all__ += rec.__all__
__all__ += char.__all__
def test(level=1, verbosity=1):
- from numpy.testing import NumpyTest
+ from numpy.testing import NumpyTest
return NumpyTest().test(level, verbosity)
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py
index 0326109c7..4b2e4eaca 100644
--- a/numpy/core/_internal.py
+++ b/numpy/core/_internal.py
@@ -64,7 +64,7 @@ class flagsobj(dict):
return (self._flagnum & num == num) and not \
(self._flagnum & _cnum == _cnum)
raise KeyError, "Unknown flag: %s" % key
-
+
def __setitem__(self, item, val):
if self.scalar:
raise ValueError, "Cannot set flags on array scalars."
@@ -80,7 +80,7 @@ class flagsobj(dict):
# now actually update array flags
self._arr.setflags(**kwds)
-
+
def get_fnc(self):
fl = self._flagnum
@@ -152,15 +152,15 @@ class flagsobj(dict):
behaved = property(get_behaved, None, "")
carray = property(get_carray, None, "")
farray = property(get_farray, None, "")
-
+
# make sure the tuple entries are PyArray_Descr
-# or convert them
+# or convert them
#
-# make sure offsets are all interpretable
-# as positive integers and
-# convert them to positive integers if so
+# make sure offsets are all interpretable
+# as positive integers and
+# convert them to positive integers if so
#
#
# return totalsize from last offset and size
@@ -223,7 +223,7 @@ def _usefields(adict, align):
# from the fields attribute of a descriptor
# This calls itself recursively but should eventually hit
# a descriptor that has no fields and then return
-# a simple typestring
+# a simple typestring
def _array_descr(descriptor):
fields = descriptor.fields
@@ -258,7 +258,7 @@ def _reconstruct(subtype, shape, dtype):
format_re = re.compile(r'(?P<repeat> *[(]?[ ,0-9]*[)]? *)(?P<dtype>[><|A-Za-z0-9.]*)')
def _split(input):
- """Split the input formats string into field formats without splitting
+ """Split the input formats string into field formats without splitting
the tuple used to specify multi-dimensional arrays."""
newlist = []
@@ -274,7 +274,7 @@ def _split(input):
# if the parenthesis is not balanced, hold the string
if left > right :
- hold = item
+ hold = item
# when balanced, append to the output list and reset the hold
elif left == right:
@@ -301,9 +301,9 @@ def _commastring(astr):
# convert item
try:
(repeats, dtype) = format_re.match(item).groups()
- except (TypeError, AttributeError):
+ except (TypeError, AttributeError):
raise ValueError('format %s is not recognized' % item)
-
+
if (repeats == ''):
newitem = dtype
else:
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index a78601188..a649d0211 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -4,7 +4,7 @@ $Id: arrayprint.py,v 1.9 2005/09/13 13:58:44 teoliphant Exp $
"""
__all__ = ["set_summary", "summary_off", "set_precision", "set_line_width",
"array2string"]
-
+
#
# Written by Konrad Hinsen <hinsenk@ere.umontreal.ca>
# last revision: 1996-3-13
@@ -63,7 +63,7 @@ _float_output_suppress_small = False
_line_width = 75
-def set_printoptions(precision=None, threshold=None, edgeitems=None,
+def set_printoptions(precision=None, threshold=None, edgeitems=None,
linewidth=None, suppress=None):
"""Set options associated with printing.
@@ -82,8 +82,8 @@ def set_printoptions(precision=None, threshold=None, edgeitems=None,
suppress Boolean value indicating whether or not suppress printing
of small floating point values using scientific notation
(default False)
- """
-
+ """
+
global _summaryThreshhold, _summaryEdgeItems, _float_output_precision, \
_line_width, _float_output_suppress_small
if (linewidth is not None):
@@ -126,7 +126,7 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
if max_line_width is None:
max_line_width = _line_width
-
+
if precision is None:
precision = _float_output_precision
@@ -139,7 +139,7 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
else:
summary_insert = ""
data = a.ravel()
-
+
try:
format_function = a._format
except AttributeError:
@@ -168,7 +168,7 @@ def _array2string(a, max_line_width, precision, suppress_small, separator=' ',
else:
format = '%s'
format_function = lambda x, f = format: format % str(x)
-
+
next_line_prefix = " " # skip over "["
next_line_prefix += " "*len(prefix) # skip over array(
@@ -211,11 +211,11 @@ def _formatArray(a, format_function, rank, max_line_len,
1. Full output
2. Summarized output
-
+
"""
if rank == 0:
return str(a.item())
-
+
if summary_insert and 2*edge_items < len(a):
leading_items, trailing_items, summary_insert1 = \
edge_items, edge_items, summary_insert
@@ -223,20 +223,20 @@ def _formatArray(a, format_function, rank, max_line_len,
leading_items, trailing_items, summary_insert1 = 0, len(a), ""
if rank == 1:
-
+
s = ""
line = next_line_prefix
for i in xrange(leading_items):
word = format_function(a[i]) + separator
s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)
-
+
if summary_insert1:
s, line = _extendLine(s, line, summary_insert1, max_line_len, next_line_prefix)
for i in xrange(trailing_items, 1, -1):
- word = format_function(a[-i]) + separator
+ word = format_function(a[-i]) + separator
s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)
-
+
word = format_function(a[-1])
s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)
s += line + "]\n"
@@ -251,10 +251,10 @@ def _formatArray(a, format_function, rank, max_line_len,
" " + next_line_prefix, separator, edge_items,
summary_insert)
s = s.rstrip() + sep.rstrip() + '\n'*max(rank-1,1)
-
+
if summary_insert1:
s += next_line_prefix + summary_insert1 + "\n"
-
+
for i in xrange(trailing_items, 1, -1):
if leading_items or i != trailing_items:
s += next_line_prefix
diff --git a/numpy/core/code_generators/generate_array_api.py b/numpy/core/code_generators/generate_array_api.py
index 8a043c65f..72e0caa29 100644
--- a/numpy/core/code_generators/generate_array_api.py
+++ b/numpy/core/code_generators/generate_array_api.py
@@ -88,7 +88,7 @@ void *PyArray_API[] = {
(void *) &PyArrayDescr_Type,
(void *) &PyArrayIter_Type,
(void *) &PyArrayMultiIter_Type,
- (int *) &PyArray_NUMUSERTYPES,
+ (int *) &PyArray_NUMUSERTYPES,
%s
};
"""
diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py
index 4edbb5363..42b038b22 100644
--- a/numpy/core/code_generators/generate_umath.py
+++ b/numpy/core/code_generators/generate_umath.py
@@ -73,11 +73,11 @@ class Ufunc(object):
#each entry in defdict is
#name: [string of chars for which it is defined,
-# string of characters using func interface,
-# tuple of strings giving funcs for data,
+# string of characters using func interface,
+# tuple of strings giving funcs for data,
# (in, out), or (instr, outstr) giving the signature as character codes,
# identity,
-# docstring,
+# docstring,
# output specification (optional)
# ]
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py
index 79cc9b69a..a220919c5 100644
--- a/numpy/core/defchararray.py
+++ b/numpy/core/defchararray.py
@@ -38,7 +38,7 @@ class chararray(ndarray):
def __array_finalize__(self, obj):
if not _globalvar and self.dtype.char not in 'SU':
raise ValueError, "Can only create a chararray from string data."
-
+
def _richcmpfunc(self, other, op):
b = broadcast(self, other)
@@ -49,7 +49,7 @@ class chararray(ndarray):
r2 = val[1]
res[k] = eval("r1 %s r2" % op, {'r1':r1,'r2':r2})
return result
-
+
# these should probably be moved to C
def __eq__(self, other):
return self._richcmpfunc(other, '==')
@@ -65,10 +65,10 @@ class chararray(ndarray):
def __gt__(self, other):
return self._richcmpfunc(other, '>')
-
+
def __lt__(self, other):
return self._richcmpfunc(other, '<')
-
+
def __add__(self, other):
b = broadcast(self, other)
arr = b.iters[1].base
@@ -77,17 +77,17 @@ class chararray(ndarray):
res = result.flat
for k, val in enumerate(b):
res[k] = (val[0] + val[1])
- return result
+ return result
def __radd__(self, other):
b = broadcast(other, self)
outitem = b.iters[0].base.itemsize + \
b.iters[1].base.itemsize
- result = chararray(b.shape, outitem, self.dtype is unicode_)
+ result = chararray(b.shape, outitem, self.dtype is unicode_)
res = result.flat
for k, val in enumerate(b):
res[k] = (val[0] + val[1])
- return result
+ return result
def __mul__(self, other):
b = broadcast(self, other)
@@ -107,7 +107,7 @@ class chararray(ndarray):
if not issubclass(arr.dtype.type, integer):
raise ValueError, "Can only multiply by integers"
outitem = b.iters[0].base.itemsize * arr.max()
- result = chararray(b.shape, outitem, self.dtype is unicode_)
+ result = chararray(b.shape, outitem, self.dtype is unicode_)
res = result.flat
for k, val in enumerate(b):
res[k] = val[0]*val[1]
@@ -124,7 +124,7 @@ class chararray(ndarray):
newarr = chararray(b.shape, maxsize, self.dtype is unicode_)
newarr[:] = res
return newarr
-
+
def __rmod__(self, other):
return NotImplemented
@@ -186,22 +186,22 @@ class chararray(ndarray):
def ljust(self, width):
return self._generalmethod('ljust', broadcast(self, width))
def rjust(self, width):
- return self._generalmethod('rjust', broadcast(self, width))
+ return self._generalmethod('rjust', broadcast(self, width))
def center(self, width):
- return self._generalmethod('center', broadcast(self, width))
+ return self._generalmethod('center', broadcast(self, width))
def count(self, sub, start=None, end=None):
return self._typedmethod('count', broadcast(self, sub, start, end), int)
def decode(self,encoding=None,errors=None):
return self._generalmethod('decode', broadcast(self, encoding, errors))
-
+
def encode(self,encoding=None,errors=None):
return self._generalmethod('encode', broadcast(self, encoding, errors))
-
+
def endswith(self, suffix, start=None, end=None):
return self._typedmethod('endswith', broadcast(self, suffix, start, end), bool)
-
+
def expandtabs(self, tabsize=None):
return self._generalmethod('endswith', broadcast(self, tabsize))
@@ -211,7 +211,7 @@ class chararray(ndarray):
def index(self, sub, start=None, end=None):
return self._typedmethod('index', broadcast(self, sub, start, end), int)
- def _ismethod(self, name):
+ def _ismethod(self, name):
result = empty(self.shape, dtype=bool)
res = result.flat
for k, val in enumerate(self.flat):
@@ -230,7 +230,7 @@ class chararray(ndarray):
def islower(self):
return self._ismethod('islower')
-
+
def isspace(self):
return self._ismethod('isspace')
@@ -242,7 +242,7 @@ class chararray(ndarray):
def join(self, seq):
return self._generalmethod('join', broadcast(self, seq))
-
+
def lower(self):
return self._samemethod('lower')
@@ -253,25 +253,25 @@ class chararray(ndarray):
return self._generalmethod('replace', broadcast(self, old, new, count))
def rfind(self, sub, start=None, end=None):
- return self._typedmethod('rfind', broadcast(self, sub, start, end), int)
+ return self._typedmethod('rfind', broadcast(self, sub, start, end), int)
def rindex(self, sub, start=None, end=None):
return self._typedmethod('rindex', broadcast(self, sub, start, end), int)
def rstrip(self, chars=None):
- return self._generalmethod('rstrip', broadcast(self, chars))
+ return self._generalmethod('rstrip', broadcast(self, chars))
def split(self, sep=None, maxsplit=None):
return self._typedmethod('split', broadcast(self, sep, maxsplit), object)
def splitlines(self, keepends=None):
return self._typedmethod('splitlines', broadcast(self, keepends), object)
-
+
def startswith(self, prefix, start=None, end=None):
return self._typedmethod('startswith', broadcast(self, prefix, start, end), bool)
def strip(self, chars=None):
- return self._generalmethod('strip', broadcast(self, chars))
+ return self._generalmethod('strip', broadcast(self, chars))
def swapcase(self):
return self._samemethod('swapcase')
@@ -284,16 +284,16 @@ class chararray(ndarray):
return self._generalmethod('translate', broadcast(self, table))
else:
return self._generalmethod('translate', broadcast(self, table, deletechars))
-
+
def upper(self):
return self._samemethod('upper')
def zfill(self, width):
return self._generalmethod('zfill', broadcast(self, width))
-
+
def array(obj, itemsize=None, copy=True, unicode=False, fortran=False):
-
+
if isinstance(obj, chararray):
if itemsize is None:
itemsize = obj.itemsize
@@ -313,7 +313,7 @@ def array(obj, itemsize=None, copy=True, unicode=False, fortran=False):
if copy: return new.copy()
else: return new
-
+
if unicode: dtype = "U"
else: dtype = "S"
@@ -323,13 +323,13 @@ def array(obj, itemsize=None, copy=True, unicode=False, fortran=False):
if isinstance(obj, (str, _unicode)):
if itemsize is None:
itemsize = len(obj)
- shape = len(obj) / itemsize
+ shape = len(obj) / itemsize
return chararray(shape, itemsize=itemsize, unicode=unicode,
buffer=obj)
- # default
+ # default
val = narray(obj, dtype=dtype, fortran=fortran, subok=1)
-
+
return val.view(chararray)
def asarray(obj, itemsize=None, unicode=False, fortran=False):
diff --git a/numpy/core/defmatrix.py b/numpy/core/defmatrix.py
index d89260ef6..388d7b1c9 100644
--- a/numpy/core/defmatrix.py
+++ b/numpy/core/defmatrix.py
@@ -43,12 +43,12 @@ def _convert_from_string(data):
newdata.append(newrow)
return newdata
-def asmatrix(data, dtype=None):
- """ Returns 'data' as a matrix. Unlike matrix(), no copy is performed
- if 'data' is already a matrix or array. Equivalent to:
- matrix(data, copy=False)
- """
- return matrix(data, dtype=dtype, copy=False)
+def asmatrix(data, dtype=None):
+ """ Returns 'data' as a matrix. Unlike matrix(), no copy is performed
+ if 'data' is already a matrix or array. Equivalent to:
+ matrix(data, copy=False)
+ """
+ return matrix(data, dtype=dtype, copy=False)
class matrix(N.ndarray):
__array_priority__ = 10.0
@@ -89,7 +89,7 @@ class matrix(N.ndarray):
fortran = False
if (ndim == 2) and arr.flags.fortran:
fortran = True
-
+
if not (fortran or arr.flags.contiguous):
arr = arr.copy()
@@ -142,14 +142,14 @@ class matrix(N.ndarray):
for val in shp:
if (val > 1): truend += 1
return truend
-
+
def __mul__(self, other):
if isinstance(other, N.ndarray) or N.isscalar(other) or \
not hasattr(other, '__rmul__'):
return N.dot(self, other)
else:
return NotImplemented
-
+
def __rmul__(self, other):
return N.dot(other, self)
@@ -211,8 +211,8 @@ class matrix(N.ndarray):
return s.transpose()
else:
return s
-
- # Needed becase tolist method expects a[i]
+
+ # Needed becase tolist method expects a[i]
# to have dimension a.ndim-1
def tolist(self):
return self.__array__().tolist()
@@ -267,7 +267,7 @@ def _from_string(str,gdict,ldict):
def bmat(obj, ldict=None, gdict=None):
"""Build a matrix object from string, nested sequence, or array.
- Ex: F = bmat('A, B; C, D')
+ Ex: F = bmat('A, B; C, D')
F = bmat([[A,B],[C,D]])
F = bmat(r_[c_[A,B],c_[C,D]])
diff --git a/numpy/core/info.py b/numpy/core/info.py
index 30071426b..8947fea6f 100644
--- a/numpy/core/info.py
+++ b/numpy/core/info.py
@@ -12,7 +12,7 @@ Functions
- fromstring - Construct array from (byte) string
- take - Select sub-arrays using sequence of indices
- put - Set sub-arrays using sequence of 1-D indices
-- putmask - Set portion of arrays using a mask
+- putmask - Set portion of arrays using a mask
- reshape - Return array with new shape
- repeat - Repeat elements of array
- choose - Construct new array from indexed array tuple
@@ -25,20 +25,20 @@ Functions
- cumproduct - Cumulative product over a specified dimension
- alltrue - Logical and over an entire axis
- sometrue - Logical or over an entire axis
-- allclose - Tests if sequences are essentially equal
+- allclose - Tests if sequences are essentially equal
More Functions:
- arrayrange (arange) - Return regularly spaced array
- asarray - Guarantee NumPy array
-- sarray - Guarantee a NumPy array that keeps precision
+- sarray - Guarantee a NumPy array that keeps precision
- convolve - Convolve two 1-d arrays
- swapaxes - Exchange axes
- concatenate - Join arrays together
- transpose - Permute axes
- sort - Sort elements of array
- argsort - Indices of sorted array
-- argmax - Index of largest value
+- argmax - Index of largest value
- argmin - Index of smallest value
- innerproduct - Innerproduct of two arrays
- dot - Dot product (matrix multiplication)
@@ -52,7 +52,7 @@ More Functions:
- dumps - Return pickled string representing data
- load - Return array stored in file object
- loads - Return array from pickled string
-- ravel - Return array as 1-D
+- ravel - Return array as 1-D
- nonzero - Indices of nonzero elements for 1-D array
- shape - Shape of array
- where - Construct array from binary result
@@ -61,23 +61,23 @@ More Functions:
- ones - Array of all ones
- identity - 2-D identity array (matrix)
-(Universal) Math Functions
+(Universal) Math Functions
- add logical_or exp
- subtract logical_xor log
- multiply logical_not log10
- divide maximum sin
- divide_safe minimum sinh
- conjugate bitwise_and sqrt
- power bitwise_or tan
- absolute bitwise_xor tanh
- negative invert ceil
- greater left_shift fabs
- greater_equal right_shift floor
- less arccos arctan2
- less_equal arcsin fmod
- equal arctan hypot
- not_equal cos around
+ add logical_or exp
+ subtract logical_xor log
+ multiply logical_not log10
+ divide maximum sin
+ divide_safe minimum sinh
+ conjugate bitwise_and sqrt
+ power bitwise_or tan
+ absolute bitwise_xor tanh
+ negative invert ceil
+ greater left_shift fabs
+ greater_equal right_shift floor
+ less arccos arctan2
+ less_equal arcsin fmod
+ equal arctan hypot
+ not_equal cos around
logical_and cosh sign
arccosh arcsinh arctanh
diff --git a/numpy/core/ma.py b/numpy/core/ma.py
index 3f047ce3f..3354f49c2 100644
--- a/numpy/core/ma.py
+++ b/numpy/core/ma.py
@@ -62,7 +62,7 @@ class _MaskedPrintOption:
return str(self._display)
__repr__ = __str__
-
+
#if you single index into a masked location you get this object.
masked_print_option = _MaskedPrintOption('--')
@@ -302,7 +302,7 @@ class masked_unary_operation:
self.__name__ = getattr(aufunc, "__name__", str(aufunc))
ufunc_domain[aufunc] = domain
ufunc_fills[aufunc] = fill,
-
+
def __call__ (self, a, *args, **kwargs):
"Execute the call behavior."
# numeric tries to return scalars rather than arrays when given scalars.
@@ -354,7 +354,7 @@ class domained_binary_operation:
m = mask_or(ma, mb)
result = self.f(d1, d2)
return masked_array(result, m)
-
+
def __str__ (self):
return "Masked version of " + str(self.f)
@@ -448,7 +448,7 @@ def nonzero(a):
a must be 1d
"""
return asarray(filled(a, 0).nonzero())
-
+
around = masked_unary_operation(oldnumeric.round_)
floor = masked_unary_operation(umath.floor)
ceil = masked_unary_operation(umath.ceil)
@@ -498,7 +498,7 @@ def size (object, axis=None):
class MaskedArray (object):
"""Arrays with possibly masked values.
- Masked values of 1 exclude the corresponding element from
+ Masked values of 1 exclude the corresponding element from
any computation.
Construction:
@@ -525,7 +525,7 @@ class MaskedArray (object):
The fill_value is not used for computation within this module.
"""
__array_priority__ = 10.1
- def __init__(self, data, dtype=None, copy=True, fortran=False,
+ def __init__(self, data, dtype=None, copy=True, fortran=False,
mask=nomask, fill_value=None):
"""array(data, dtype=None, copy=True, fortran=False, mask=nomask, fill_value=None)
If data already a numeric array, its dtype becomes the default value of dtype.
@@ -639,9 +639,9 @@ class MaskedArray (object):
else:
if m.shape != shape:
m = reduce(mask_or, [getmaskarray(a) for a in args])
-
+
return MaskedArray(array, copy=False, mask=m)
-
+
def _get_shape(self):
"Return the current shape."
return self._data.shape
@@ -789,7 +789,7 @@ array(data = %(data)s,
return dout
mi = m[i]
if mi.size == 1:
- if mi:
+ if mi:
return masked
else:
return dout
@@ -869,12 +869,12 @@ array(data = %(data)s,
"""
# XXX: This changes bool conversion logic from MA.
# XXX: In MA bool(a) == len(a) != 0, but in numpy
- # XXX: scalars do not have len
+ # XXX: scalars do not have len
m = self._mask
d = self._data
return bool(m is not nomask and m.any()
or d is not nomask and d.any())
-
+
def __len__ (self):
"""Return length of first dimension. This is weird but Python's
slicing behavior depends on it."""
@@ -1201,7 +1201,7 @@ array(data = %(data)s,
del t[axis]
return ones(t) * n
if axis is None:
- w = oldnumeric.ravel(m).astype(int)
+ w = oldnumeric.ravel(m).astype(int)
n1 = size(w)
if n1 == 1:
n2 = w[0]
@@ -1314,7 +1314,7 @@ array(data = %(data)s,
The raw data; portions may be meaningless.
May be noncontiguous. Expert use only."""
return self._data
- data = property(fget=raw_data,
+ data = property(fget=raw_data,
doc="The data, but values at masked locations are meaningless.")
def raw_mask (self):
@@ -1322,7 +1322,7 @@ array(data = %(data)s,
May be noncontiguous. Expert use only.
"""
return self._mask
- mask = property(fget=raw_mask,
+ mask = property(fget=raw_mask,
doc="The mask, may be nomask. Values where mask true are meaningless.")
def reshape (self, *s):
@@ -1348,7 +1348,7 @@ array(data = %(data)s,
return self._data.size
size = property(fget=_get_size, doc="Number of elements in the array.")
## CHECK THIS: signature of numeric.array.size?
-
+
def _get_dtype(self):
return self._data.dtype
dtype = property(fget=_get_dtype, doc="type of the array elements.")
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py
index 8e9faa5b0..72596ff5e 100644
--- a/numpy/core/memmap.py
+++ b/numpy/core/memmap.py
@@ -55,7 +55,7 @@ class memmap(ndarray):
bytes = offset + size*_dbytes
- if mode == 'w+' or (mode == 'r+' and flen < bytes):
+ if mode == 'w+' or (mode == 'r+' and flen < bytes):
fid.seek(bytes-1,0)
fid.write(chr(0))
fid.flush()
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 4ba599081..58d943066 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -337,7 +337,7 @@ def load(file):
def ones(shape, dtype=int_, fortran=False):
"""ones(shape, dtype=int_) returns an array of the given
- dimensions which is initialized to all ones.
+ dimensions which is initialized to all ones.
"""
a = empty(shape, dtype, fortran)
a.fill(1)
@@ -381,7 +381,7 @@ def _setpyvals(lst, frame, where=0):
elif where == 1 or wh == 'g':
frame.f_globals[UFUNC_PYVALS_NAME] = lst
elif where == 2 or wh == 'b':
- frame.f_builtins[UFUNC_PYVALS_NAME] = lst
+ frame.f_builtins[UFUNC_PYVALS_NAME] = lst
umath.update_use_defaults()
return
diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py
index 30d90df8c..d4a095c5b 100644
--- a/numpy/core/numerictypes.py
+++ b/numpy/core/numerictypes.py
@@ -172,7 +172,7 @@ def _add_aliases():
if (name != 'longdouble' and name != 'clongdouble') or \
myname not in allTypes.keys():
allTypes[myname] = typeobj
- typeDict[myname] = typeobj
+ typeDict[myname] = typeobj
if base == 'complex':
na_name = '%s%d' % (base.capitalize(), bit/2)
elif base == 'bool':
@@ -205,7 +205,7 @@ def _add_integer_aliases():
bits = val[2]
intname = 'int%d' % bits
UIntname = 'UInt%d' % bits
- Intname = 'Int%d' % bits
+ Intname = 'Int%d' % bits
uval = typeinfo['U'+ctype]
if intname not in allTypes.keys():
uintname = 'uint%d' % bits
@@ -217,7 +217,7 @@ def _add_integer_aliases():
typeDict[uintname] = utypeobj
typeDict[Intname] = typeobj
typeDict[UIntname] = utypeobj
- typeNA[Intname] = typeobj
+ typeNA[Intname] = typeobj
typeNA[UIntname] = utypeobj
typeNA[typeobj] = Intname
typeNA[utypeobj] = UIntname
@@ -227,7 +227,7 @@ def _add_integer_aliases():
typeNA[typeobj] = Intname
typeNA[utypeobj] = UIntname
typeNA[val[0]] = Intname
- typeNA[uval[0]] = UIntname
+ typeNA[uval[0]] = UIntname
_add_integer_aliases()
# We use these later
@@ -426,4 +426,3 @@ for key in allTypes:
__all__.append(key)
del key
-
diff --git a/numpy/core/oldnumeric.py b/numpy/core/oldnumeric.py
index 4e3add5b4..5e661b1ad 100644
--- a/numpy/core/oldnumeric.py
+++ b/numpy/core/oldnumeric.py
@@ -3,7 +3,7 @@
__all__ = ['asarray', 'array', 'concatenate',
'NewAxis',
'UFuncType', 'UfuncType', 'ArrayType', 'arraytype',
- 'LittleEndian', 'Bool',
+ 'LittleEndian', 'Bool',
'Character', 'UnsignedInt8', 'UnsignedInt16', 'UnsignedInt',
'UInt8','UInt16','UInt32', 'UnsignedInt32', 'UnsignedInteger',
# UnsignedInt64 and Unsigned128 added below if possible
@@ -19,7 +19,7 @@ __all__ = ['asarray', 'array', 'concatenate',
# functions that are now methods
'take', 'reshape', 'choose', 'repeat', 'put', 'putmask',
'swapaxes', 'transpose', 'sort', 'argsort', 'argmax', 'argmin',
- 'searchsorted', 'alen',
+ 'searchsorted', 'alen',
'resize', 'diagonal', 'trace', 'ravel', 'nonzero', 'shape',
'compress', 'clip', 'sum', 'product', 'prod', 'sometrue', 'alltrue',
'any', 'all', 'cumsum', 'cumproduct', 'cumprod', 'ptp', 'ndim',
@@ -323,7 +323,7 @@ def shape(a):
return asarray(a).shape
def compress(condition, m, axis=-1):
- """compress(condition, x, axis=-1) = those elements of x corresponding
+ """compress(condition, x, axis=-1) = those elements of x corresponding
to those elements of condition that are "true". condition must be the
same size as the given dimension of x."""
return asarray(m).compress(condition, axis)
diff --git a/numpy/core/records.py b/numpy/core/records.py
index f389388d7..3fc307f69 100644
--- a/numpy/core/records.py
+++ b/numpy/core/records.py
@@ -22,8 +22,8 @@ _byteorderconv = {'b':'>',
'i':'|'}
# formats regular expression
-# allows multidimension spec with a tuple syntax in front
-# of the letter code '(2,3)f4' and ' ( 2 , 3 ) f4 '
+# allows multidimension spec with a tuple syntax in front
+# of the letter code '(2,3)f4' and ' ( 2 , 3 ) f4 '
# are equally allowed
numfmt = nt.typeDict
@@ -68,7 +68,7 @@ class format_parser:
raise NameError, "illegal input names %s" % `names`
self._names = [n.strip() for n in names[:self._nfields]]
- else:
+ else:
self._names = []
# if the names are not specified, they will be assigned as "f1, f2,..."
@@ -89,17 +89,17 @@ class format_parser:
if (self._nfields > len(titles)):
self._titles += [None]*(self._nfields-len(titles))
-
+
def _createdescr(self):
self._descr = sb.dtype({'names':self._names,
'formats':self._f_formats,
'offsets':self._offsets,
'titles':self._titles})
-
+
class record(nt.void):
def __repr__(self):
return self.__str__()
-
+
def __str__(self):
return str(self.item())
@@ -121,7 +121,7 @@ class record(nt.void):
return self.setfield(val,*res[:2])
return nt.void.__setattr__(self,attr,val)
-
+
# The recarray is almost identical to a standard array (which supports
# named fields already) The biggest difference is that it can use
# attribute-lookup to find the fields and it is constructed using
@@ -159,7 +159,7 @@ class recarray(sb.ndarray):
res = fielddict[attr][:2]
except:
return object.__getattribute__(self,attr)
-
+
obj = self.getfield(*res)
# if it has fields return a recarray, otherwise return
# normal array
@@ -168,20 +168,20 @@ class recarray(sb.ndarray):
if obj.dtype.char in 'SU':
return obj.view(chararray)
return obj.view(sb.ndarray)
-
-
+
+
def __setattr__(self, attr, val):
fielddict = sb.ndarray.__getattribute__(self,'dtype').fields
try:
res = fielddict[attr][:2]
except:
return object.__setattr__(self,attr,val)
-
+
return self.setfield(val,*res)
def field(self,attr, val=None):
fielddict = sb.ndarray.__getattribute__(self,'dtype').fields
-
+
if isinstance(attr,int):
attr=fielddict[-1][attr]
@@ -210,7 +210,7 @@ def fromarrays(arrayList, formats=None, names=None, titles=None, shape=None,
if isinstance(shape, int):
shape = (shape,)
-
+
if formats is None:
# go through each object in the list to see if it is an ndarray
# and determine the formats.
@@ -231,7 +231,7 @@ def fromarrays(arrayList, formats=None, names=None, titles=None, shape=None,
parsed = format_parser(formats, names, titles, aligned)
_names = parsed._names
_array = recarray(shape, parsed._descr)
-
+
# populate the record array (makes a copy)
for i in range(len(arrayList)):
_array[_names[i]] = arrayList[i]
@@ -264,7 +264,7 @@ def fromrecords(recList, formats=None, names=None, titles=None, shape=None,
chararray(['dbe', 'de'])
>>> import cPickle
>>> print cPickle.loads(cPickle.dumps(r))
- recarray[
+ recarray[
(456, 'dbe', 1.2),
(2, 'de', 1.3)
]
@@ -298,7 +298,7 @@ def fromrecords(recList, formats=None, names=None, titles=None, shape=None,
res = retval.view(recarray)
res.dtype = sb.dtype((record, res.dtype))
return res
-
+
def fromstring(datastring, formats, shape=None, names=None, titles=None,
byteorder=None, aligned=0, offset=0):
@@ -309,7 +309,7 @@ def fromstring(datastring, formats, shape=None, names=None, titles=None,
itemsize = parsed._descr.itemsize
if (shape is None or shape == 0 or shape == -1):
shape = (len(datastring)-offset) / itemsize
-
+
_array = recarray(shape, parsed._descr, names=names,
titles=titles, buf=datastring, offset=offset,
byteorder=byteorder)
@@ -358,7 +358,7 @@ def fromfile(fd, formats, shape=None, names=None, titles=None,
shape[ shape.index(-1) ] = size / -shapesize
shape = tuple(shape)
shapeprod = sb.array(shape).prod()
-
+
nbytes = shapeprod*itemsize
if nbytes > size:
@@ -372,13 +372,13 @@ def fromfile(fd, formats, shape=None, names=None, titles=None,
raise IOError("Didn't read as many bytes as expected")
if name:
fd.close()
-
+
return _array
def array(obj, formats=None, names=None, titles=None, shape=None,
byteorder=None, aligned=0, offset=0, strides=None):
-
+
if isinstance(obj, (type(None), str, file)) and (formats is None):
raise ValueError("Must define formats if object is "\
"None, string, or an open file")
@@ -416,4 +416,3 @@ def array(obj, formats=None, names=None, titles=None, shape=None,
return res
else:
raise ValueError("Unknown input type")
-
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index 75e21551a..c0f44bc34 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -75,12 +75,12 @@ def configuration(parent_package='',top_path=None):
moredefs.append('HAVE_ISINF')
if config_cmd.check_func('rint', **kws_args):
moredefs.append('HAVE_RINT')
-
+
if sys.version[:3] < '2.4':
kws_args['headers'].append('stdlib.h')
if config_cmd.check_func('strtod', **kws_args):
moredefs.append(('PyOS_ascii_strtod', 'strtod'))
-
+
if moredefs:
target_f = open(target,'a')
for d in moredefs:
@@ -155,14 +155,14 @@ def configuration(parent_package='',top_path=None):
join('include','numpy','*object.h'),
'include/numpy/fenv/fenv.c',
'include/numpy/fenv/fenv.h',
- join(codegen_dir,'genapi.py'),
- join(codegen_dir,'*.txt')
+ join(codegen_dir,'genapi.py'),
+ join(codegen_dir,'*.txt')
]
# Don't install fenv unless we need them.
if sys.platform == 'cygwin':
config.add_data_dir('include/numpy/fenv')
-
+
config.add_extension('multiarray',
sources = [join('src','multiarraymodule.c'),
generate_config_h,
diff --git a/numpy/core/tests/test_defmatrix.py b/numpy/core/tests/test_defmatrix.py
index 1eb91c8f9..1546847d4 100644
--- a/numpy/core/tests/test_defmatrix.py
+++ b/numpy/core/tests/test_defmatrix.py
@@ -19,11 +19,11 @@ class test_ctor(ScipyTestCase):
[3,4,3,4]])
assert all(B.A == D)
assert all(C.A == D)
-
+
vec = arange(5)
mvec = matrix(vec)
assert mvec.shape == (1,5)
-
+
class test_properties(ScipyTestCase):
def check_sum(self):
"""Test whether matrix.sum(axis=1) preserves orientation.
@@ -42,15 +42,15 @@ class test_properties(ScipyTestCase):
def check_basic(self):
import numpy.linalg as linalg
-
- A = array([[1., 2.],
+
+ A = array([[1., 2.],
[3., 4.]])
mA = matrix(A)
assert allclose(linalg.inv(A), mA.I)
assert all(array(transpose(A) == mA.T))
assert all(array(transpose(A) == mA.H))
assert all(A == mA.A)
-
+
B = A + 2j*A
mB = matrix(B)
assert allclose(linalg.inv(B), mB.I)
@@ -68,19 +68,19 @@ class test_properties(ScipyTestCase):
assert all(mA <= mB)
assert all(mA <= mA)
assert not any(mA < mA)
-
+
assert not any(mB < mA)
assert all(mB >= mA)
assert all(mB >= mB)
assert not any(mB > mB)
-
+
assert all(mA == mA)
assert not any(mA == mB)
assert all(mB != mA)
-
+
assert not all(abs(mA) > 0)
assert all(abs(mB > 0))
-
+
def check_asmatrix(self):
A = arange(100).reshape(10,10)
mA = asmatrix(A)
@@ -96,14 +96,14 @@ class test_casting(ScipyTestCase):
def check_basic(self):
A = arange(100).reshape(10,10)
mA = matrix(A)
-
+
mB = mA.copy()
O = ones((10,10), float64) * 0.1
mB = mB + O
assert mB.dtype.type == float64
assert all(mA != mB)
assert all(mB == mA+0.1)
-
+
mC = mA.copy()
O = ones((10,10), complex128)
mC = mC * O
@@ -113,7 +113,7 @@ class test_casting(ScipyTestCase):
class test_algebra(ScipyTestCase):
def check_basic(self):
import numpy.linalg as linalg
-
+
A = array([[1., 2.],
[3., 4.]])
mA = matrix(A)
@@ -122,7 +122,7 @@ class test_algebra(ScipyTestCase):
for i in xrange(6):
assert allclose((mA ** i).A, B)
B = dot(B, A)
-
+
Ainv = linalg.inv(A)
B = identity(2)
for i in xrange(6):
@@ -130,7 +130,7 @@ class test_algebra(ScipyTestCase):
B = dot(B, Ainv)
assert allclose((mA * mA).A, dot(A, A))
- assert allclose((mA + mA).A, (A + A))
+ assert allclose((mA + mA).A, (A + A))
assert allclose((3*mA).A, (3*A))
if __name__ == "__main__":
diff --git a/numpy/core/tests/test_ma.py b/numpy/core/tests/test_ma.py
index abee7d91f..02ccb4625 100644
--- a/numpy/core/tests/test_ma.py
+++ b/numpy/core/tests/test_ma.py
@@ -1,4 +1,4 @@
-import numpy
+import numpy
import types, time
from numpy.core.ma import *
from numpy.testing import ScipyTestCase, ScipyTest
@@ -16,7 +16,7 @@ class test_ma(ScipyTestCase):
def __init__(self, *args, **kwds):
ScipyTestCase.__init__(self, *args, **kwds)
self.setUp()
-
+
def setUp (self):
x=numpy.array([1.,1.,1.,-2., pi/2.0, 4., 5., -10., 10., 1., 2., 3.])
y=numpy.array([5.,0.,3., 2., -1., -4., 0., -10., 10., 1., 0., 3.])
@@ -48,14 +48,14 @@ class test_ma(ScipyTestCase):
def check_testBasic2d(self):
"Test of basic array creation and properties in 2 dimensions."
- for s in [(4,3), (6,2)]:
+ for s in [(4,3), (6,2)]:
(x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
x.shape = s
y.shape = s
xm.shape = s
ym.shape = s
xf.shape = s
-
+
self.failIf(isMaskedArray(x))
self.failUnless(isMaskedArray(xm))
self.assertEqual(shape(xm), s)
@@ -75,7 +75,7 @@ class test_ma(ScipyTestCase):
self.failUnless(eq (a2d * a2d, a2d * a2dm))
self.failUnless(eq (a2d + a2d, a2d + a2dm))
self.failUnless(eq (a2d - a2d, a2d - a2dm))
- for s in [(12,), (4,3), (2,6)]:
+ for s in [(12,), (4,3), (2,6)]:
x = x.reshape(s)
y = y.reshape(s)
xm = xm.reshape(s)
@@ -108,7 +108,7 @@ class test_ma(ScipyTestCase):
ma = array([1])
self.failUnless(isinstance(na + ma, MaskedArray))
self.failUnless(isinstance(ma + na, MaskedArray))
-
+
def check_testUfuncs1 (self):
"Test various functions such as sin, cos."
(x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
@@ -138,7 +138,7 @@ class test_ma(ScipyTestCase):
self.failUnless (eq(numpy.concatenate((x,y)), concatenate((x,y))))
self.failUnless (eq(numpy.concatenate((x,y)), concatenate((xm,y))))
self.failUnless (eq(numpy.concatenate((x,y,x)), concatenate((x,ym,x))))
-
+
def check_xtestCount (self):
"Test count"
ott = array([0.,1.,2.,3.], mask=[1,0,0,0])
@@ -152,9 +152,9 @@ class test_ma(ScipyTestCase):
self.failUnless (eq(3, count(ott)))
assert getmask(count(ott,0)) is nomask
self.failUnless (eq([1,2],count(ott,0)))
-
+
def check_testMinMax (self):
- "Test minimum and maximum."
+ "Test minimum and maximum."
(x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
xr = numpy.ravel(x) #max doesn't work if shaped
xmr = ravel(xm)
@@ -179,8 +179,8 @@ class test_ma(ScipyTestCase):
self.failUnless (eq(numpy.add.reduce(x,1), add.reduce(x,1)))
self.failUnless (eq(numpy.sum(x,1), sum(x,1)))
self.failUnless (eq(numpy.product(x,1), product(x,1)))
-
-
+
+
def check_testCI(self):
"Test of conversions and indexing"
x1 = numpy.array([1,2,4,3])
@@ -229,7 +229,7 @@ class test_ma(ScipyTestCase):
self.assertEqual(type(s1), str)
self.assertEqual(s1, s2)
assert x1[1:1].shape == (0,)
-
+
def check_testCopySize(self):
"Tests of some subtle points of copying and sizing."
n = [0,0,1,0,0]
@@ -238,17 +238,17 @@ class test_ma(ScipyTestCase):
self.failUnless(m is m2)
m3 = make_mask(m, copy=1)
self.failUnless(m is not m3)
-
+
x1 = numpy.arange(5)
y1 = array(x1, mask=m)
self.failUnless( y1.raw_data() is not x1)
self.failUnless( allequal(x1,y1.raw_data()))
self.failUnless( y1.mask is m)
-
+
y1a = array(y1, copy=0)
self.failUnless( y1a.raw_data() is y1.raw_data())
self.failUnless( y1a.mask is y1.mask)
-
+
y2 = array(x1, mask=m, copy=0)
self.failUnless( y2.raw_data() is x1)
self.failUnless( y2.mask is m)
@@ -257,10 +257,10 @@ class test_ma(ScipyTestCase):
self.failUnless( y2[2] is not masked)
self.failUnless( y2.mask is not m)
self.failUnless( allequal(y2.mask, 0))
-
+
y3 = array(x1*1.0, mask=m)
self.failUnless(filled(y3).dtype is (x1*1.0).dtype)
-
+
x4 = arange(4)
x4[2] = masked
y4 = resize(x4, (8,))
@@ -270,7 +270,7 @@ class test_ma(ScipyTestCase):
self.failUnless( eq(y5, [0,0,1,1,2,2,3,3]))
y6 = repeat(x4, 2)
self.failUnless( eq(y5, y6))
-
+
def check_testPut(self):
"Test of put"
d = arange(5)
@@ -284,24 +284,24 @@ class test_ma(ScipyTestCase):
self.failUnless( x[3] is masked)
self.failUnless( x[4] is not masked)
self.failUnless( eq(x, [0,10,2,-1,40]))
-
- x = array(d, mask = m)
+
+ x = array(d, mask = m)
x.put([-1,100,200])
self.failUnless( eq(x, [-1,100,200,0,0]))
self.failUnless( x[3] is masked)
self.failUnless( x[4] is masked)
-
- x = array(d, mask = m)
+
+ x = array(d, mask = m)
x.putmask([30,40])
self.failUnless( eq(x, [0,1,2,30,40]))
self.failUnless( x.mask is nomask)
-
- x = array(d, mask = m)
+
+ x = array(d, mask = m)
y = x.compressed()
z = array(x, mask = m)
z.put(y)
assert eq (x, z)
-
+
def check_testMaPut(self):
(x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1]
@@ -310,7 +310,7 @@ class test_ma(ScipyTestCase):
assert take(xm, i) == z
put(ym, i, zm)
assert take(ym, i) == zm
-
+
def check_testOddFeatures(self):
"Test of other odd features"
x = arange(20); x=x.reshape(4,5)
@@ -321,7 +321,7 @@ class test_ma(ScipyTestCase):
assert eq(z.imag, 10*x)
assert eq((z*conjugate(z)).real, 101*x*x)
z.imag[...] = 0.0
-
+
x = arange(10)
x[3] = masked
assert str(x[3]) == str(masked)
@@ -400,9 +400,9 @@ class test_ma(ScipyTestCase):
assert eq(z, [99,99,99,1,1,1])
z = where(c, 1, masked)
assert eq(z, [99, 1, 1, 99, 99, 99])
-
+
def check_testMinMax(self):
- "Test of minumum, maximum."
+ "Test of minumum, maximum."
assert eq(minimum([1,2,3],[4,0,9]), [1,0,3])
assert eq(maximum([1,2,3],[4,0,9]), [4,2,9])
x = arange(5)
@@ -413,7 +413,7 @@ class test_ma(ScipyTestCase):
assert eq(maximum(x,y), where(greater(x,y), x, y))
assert minimum(x) == 0
assert maximum(x) == 4
-
+
def check_testTakeTransposeInnerOuter(self):
"Test of take, transpose, inner, outer products"
x = arange(24)
@@ -433,11 +433,11 @@ class test_ma(ScipyTestCase):
assert t[0] == 'abc'
assert t[1] == 2
assert t[2] == 3
-
+
def check_testInplace(self):
"""Test of inplace operations and rich comparisons"""
y = arange(10)
-
+
x = arange(10)
xm = arange(10)
xm[2] = masked
@@ -445,7 +445,7 @@ class test_ma(ScipyTestCase):
assert eq(x, y+1)
xm += 1
assert eq(x, y+1)
-
+
x = arange(10)
xm = arange(10)
xm[2] = masked
@@ -453,7 +453,7 @@ class test_ma(ScipyTestCase):
assert eq(x, y-1)
xm -= 1
assert eq(xm, y-1)
-
+
x = arange(10)*1.0
xm = arange(10)*1.0
xm[2] = masked
@@ -461,7 +461,7 @@ class test_ma(ScipyTestCase):
assert eq(x, y*2)
xm *= 2.0
assert eq(xm, y*2)
-
+
x = arange(10)*2
xm = arange(10)
xm[2] = masked
@@ -469,7 +469,7 @@ class test_ma(ScipyTestCase):
assert eq(x, y)
xm /= 2
assert eq(x, y)
-
+
x = arange(10)*1.0
xm = arange(10)*1.0
xm[2] = masked
@@ -477,7 +477,7 @@ class test_ma(ScipyTestCase):
assert eq(x, y/2.0)
xm /= arange(10)
assert eq(xm, ones((10,)))
-
+
x = arange(10).astype(float32)
xm = arange(10)
xm[2] = masked
@@ -508,7 +508,7 @@ class test_ma(ScipyTestCase):
#self.failUnlessRaises(Exception, lambda x,y: x+y, masked, 2)
#self.failUnlessRaises(Exception, lambda x,y: x+y, masked, xx)
#self.failUnlessRaises(Exception, lambda x,y: x+y, xx, masked)
-
+
def check_testAverage1(self):
"Test of average."
ott = array([0.,1.,2.,3.], mask=[1,0,0,0])
@@ -557,7 +557,7 @@ class test_ma(ScipyTestCase):
self.failUnless(allclose(average(z, axis=0), [0.,1.,99.,99.,4.0, 7.5]))
self.failUnless(allclose(average(z, axis=1), [2.5, 5.0]))
self.failUnless(allclose( average(z,weights=w2), [0.,1., 99., 99., 4.0, 10.0]))
-
+
a = arange(6)
b = arange(6) * 3
r1, w1 = average([[a,b],[b,a]], axis=1, returned=1)
@@ -643,12 +643,12 @@ class test_ufuncs(ScipyTestCase):
self.d = (array([1.0, 0, -1, pi/2]*2, mask=[0,1]+[0]*6),
array([1.0, 0, -1, pi/2]*2, mask=[1,0]+[0]*6),)
-
+
def check_testUfuncRegression(self):
for f in ['sqrt', 'log', 'log10', 'exp', 'conjugate',
- 'sin', 'cos', 'tan',
+ 'sin', 'cos', 'tan',
'arcsin', 'arccos', 'arctan',
- 'sinh', 'cosh', 'tanh',
+ 'sinh', 'cosh', 'tanh',
'arcsinh',
'arccosh',
'arctanh',
@@ -674,7 +674,7 @@ class test_ufuncs(ScipyTestCase):
mr = mf(*args)
self.failUnless(eq(ur.filled(0), mr.filled(0), f))
self.failUnless(eqmask(ur.mask, mr.mask))
-
+
def test_reduce(self):
a = self.d[0]
self.failIf(alltrue(a))
@@ -696,14 +696,14 @@ class test_ufuncs(ScipyTestCase):
for t in "?bhilqpBHILQPfdgFDGO":
x = array([1,0,2,0], mask=[0,0,1,1])
self.failUnless(eq(nonzero(x), [0]))
-
+
def eqmask(m1, m2):
if m1 is nomask:
return m2 is nomask
if m2 is nomask:
return m1 is nomask
return (m1 == m2).all()
-
+
def timingTest():
for f in [testf, testinplace]:
for n in [1000,10000,50000]:
@@ -712,8 +712,8 @@ def timingTest():
t2 = testtc(n, f)
print f.test_name
print """\
-n = %7d
-numpy time (ms) %6.1f
+n = %7d
+numpy time (ms) %6.1f
MA maskless ratio %6.1f
MA masked ratio %6.1f
""" % (n, t*1000.0, t1/t, t2/t)
@@ -755,5 +755,5 @@ def testinplace(x):
testinplace.test_name = 'Inplace operations'
if __name__ == "__main__":
- ScipyTest('numpy.core.ma').run()
+ ScipyTest('numpy.core.ma').run()
#timingTest()
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 25f2d9964..36ba229bd 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -24,7 +24,7 @@ class test_flags(ScipyTestCase):
assert_equal(self.a.flags.writeable, True)
assert_equal(self.a.flags.aligned, True)
assert_equal(self.a.flags.updateifcopy, False)
-
+
class test_attributes(ScipyTestCase):
def setUp(self):
@@ -47,7 +47,7 @@ class test_attributes(ScipyTestCase):
assert_equal(self.one.ndim, 1)
assert_equal(self.two.ndim, 2)
assert_equal(self.three.ndim, 3)
- num = self.two.itemsize
+ num = self.two.itemsize
assert_equal(self.two.size, 20)
assert_equal(self.two.nbytes, 20*num)
assert_equal(self.two.itemsize, self.two.dtype.itemsize)
@@ -74,7 +74,7 @@ class test_attributes(ScipyTestCase):
self.failUnlessRaises(ValueError, make_array, 8, 3, 1)
#self.failUnlessRaises(ValueError, make_array, 8, 3, 0)
#self.failUnlessRaises(ValueError, lambda: ndarray([1], strides=4))
-
+
def check_set_stridesattr(self):
x = self.one
@@ -90,7 +90,7 @@ class test_attributes(ScipyTestCase):
self.failUnlessRaises(ValueError, make_array, 4, 2, -1)
self.failUnlessRaises(ValueError, make_array, 8, 3, 1)
#self.failUnlessRaises(ValueError, make_array, 8, 3, 0)
-
+
def check_fill(self):
for t in "?bhilqpBHILQPfdgFDGO":
x = empty((3,2,1), t)
@@ -119,18 +119,18 @@ class test_fromstring(ScipyTestCase):
a = fromstring('1 , 2 , 3 , 4',sep=',')
b = fromstring('1,2,3,4',dtype=float,sep=',')
assert_array_equal(a,b)
-
+
class test_zero_rank(ScipyTestCase):
def setUp(self):
self.d = array(0), array('x', object)
-
+
def check_ellipsis_subscript(self):
a,b = self.d
self.failUnlessEqual(a[...], 0)
self.failUnlessEqual(b[...], 'x')
self.failUnless(a[...] is a)
self.failUnless(b[...] is b)
-
+
def check_empty_subscript(self):
a,b = self.d
self.failUnlessEqual(a[()], 0)
@@ -151,7 +151,7 @@ class test_zero_rank(ScipyTestCase):
self.failUnlessEqual(a, 42)
b[...] = ''
self.failUnlessEqual(b.item(), '')
-
+
def check_empty_subscript_assignment(self):
a,b = self.d
a[()] = 42
@@ -191,7 +191,7 @@ class test_zero_rank(ScipyTestCase):
y = ndarray((),buffer=x)
y[()] = 6
self.failUnlessEqual(x[()], 6)
-
+
class test_creation(ScipyTestCase):
def check_from_attribute(self):
class x(object):
@@ -229,12 +229,12 @@ class test_pickling(ScipyTestCase):
def setUp(self):
self.carray = array([[2,9],[7,0],[3,8]])
self.tarray = transpose(self.carray)
-
+
def check_both(self):
import pickle
assert_equal(self.carray, pickle.loads(self.carray.dumps()))
assert_equal(self.tarray, pickle.loads(self.tarray.dumps()))
-
+
# Import tests from unicode
set_local_path()
from test_unicode import *
diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py
index dbd905546..f864837e2 100644
--- a/numpy/core/tests/test_numeric.py
+++ b/numpy/core/tests/test_numeric.py
@@ -25,7 +25,7 @@ class test_dot(ScipyTestCase):
assert_almost_equal(c1, c2, decimal=self.N)
def check_matvec2(self):
- A, b2 = self.A, self.b2
+ A, b2 = self.A, self.b2
c1 = dot(A, b2)
c2 = dot_(A, b2)
assert_almost_equal(c1, c2, decimal=self.N)
@@ -46,7 +46,7 @@ class test_dot(ScipyTestCase):
A, b4 = self.A, self.b4
c1 = dot(A.transpose(),b4)
c2 = dot_(A.transpose(),b4)
- assert_almost_equal(c1, c2, decimal=self.N)
+ assert_almost_equal(c1, c2, decimal=self.N)
def check_vecvecouter(self):
b1, b3 = self.b1, self.b3
@@ -96,7 +96,7 @@ class test_bool_scalar(ScipyTestCase):
self.failUnless((t | f) is t)
self.failUnless((f | f) is f)
- def test_bitwise_and(self):
+ def test_bitwise_and(self):
f = False_
t = True_
self.failUnless((t & t) is t)
@@ -104,13 +104,10 @@ class test_bool_scalar(ScipyTestCase):
self.failUnless((t & f) is f)
self.failUnless((f & f) is f)
- def test_bitwise_xor(self):
+ def test_bitwise_xor(self):
f = False_
t = True_
self.failUnless((t ^ t) is f)
self.failUnless((f ^ t) is t)
self.failUnless((t ^ f) is t)
self.failUnless((f ^ f) is f)
-
-
-
diff --git a/numpy/core/tests/test_numerictypes.py b/numpy/core/tests/test_numerictypes.py
index 3dd2d3cf8..9ad119785 100644
--- a/numpy/core/tests/test_numerictypes.py
+++ b/numpy/core/tests/test_numerictypes.py
@@ -106,9 +106,9 @@ class create_zeros(ScipyTestCase):
"""Check creation of 0-dimensional objects"""
h = zeros((), dtype=self._descr)
self.assert_(normalize_descr(self._descr) == h.dtype.descr)
- self.assert_(h.dtype.fields['x'][0].name[:4] == 'void')
- self.assert_(h.dtype.fields['x'][0].char == 'V')
- self.assert_(h.dtype.fields['x'][0].type == numpy.void)
+ self.assert_(h.dtype.fields['x'][0].name[:4] == 'void')
+ self.assert_(h.dtype.fields['x'][0].char == 'V')
+ self.assert_(h.dtype.fields['x'][0].type == numpy.void)
# A small check that data is ok
assert_equal(h['z'], zeros((), dtype='u1'))
@@ -116,9 +116,9 @@ class create_zeros(ScipyTestCase):
"""Check creation of single-dimensional objects"""
h = zeros((2,), dtype=self._descr)
self.assert_(normalize_descr(self._descr) == h.dtype.descr)
- self.assert_(h.dtype['y'].name[:4] == 'void')
- self.assert_(h.dtype['y'].char == 'V')
- self.assert_(h.dtype['y'].type == numpy.void)
+ self.assert_(h.dtype['y'].name[:4] == 'void')
+ self.assert_(h.dtype['y'].char == 'V')
+ self.assert_(h.dtype['y'].type == numpy.void)
# A small check that data is ok
assert_equal(h['z'], zeros((2,), dtype='u1'))
@@ -126,9 +126,9 @@ class create_zeros(ScipyTestCase):
"""Check creation of multi-dimensional objects"""
h = zeros((2,3), dtype=self._descr)
self.assert_(normalize_descr(self._descr) == h.dtype.descr)
- self.assert_(h.dtype['z'].name == 'uint8')
- self.assert_(h.dtype['z'].char == 'B')
- self.assert_(h.dtype['z'].type == numpy.uint8)
+ self.assert_(h.dtype['z'].name == 'uint8')
+ self.assert_(h.dtype['z'].char == 'B')
+ self.assert_(h.dtype['z'].type == numpy.uint8)
# A small check that data is ok
assert_equal(h['z'], zeros((2,3), dtype='u1'))
@@ -238,7 +238,7 @@ class test_read_values_plain_multiple(read_values_plain):
class read_values_nested(ScipyTestCase):
"""Check the reading of values in heterogeneous arrays (nested)"""
-
+
def check_access_top_fields(self):
"""Check reading the top fields of a nested array"""
h = array(self._buffer, dtype=self._descr)
diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py
index 4cdbcb59c..386734cab 100644
--- a/numpy/core/tests/test_records.py
+++ b/numpy/core/tests/test_records.py
@@ -18,7 +18,7 @@ class test_fromrecords(ScipyTestCase):
def check_method_array2(self):
r=rec.array([(1,11,'a'),(2,22,'b'),(3,33,'c'),(4,44,'d'),(5,55,'ex'),(6,66,'f'),(7,77,'g')],formats='u1,f4,a1')
assert_equal(r[1].item(),(2, 22.0, 'b'))
-
+
def check_recarray_slices(self):
r=rec.array([(1,11,'a'),(2,22,'b'),(3,33,'c'),(4,44,'d'),(5,55,'ex'),(6,66,'f'),(7,77,'g')],formats='u1,f4,a1')
assert_equal(r[1::2][1].item(),(4, 44.0, 'd'))
@@ -38,6 +38,6 @@ class test_fromrecords(ScipyTestCase):
fd = open(filename)
fd.seek(2880*2)
r = rec.fromfile(fd, formats='f8,i4,a5', shape=3, byteorder='big')
-
+
if __name__ == "__main__":
ScipyTest().run()
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index b052145a9..d78d1cbfe 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -60,7 +60,7 @@ class test_special_methods(ScipyTestCase):
r = with_wrap()
r.arr = arr
r.context = context
- return r
+ return r
a = with_wrap()
x = minimum(a, a)
assert_equal(x.arr, zeros(1))
@@ -78,7 +78,7 @@ class test_special_methods(ScipyTestCase):
def __array_wrap__(self, arr):
r = with_wrap()
r.arr = arr
- return r
+ return r
a = with_wrap()
x = minimum(a, a)
assert_equal(x.arr, zeros(1))
@@ -158,6 +158,6 @@ class test_choose(ScipyTestCase):
c = array([True,True])
a = array([True,True])
assert_equal(choose(c, (a, 1)), array([1,1]))
-
+
if __name__ == "__main__":
ScipyTest().run()
diff --git a/numpy/core/tests/test_unicode.py b/numpy/core/tests/test_unicode.py
index a8b4a9794..8da329860 100644
--- a/numpy/core/tests/test_unicode.py
+++ b/numpy/core/tests/test_unicode.py
@@ -185,7 +185,7 @@ class assign_values(ScipyTestCase):
"""Check assignment of single-dimensional objects with values"""
ua = zeros((2,), dtype='U%s' % self.ulen)
ua[0] = self.ucs_value*self.ulen
- self.content_test(ua, ua[0], 4*self.ulen*2)
+ self.content_test(ua, ua[0], 4*self.ulen*2)
ua[1] = self.ucs_value*self.ulen
self.content_test(ua, ua[1], 4*self.ulen*2)