diff options
| author | Travis Oliphant <oliphant@enthought.com> | 2006-08-28 19:52:55 +0000 |
|---|---|---|
| committer | Travis Oliphant <oliphant@enthought.com> | 2006-08-28 19:52:55 +0000 |
| commit | 64be3e2a89c72a8b23ad11b3719bd66725658c61 (patch) | |
| tree | 4321cfd32dbc856fa384a3394451460cf591dfbf /numpy/lib | |
| parent | caa4b1340b41fee581433ad5802c49b8d6de85b7 (diff) | |
| download | numpy-1.0b4.tar.gz | |
Undoing changes mistakenly made on tag 1.0b4v1.0b4
Diffstat (limited to 'numpy/lib')
| -rw-r--r-- | numpy/lib/function_base.py | 15 | ||||
| -rw-r--r-- | numpy/lib/tests/test_function_base.py | 8 |
2 files changed, 11 insertions, 12 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 9df31f463..3be679a03 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1,13 +1,13 @@ -u__all__ = ['logspace', 'linspace', +__all__ = ['logspace', 'linspace', 'select', 'piecewise', 'trim_zeros', 'copy', 'iterable', #'base_repr', 'binary_repr', 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp', - 'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax', + 'unique', 'extract', 'insert', 'nansum', 'nanmax', 'nanargmax', 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average', 'histogram', 'bincount', 'digitize', 'cov', 'corrcoef', 'msort', 'median', 'sinc', 'hamming', 'hanning', 'bartlett', 'blackman', 'kaiser', 'trapz', 'i0', 'add_newdoc', 'add_docstring', 'meshgrid', - 'delete', 'insert', 'append' + 'deletefrom', 'insertinto', 'appendonto' ] import types @@ -545,7 +545,7 @@ def extract(condition, arr): """ return _nx.take(ravel(arr), nonzero(ravel(condition))[0]) -def place(arr, mask, vals): +def insert(arr, mask, vals): """Similar to putmask arr[mask] = vals but the 1D array vals has the same number of elements as the non-zero values of mask. Inverse of extract. @@ -1011,7 +1011,7 @@ def meshgrid(x,y): Y = y.repeat(numCols, axis=1) return X, Y -def delete(arr, obj, axis=None): +def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) @@ -1117,7 +1117,7 @@ def delete(arr, obj, axis=None): else: return new -def insert(arr, obj, values, axis=None): +def insertinto(arr, obj, values, axis=None): """Return a new array with values inserted along the given axis before the given indices @@ -1205,7 +1205,7 @@ def insert(arr, obj, values, axis=None): return wrap(new) return new -def append(arr, values, axis=None): +def appendonto(arr, values, axis=None): """Append to the end of an array along axis (ravel first if None) """ arr = asanyarray(arr) @@ -1215,4 +1215,3 @@ def append(arr, values, axis=None): values = ravel(values) axis = arr.ndim-1 return concatenate((arr, values), axis=axis) - diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index fdb2f270f..9a1825e39 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -237,17 +237,17 @@ class test_extins(NumpyTestCase): a = array([1,3,2,1,2,3,3]) b = extract(a>1,a) assert_array_equal(b,[3,2,2,3,3]) - def check_place(self): + def check_insert(self): a = array([1,4,3,2,5,8,7]) - place(a,[0,1,0,1,0,1,0],[2,4,6]) + insert(a,[0,1,0,1,0,1,0],[2,4,6]) assert_array_equal(a,[1,2,3,4,5,6,7]) def check_both(self): a = rand(10) mask = a > 0.5 ac = a.copy() c = extract(mask, a) - place(a,mask,0) - place(a,mask,c) + insert(a,mask,0) + insert(a,mask,c) assert_array_equal(a,ac) class test_vectorize(NumpyTestCase): |
