diff options
author | Travis Oliphant <oliphant@enthought.com> | 2005-11-30 09:30:51 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2005-11-30 09:30:51 +0000 |
commit | 8dfbf5d48d60c741a066c2e86ee9b4aed5d370a1 (patch) | |
tree | d87b93b538b149f8c390fb4695495de9db7e283d /scipy/base/records.py | |
parent | 0376164cffd1b64f276f2a04c922e1c1727f57d4 (diff) | |
download | numpy-8dfbf5d48d60c741a066c2e86ee9b4aed5d370a1.tar.gz |
Fixed up ndchararray a bit. Fixed up use of registered data types.
Diffstat (limited to 'scipy/base/records.py')
-rw-r--r-- | scipy/base/records.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/scipy/base/records.py b/scipy/base/records.py index 34c255a56..c80e76676 100644 --- a/scipy/base/records.py +++ b/scipy/base/records.py @@ -1,4 +1,5 @@ import numeric as sb +import numerictypes as nt import sys import types import re @@ -139,10 +140,12 @@ class format_parser: # This pads record so next record is aligned if self._rec_align is true. # Otherwise next the record starts right after the end of the last one. self._total_itemsize = (self._stops[-1]/maxalign + 1) * maxalign - -class RecArray(sb.ndarray): +class record(nt.void): + pass + +class ndrecarray(sb.ndarray): def __new__(self, *args, **kwds): buf = args[0] formats = args[1] @@ -159,15 +162,14 @@ class RecArray(sb.ndarray): else: raise NameError, "Illegal shape %s" % `shape` - typecode = 'V%d' % itemsize if buf is None: - this = sb.ndarray.__new__(RecArray, shape, typecode) + this = sb.ndarray.__new__(self, shape, record, itemsize) else: byteorder = kwds.get('byteorder', sys.byteorder) swapped = 0 if (byteorder != sys.byteorder): swapped = 1 - this = sb.ndarray.__new__(RecArray, shape, typecode, buffer=buf, + this = sb.ndarray.__new__(self, shape, record, itemsize, buffer=buf, swapped=swapped) this.parsed = parsed return this |