summaryrefslogtreecommitdiff
path: root/io.py
diff options
context:
space:
mode:
authorRobert Kern <robert.kern@gmail.com>2007-12-16 05:43:03 +0000
committerRobert Kern <robert.kern@gmail.com>2007-12-16 05:43:03 +0000
commit4bd4ec942d1e4734b6b00a6c7f609c8a12202489 (patch)
treec97f8f7ed96f711592058191d13222a04f06eab9 /io.py
parent25c161b20770bd9c00c106f21019d2593953dbfd (diff)
downloadnumpy-4bd4ec942d1e4734b6b00a6c7f609c8a12202489.tar.gz
Clean up imports.
Diffstat (limited to 'io.py')
-rw-r--r--io.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/io.py b/io.py
index 169dc8f54..6272b4080 100644
--- a/io.py
+++ b/io.py
@@ -2,12 +2,14 @@
__all__ = ['savetxt', 'loadtxt',
'loads', 'load',
'save', 'savez',
- 'DataFile',
+ 'DataSource',
'unpackbits',
'packbits']
+import numpy as np
+
from cPickle import load as _cload, loads
-from _datasource import DataFile
+from _datasource import DataSource
_file = file
def load(file):
@@ -64,13 +66,13 @@ def save(file, arr):
def _getconv(dtype):
typ = dtype.type
- if issubclass(typ, bool_):
+ if issubclass(typ, np.bool_):
return lambda x: bool(int(x))
- if issubclass(typ, integer):
+ if issubclass(typ, np.integer):
return int
- elif issubclass(typ, floating):
+ elif issubclass(typ, np.floating):
return float
- elif issubclass(typ, complex):
+ elif issubclass(typ, np.complex):
return complex
else:
return str
@@ -147,7 +149,7 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, converters=None,
raise ValueError('fname must be a string or file handle')
X = []
- dtype = multiarray.dtype(dtype)
+ dtype = np.dtype(dtype)
defconv = _getconv(dtype)
converterseq = None
if converters is None:
@@ -172,7 +174,7 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, converters=None,
row = tuple(row)
X.append(row)
- X = array(X, dtype)
+ X = np.array(X, dtype)
r,c = X.shape
if r==1 or c==1:
X.shape = max([r,c]),
@@ -214,7 +216,7 @@ def savetxt(fname, X, fmt='%.18e',delimiter=' '):
raise ValueError('fname must be a string or file handle')
- X = asarray(X)
+ X = np.asarray(X)
origShape = None
if len(X.shape)==1:
origShape = X.shape