summaryrefslogtreecommitdiff
path: root/numpy/oldnumeric
diff options
context:
space:
mode:
authorJarrod Millman <millman@berkeley.edu>2007-12-29 02:21:56 +0000
committerJarrod Millman <millman@berkeley.edu>2007-12-29 02:21:56 +0000
commit72297ed57ac666c6ef50d5c88ef486a94f7fc080 (patch)
tree9ee064e4147d76e2b154e35103a7f46a6b3081c6 /numpy/oldnumeric
parent423b1953b1742a2b71cc766ff08a919707f19e1c (diff)
downloadnumpy-72297ed57ac666c6ef50d5c88ef486a94f7fc080.tar.gz
more janitorial work
Diffstat (limited to 'numpy/oldnumeric')
-rw-r--r--numpy/oldnumeric/functions.py42
-rw-r--r--numpy/oldnumeric/typeconv.py38
2 files changed, 40 insertions, 40 deletions
diff --git a/numpy/oldnumeric/functions.py b/numpy/oldnumeric/functions.py
index 1f09d8f84..5b2b1a8bf 100644
--- a/numpy/oldnumeric/functions.py
+++ b/numpy/oldnumeric/functions.py
@@ -1,6 +1,6 @@
# Functions that should behave the same as Numeric and need changing
-import numpy as N
+import numpy as np
import numpy.core.multiarray as mu
import numpy.core.numeric as nn
from typeconv import convtypecode, convtypecode2
@@ -13,40 +13,40 @@ __all__ = ['take', 'repeat', 'sum', 'product', 'sometrue', 'alltrue',
'average']
def take(a, indicies, axis=0):
- return N.take(a, indicies, axis)
+ return np.take(a, indicies, axis)
def repeat(a, repeats, axis=0):
- return N.repeat(a, repeats, axis)
+ return np.repeat(a, repeats, axis)
def sum(x, axis=0):
- return N.sum(x, axis)
+ return np.sum(x, axis)
def product(x, axis=0):
- return N.product(x, axis)
+ return np.product(x, axis)
def sometrue(x, axis=0):
- return N.sometrue(x, axis)
+ return np.sometrue(x, axis)
def alltrue(x, axis=0):
- return N.alltrue(x, axis)
+ return np.alltrue(x, axis)
def cumsum(x, axis=0):
- return N.cumsum(x, axis)
+ return np.cumsum(x, axis)
def cumproduct(x, axis=0):
- return N.cumproduct(x, axis)
+ return np.cumproduct(x, axis)
def argmax(x, axis=-1):
- return N.argmax(x, axis)
+ return np.argmax(x, axis)
def argmin(x, axis=-1):
- return N.argmin(x, axis)
+ return np.argmin(x, axis)
def compress(condition, m, axis=-1):
- return N.compress(condition, m, axis)
+ return np.compress(condition, m, axis)
def fromfunction(args, dimensions):
- return N.fromfunction(args, dimensions, dtype=int)
+ return np.fromfunction(args, dimensions, dtype=int)
def ones(shape, typecode='l', savespace=0, dtype=None):
"""ones(shape, dtype=int) returns an array of the given
@@ -87,14 +87,14 @@ def asarray(a, typecode=None, dtype=None):
return mu.array(a, dtype, copy=0)
def nonzero(a):
- res = N.nonzero(a)
+ res = np.nonzero(a)
if len(res) == 1:
return res[0]
else:
raise ValueError, "Input argument must be 1d"
def reshape(a, shape):
- return N.reshape(a, shape)
+ return np.reshape(a, shape)
def arange(start, stop=None, step=1, typecode=None, dtype=None):
dtype = convtypecode2(typecode, dtype)
@@ -105,20 +105,20 @@ def fromstring(string, typecode='l', count=-1, dtype=None):
return mu.fromstring(string, dtype, count=count)
def ravel(m):
- return N.ravel(m)
+ return np.ravel(m)
def trace(a, offset=0, axis1=0, axis2=1):
- return N.trace(a, offset=0, axis1=0, axis2=1)
+ return np.trace(a, offset=0, axis1=0, axis2=1)
def indices(dimensions, typecode=None, dtype=None):
dtype = convtypecode(typecode, dtype)
- return N.indices(dimensions, dtype)
+ return np.indices(dimensions, dtype)
def where(condition, x, y):
- return N.where(condition, x, y)
+ return np.where(condition, x, y)
def cross_product(a, b, axis1=-1, axis2=-1):
- return N.cross(a, b, axis1, axis2)
+ return np.cross(a, b, axis1, axis2)
def average(a, axis=0, weights=None, returned=False):
- return N.average(a, axis, weights, returned)
+ return np.average(a, axis, weights, returned)
diff --git a/numpy/oldnumeric/typeconv.py b/numpy/oldnumeric/typeconv.py
index 1fbf1e072..4e203d4ae 100644
--- a/numpy/oldnumeric/typeconv.py
+++ b/numpy/oldnumeric/typeconv.py
@@ -1,21 +1,21 @@
__all__ = ['oldtype2dtype', 'convtypecode', 'convtypecode2', 'oldtypecodes']
-import numpy as N
-
-oldtype2dtype = {'1': N.dtype(N.byte),
- 's': N.dtype(N.short),
-# 'i': N.dtype(N.intc),
-# 'l': N.dtype(int),
-# 'b': N.dtype(N.ubyte),
- 'w': N.dtype(N.ushort),
- 'u': N.dtype(N.uintc),
-# 'f': N.dtype(N.single),
-# 'd': N.dtype(float),
-# 'F': N.dtype(N.csingle),
-# 'D': N.dtype(complex),
-# 'O': N.dtype(object),
-# 'c': N.dtype('c'),
- None:N.dtype(int)
+import numpy as np
+
+oldtype2dtype = {'1': np.dtype(np.byte),
+ 's': np.dtype(np.short),
+# 'i': np.dtype(np.intc),
+# 'l': np.dtype(int),
+# 'b': np.dtype(np.ubyte),
+ 'w': np.dtype(np.ushort),
+ 'u': np.dtype(np.uintc),
+# 'f': np.dtype(np.single),
+# 'd': np.dtype(float),
+# 'F': np.dtype(np.csingle),
+# 'D': np.dtype(complex),
+# 'O': np.dtype(object),
+# 'c': np.dtype('c'),
+ None: np.dtype(int)
}
# converts typecode=None to int
@@ -24,7 +24,7 @@ def convtypecode(typecode, dtype=None):
try:
return oldtype2dtype[typecode]
except:
- return N.dtype(typecode)
+ return np.dtype(typecode)
else:
return dtype
@@ -38,7 +38,7 @@ def convtypecode2(typecode, dtype=None):
try:
return oldtype2dtype[typecode]
except:
- return N.dtype(typecode)
+ return np.dtype(typecode)
else:
return dtype
@@ -50,7 +50,7 @@ _changedtypes = {'B': 'b',
class _oldtypecodes(dict):
def __getitem__(self, obj):
- char = N.dtype(obj).char
+ char = np.dtype(obj).char
try:
return _changedtypes[char]
except KeyError: