summaryrefslogtreecommitdiff
path: root/numpy/oldnumeric
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-13 07:15:52 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-13 07:15:52 +0000
commit01a0309eca710b4128df2c9b5ce3a6905281df4b (patch)
tree763d1e30b193a225625cefea5be5d210c02a641f /numpy/oldnumeric
parent9584e277a057c490606cd8abb9100962f4676070 (diff)
downloadnumpy-01a0309eca710b4128df2c9b5ce3a6905281df4b.tar.gz
Change default axis argument of average and several masked array functions. Move old behaviors to compatibility layer.
Diffstat (limited to 'numpy/oldnumeric')
-rw-r--r--numpy/oldnumeric/functions.py6
-rw-r--r--numpy/oldnumeric/ma.py10
-rw-r--r--numpy/oldnumeric/misc.py4
3 files changed, 17 insertions, 3 deletions
diff --git a/numpy/oldnumeric/functions.py b/numpy/oldnumeric/functions.py
index e18f12aa8..4e3f12639 100644
--- a/numpy/oldnumeric/functions.py
+++ b/numpy/oldnumeric/functions.py
@@ -9,7 +9,8 @@ __all__ = ['take', 'repeat', 'sum', 'product', 'sometrue', 'alltrue',
'cumsum', 'cumproduct', 'compress',
'ones', 'empty', 'identity', 'zeros', 'array', 'asarray',
'nonzero', 'reshape', 'arange', 'fromstring', 'ravel', 'trace',
- 'indices', 'where','sarray','cross_product', 'argmax', 'argmin']
+ 'indices', 'where','sarray','cross_product', 'argmax', 'argmin',
+ 'average']
def take(a, indicies, axis=0):
return N.take(a, indicies, axis)
@@ -115,3 +116,6 @@ def where(condition, x, y):
def cross_product(a, b, axis1=-1, axis2=-1):
return N.cross(a, b, axis1, axis2)
+
+def average(a, axis=0, weights=None, returned=False):
+ return N.average(a, axis, weights, returned)
diff --git a/numpy/oldnumeric/ma.py b/numpy/oldnumeric/ma.py
index c78fcc200..857c554ec 100644
--- a/numpy/oldnumeric/ma.py
+++ b/numpy/oldnumeric/ma.py
@@ -2,4 +2,14 @@
# instead of None
from numpy.core.ma import *
+import numpy.core.ma as nca
+
+def repeat(a, repeats, axis=0):
+ return nca.repeat(a, repeats, axis)
+
+def average(a, axis=0, weights=None, returned=0):
+ return nca.average(a, axis, weights, returned)
+
+def take(a, indices, axis=0):
+ return nca.average(a, indices, axis=0)
diff --git a/numpy/oldnumeric/misc.py b/numpy/oldnumeric/misc.py
index e8c2e3c00..a6c13d780 100644
--- a/numpy/oldnumeric/misc.py
+++ b/numpy/oldnumeric/misc.py
@@ -7,7 +7,7 @@ __all__ = ['load', 'sort', 'copy_reg', 'clip', 'putmask', 'Unpickler', 'rank',
'pi', 'math', 'concatenate',
'around', 'vdot', 'transpose', 'array2string', 'diagonal',
'searchsorted', 'put', 'fromfunction', 'copy', 'resize',
- 'array_repr', 'e', 'StringIO', 'pickle', 'average',
+ 'array_repr', 'e', 'StringIO', 'pickle',
'argsort', 'convolve', 'loads', 'cross_correlate',
'Pickler', 'dot', 'outerproduct', 'innerproduct']
@@ -22,7 +22,7 @@ from pickle import load, loads
from numpy import sort, clip, putmask, rank, sign, shape, allclose, size,\
choose, swapaxes, array_str, array_repr, e, pi, \
fromfunction, resize, around, concatenate, vdot, transpose, \
- diagonal, searchsorted, put, average, argsort, convolve, dot, \
+ diagonal, searchsorted, put, argsort, convolve, dot, \
outer as outerproduct, inner as innerproduct, correlate as cross_correlate
from array_printer import array2string