[Numpy-svn] r3080 - in tags/1.0b4/numpy: lib lib/tests oldnumeric
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Aug 27 03:43:45 EDT 2006
Author: oliphant
Date: 2006-08-27 02:43:37 -0500 (Sun, 27 Aug 2006)
New Revision: 3080
Modified:
tags/1.0b4/numpy/lib/function_base.py
tags/1.0b4/numpy/lib/tests/test_function_base.py
tags/1.0b4/numpy/oldnumeric/misc.py
Log:
Fix up names. insert ==> place, deletefrom ==> delete, insertinto ==> insert, appendonto ==> append
Modified: tags/1.0b4/numpy/lib/function_base.py
===================================================================
--- tags/1.0b4/numpy/lib/function_base.py 2006-08-26 09:16:41 UTC (rev 3079)
+++ tags/1.0b4/numpy/lib/function_base.py 2006-08-27 07:43:37 UTC (rev 3080)
@@ -2,12 +2,12 @@
'select', 'piecewise', 'trim_zeros',
'copy', 'iterable', #'base_repr', 'binary_repr',
'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp',
- 'unique', 'extract', 'insert', 'nansum', 'nanmax', 'nanargmax',
+ 'unique', 'extract', 'place', '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',
- 'deletefrom', 'insertinto', 'appendonto'
+ 'delete', 'insert', 'append'
]
import types
@@ -545,7 +545,7 @@
"""
return _nx.take(ravel(arr), nonzero(ravel(condition))[0])
-def insert(arr, mask, vals):
+def place(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 @@
Y = y.repeat(numCols, axis=1)
return X, Y
-def deletefrom(arr, obj, axis=None):
+def delete(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 @@
else:
return new
-def insertinto(arr, obj, values, axis=None):
+def insert(arr, obj, values, axis=None):
"""Return a new array with values inserted along the given axis
before the given indices
@@ -1205,7 +1205,7 @@
return wrap(new)
return new
-def appendonto(arr, values, axis=None):
+def append(arr, values, axis=None):
"""Append to the end of an array along axis (ravel first if None)
"""
arr = asanyarray(arr)
Modified: tags/1.0b4/numpy/lib/tests/test_function_base.py
===================================================================
--- tags/1.0b4/numpy/lib/tests/test_function_base.py 2006-08-26 09:16:41 UTC (rev 3079)
+++ tags/1.0b4/numpy/lib/tests/test_function_base.py 2006-08-27 07:43:37 UTC (rev 3080)
@@ -237,17 +237,17 @@
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_insert(self):
+ def check_place(self):
a = array([1,4,3,2,5,8,7])
- insert(a,[0,1,0,1,0,1,0],[2,4,6])
+ place(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)
- insert(a,mask,0)
- insert(a,mask,c)
+ place(a,mask,0)
+ place(a,mask,c)
assert_array_equal(a,ac)
class test_vectorize(NumpyTestCase):
Modified: tags/1.0b4/numpy/oldnumeric/misc.py
===================================================================
--- tags/1.0b4/numpy/oldnumeric/misc.py 2006-08-26 09:16:41 UTC (rev 3079)
+++ tags/1.0b4/numpy/oldnumeric/misc.py 2006-08-27 07:43:37 UTC (rev 3080)
@@ -9,7 +9,7 @@
'searchsorted', 'put', 'fromfunction', 'copy', 'resize',
'array_repr', 'e', 'StringIO', 'pickle',
'argsort', 'convolve', 'loads', 'cross_correlate',
- 'Pickler', 'dot', 'outerproduct', 'innerproduct']
+ 'Pickler', 'dot', 'outerproduct', 'innerproduct', 'insert']
import types
import StringIO
@@ -23,7 +23,8 @@
choose, swapaxes, array_str, array_repr, e, pi, \
fromfunction, resize, around, concatenate, vdot, transpose, \
diagonal, searchsorted, put, argsort, convolve, dot, \
- outer as outerproduct, inner as innerproduct, correlate as cross_correlate
+ outer as outerproduct, inner as innerproduct, correlate as cross_correlate, \
+ place as insert
from array_printer import array2string
More information about the Numpy-svn
mailing list