[Numpy-svn] r4730 - in branches/maskedarray: . benchmarks numpy numpy/core numpy/core/code_generators numpy/core/src numpy/core/tests numpy/distutils numpy/distutils/command numpy/distutils/fcompiler numpy/doc numpy/doc/html numpy/doc/swig/test numpy/f2py numpy/f2py/lib/parser numpy/fft/tests numpy/lib numpy/lib/src numpy/lib/tests numpy/linalg numpy/numarray numpy/oldnumeric numpy/random/tests numpy/testing numpy/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Jan 18 18:35:15 EST 2008


Author: stefan
Date: 2008-01-18 17:25:32 -0600 (Fri, 18 Jan 2008)
New Revision: 4730

Added:
   branches/maskedarray/numpy/lib/_datasource.py
   branches/maskedarray/numpy/lib/format.py
   branches/maskedarray/numpy/lib/io.py
   branches/maskedarray/numpy/lib/tests/test_format.py
Modified:
   branches/maskedarray/
   branches/maskedarray/benchmarks/benchmark.py
   branches/maskedarray/benchmarks/creating.py
   branches/maskedarray/benchmarks/simpleindex.py
   branches/maskedarray/benchmarks/sorting.py
   branches/maskedarray/numpy/__init__.py
   branches/maskedarray/numpy/_import_tools.py
   branches/maskedarray/numpy/add_newdocs.py
   branches/maskedarray/numpy/core/code_generators/generate_umath.py
   branches/maskedarray/numpy/core/code_generators/multiarray_api_order.txt
   branches/maskedarray/numpy/core/defmatrix.py
   branches/maskedarray/numpy/core/numeric.py
   branches/maskedarray/numpy/core/records.py
   branches/maskedarray/numpy/core/src/arrayobject.c
   branches/maskedarray/numpy/core/src/arraytypes.inc.src
   branches/maskedarray/numpy/core/src/multiarraymodule.c
   branches/maskedarray/numpy/core/src/scalartypes.inc.src
   branches/maskedarray/numpy/core/src/umathmodule.c.src
   branches/maskedarray/numpy/core/tests/test_multiarray.py
   branches/maskedarray/numpy/core/tests/test_regression.py
   branches/maskedarray/numpy/core/tests/test_scalarmath.py
   branches/maskedarray/numpy/core/tests/test_ufunc.py
   branches/maskedarray/numpy/core/tests/test_umath.py
   branches/maskedarray/numpy/distutils/command/build_src.py
   branches/maskedarray/numpy/distutils/exec_command.py
   branches/maskedarray/numpy/distutils/fcompiler/intel.py
   branches/maskedarray/numpy/distutils/interactive.py
   branches/maskedarray/numpy/distutils/log.py
   branches/maskedarray/numpy/doc/DISTUTILS.txt
   branches/maskedarray/numpy/doc/HOWTO_DOCUMENT.txt
   branches/maskedarray/numpy/doc/example.py
   branches/maskedarray/numpy/doc/html/epydoc.css
   branches/maskedarray/numpy/doc/html/epydoc.js
   branches/maskedarray/numpy/doc/html/example-module.html
   branches/maskedarray/numpy/doc/html/example-pysrc.html
   branches/maskedarray/numpy/doc/html/help.html
   branches/maskedarray/numpy/doc/html/identifier-index.html
   branches/maskedarray/numpy/doc/html/module-tree.html
   branches/maskedarray/numpy/doc/html/toc-everything.html
   branches/maskedarray/numpy/doc/html/toc-example-module.html
   branches/maskedarray/numpy/doc/html/toc.html
   branches/maskedarray/numpy/doc/swig/test/testArray.py
   branches/maskedarray/numpy/doc/swig/test/testFarray.py
   branches/maskedarray/numpy/doc/swig/test/testMatrix.py
   branches/maskedarray/numpy/doc/swig/test/testTensor.py
   branches/maskedarray/numpy/doc/swig/test/testVector.py
   branches/maskedarray/numpy/f2py/f90mod_rules.py
   branches/maskedarray/numpy/f2py/lib/parser/block_statements.py
   branches/maskedarray/numpy/fft/tests/test_fftpack.py
   branches/maskedarray/numpy/lib/__init__.py
   branches/maskedarray/numpy/lib/arraysetops.py
   branches/maskedarray/numpy/lib/getlimits.py
   branches/maskedarray/numpy/lib/index_tricks.py
   branches/maskedarray/numpy/lib/scimath.py
   branches/maskedarray/numpy/lib/src/_compiled_base.c
   branches/maskedarray/numpy/lib/tests/test_arraysetops.py
   branches/maskedarray/numpy/lib/tests/test_getlimits.py
   branches/maskedarray/numpy/lib/tests/test_polynomial.py
   branches/maskedarray/numpy/lib/utils.py
   branches/maskedarray/numpy/linalg/info.py
   branches/maskedarray/numpy/linalg/linalg.py
   branches/maskedarray/numpy/matlib.py
   branches/maskedarray/numpy/numarray/functions.py
   branches/maskedarray/numpy/oldnumeric/functions.py
   branches/maskedarray/numpy/oldnumeric/typeconv.py
   branches/maskedarray/numpy/random/tests/test_random.py
   branches/maskedarray/numpy/testing/numpytest.py
   branches/maskedarray/numpy/testing/utils.py
   branches/maskedarray/numpy/tests/test_ctypeslib.py
   branches/maskedarray/setup.py
Log:
Merge maskedarray branch up to r4729.



Property changes on: branches/maskedarray
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /trunk:1-2871
   + /branches/build_with_scons:1-4676 /branches/cleanconfig_rtm:1-4610 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /trunk:1-2871

Modified: branches/maskedarray/benchmarks/benchmark.py
===================================================================
--- branches/maskedarray/benchmarks/benchmark.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/benchmarks/benchmark.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -17,7 +17,7 @@
             modules = [module]
 
         for m in modules:
-            setup_str = 'import %s; import %s as N; ' % (m,m) \
+            setup_str = 'import %s; import %s as np; ' % (m,m) \
                         + setup_str
             self.module_test[m] = Timer(test_str, setup_str)
 

Modified: branches/maskedarray/benchmarks/creating.py
===================================================================
--- branches/maskedarray/benchmarks/creating.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/benchmarks/creating.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -7,8 +7,8 @@
               title='Creating %s zeros.' % N,
               runs=3,reps=10000)
 
-b['numpy'] = ('a=N.zeros(shape,type)', 'shape=%s;type=float' % N)
-b['Numeric'] = ('a=N.zeros(shape,type)', 'shape=%s;type=N.Float' % N)
-b['numarray'] = ('a=N.zeros(shape,type)', "shape=%s;type=N.Float" % N)
+b['numpy'] = ('a=np.zeros(shape,type)', 'shape=%s;type=float' % N)
+b['Numeric'] = ('a=np.zeros(shape,type)', 'shape=%s;type=np.Float' % N)
+b['numarray'] = ('a=np.zeros(shape,type)', "shape=%s;type=np.Float" % N)
 
 b.run()

Modified: branches/maskedarray/benchmarks/simpleindex.py
===================================================================
--- branches/maskedarray/benchmarks/simpleindex.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/benchmarks/simpleindex.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -5,21 +5,25 @@
 #   in the first place.
 
 N = 30
+
 code2 = r"""
 for k in xrange(%d):
     for l in xrange(%d):
         res = a[k,l].item() + a[l,k].item()
 """ % (N,N)
+
 code3 = r"""
 for k in xrange(%d):
     for l in xrange(%d):
         res = a[k][l] + a[l][k]
 """ % (N,N)
+
 code = r"""
 for k in xrange(%d):
     for l in xrange(%d):
         res = a[k,l] + a[l,k]
 """ % (N,N)
+
 setup3 = r"""
 import random
 a = [[None for k in xrange(%d)] for l in xrange(%d)]
@@ -27,16 +31,19 @@
     for l in xrange(%d):
         a[k][l] = random.random()
 """ % (N,N,N,N)
-t1 = timeit.Timer(code, 'import numpy as N; a = N.random.rand(%d,%d)' % (N,N))
-t2 = timeit.Timer(code, 'import MLab as N; a=N.rand(%d,%d)' % (N,N))
-t3 = timeit.Timer(code, 'import numarray.mlab as N; a=N.rand(%d,%d)' % (N,N))
-t4 = timeit.Timer(code2, 'import numpy as N; a = N.random.rand(%d,%d)' % (N,N))
-t5 = timeit.Timer(code3, setup3)
-t6 = timeit.Timer("res = a + a.transpose()","import numpy as N; a=N.random.rand(%d,%d)" % (N,N))
+
+numpy_timer1 = timeit.Timer(code, 'import numpy as np; a = np.random.rand(%d,%d)' % (N,N))
+numeric_timer = timeit.Timer(code, 'import MLab as np; a=np.rand(%d,%d)' % (N,N))
+numarray_timer = timeit.Timer(code, 'import numarray.mlab as np; a=np.rand(%d,%d)' % (N,N))
+numpy_timer2 = timeit.Timer(code2, 'import numpy as np; a = np.random.rand(%d,%d)' % (N,N))
+python_timer = timeit.Timer(code3, setup3)
+numpy_timer3 = timeit.Timer("res = a + a.transpose()","import numpy as np; a=np.random.rand(%d,%d)" % (N,N))
+
 print "shape = ", (N,N)
-print "NumPy 1: ", t1.repeat(3,100)
-print "NumPy 2: ", t4.repeat(3,100)
-print "Numeric: ", t2.repeat(3,100)
-print "Numarray: ", t3.repeat(3,100)
-print "Python: ", t5.repeat(3,100)
-print "Optimized: ", t6.repeat(3,100)
+print "NumPy 1: ", numpy_timer1.repeat(3,100)
+print "NumPy 2: ", numpy_timer2.repeat(3,100)
+print "Numeric: ", numeric_timer.repeat(3,100)
+print "Numarray: ", numarray_timer.repeat(3,100)
+print "Python: ", python_timer.repeat(3,100)
+print "Optimized: ", numpy_timer3.repeat(3,100)
+

Modified: branches/maskedarray/benchmarks/sorting.py
===================================================================
--- branches/maskedarray/benchmarks/sorting.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/benchmarks/sorting.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -5,21 +5,21 @@
 
 N = 10000
 b.title = 'Sorting %d elements' % N
-b['numarray'] = ('a=N.array(None,shape=%d,typecode="i");a.sort()'%N,'')
-b['numpy'] = ('a=N.empty(shape=%d, dtype="i");a.sort()'%N,'')
-b['Numeric'] = ('a=N.empty(shape=%d, typecode="i");N.sort(a)'%N,'')
+b['numarray'] = ('a=np.array(None,shape=%d,typecode="i");a.sort()'%N,'')
+b['numpy'] = ('a=np.empty(shape=%d, dtype="i");a.sort()'%N,'')
+b['Numeric'] = ('a=np.empty(shape=%d, typecode="i");np.sort(a)'%N,'')
 b.run()
 
 N1,N2 = 100,100
 b.title = 'Sorting (%d,%d) elements, last axis' % (N1,N2)
-b['numarray'] = ('a=N.array(None,shape=(%d,%d),typecode="i");a.sort()'%(N1,N2),'')
-b['numpy'] = ('a=N.empty(shape=(%d,%d), dtype="i");a.sort()'%(N1,N2),'')
-b['Numeric'] = ('a=N.empty(shape=(%d,%d),typecode="i");N.sort(a)'%(N1,N2),'')
+b['numarray'] = ('a=np.array(None,shape=(%d,%d),typecode="i");a.sort()'%(N1,N2),'')
+b['numpy'] = ('a=np.empty(shape=(%d,%d), dtype="i");a.sort()'%(N1,N2),'')
+b['Numeric'] = ('a=np.empty(shape=(%d,%d),typecode="i");np.sort(a)'%(N1,N2),'')
 b.run()
 
 N1,N2 = 100,100
 b.title = 'Sorting (%d,%d) elements, first axis' % (N1,N2)
-b['numarray'] = ('a=N.array(None,shape=(%d,%d), typecode="i");a.sort(0)'%(N1,N2),'')
-b['numpy'] = ('a=N.empty(shape=(%d,%d),dtype="i");N.sort(a,0)'%(N1,N2),'')
-b['Numeric'] = ('a=N.empty(shape=(%d,%d),typecode="i");N.sort(a,0)'%(N1,N2),'')
+b['numarray'] = ('a=np.array(None,shape=(%d,%d), typecode="i");a.sort(0)'%(N1,N2),'')
+b['numpy'] = ('a=np.empty(shape=(%d,%d),dtype="i");np.sort(a,0)'%(N1,N2),'')
+b['Numeric'] = ('a=np.empty(shape=(%d,%d),typecode="i");np.sort(a,0)'%(N1,N2),'')
 b.run()

Modified: branches/maskedarray/numpy/__init__.py
===================================================================
--- branches/maskedarray/numpy/__init__.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/__init__.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,4 +1,4 @@
-"""\
+"""
 NumPy
 ==========
 
@@ -7,25 +7,29 @@
 
   http://www.trelgol.com
 
-It is being distributed for a fee for only a few years to
+It is being distributed for a fee until Oct. 2010 to
 cover some of the costs of development.  After the restriction period
 it will also be freely available.
 
-Additional documentation is available in the docstrings and at
+Documentation is available in the docstrings and at
 
 http://www.scipy.org.
 """
 
+# We first need to detect if we're being called as part of the numpy setup
+# procedure itself in a reliable manner.
 try:
-    from numpy.__config__ import show as show_config
-except ImportError:
-    show_config = None
+    __NUMPY_SETUP__
+except NameError:
+    __NUMPY_SETUP__ = False
 
-if show_config is None:
+
+if __NUMPY_SETUP__:
     import sys as _sys
     print >> _sys.stderr, 'Running from numpy source directory.'
     del _sys
 else:
+    from numpy.__config__ import show as show_config
     from version import version as __version__
 
     from _import_tools import PackageLoader
@@ -34,6 +38,7 @@
         loader = PackageLoader(infunc=True)
         return loader(*packages, **options)
 
+    pkgload.__doc__ = PackageLoader.__call__.__doc__
     import testing
     from testing import ScipyTest, NumpyTest
     import core
@@ -80,8 +85,8 @@
 
 Global symbols from subpackages
 -------------------------------
-core    --> *
-lib     --> *
+core    --> * (use numpy.* not numpy.core.*)
+lib     --> * (use numpy.* not numpy.lib.*)
 testing --> NumpyTest
 """
 
@@ -95,7 +100,7 @@
 
     import add_newdocs
 
-    __all__.extend(['add_newdocs','test'])
+    __all__.extend(['add_newdocs'])
 
     if __doc__ is not None:
         __doc__ += """

Modified: branches/maskedarray/numpy/_import_tools.py
===================================================================
--- branches/maskedarray/numpy/_import_tools.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/_import_tools.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -131,8 +131,6 @@
     def __call__(self,*packages, **options):
         """Load one or more packages into parent package top-level namespace.
 
-    Usage:
-
        This function is intended to shorten the need to import many
        subpackages, say of scipy, constantly with statements such as
 
@@ -152,22 +150,19 @@
        If a name which doesn't exist in scipy's namespace is
        given, a warning is shown.
 
-     Inputs:
+       Parameters
+       ----------
+        *packges : arg-tuple 
+             the names (one or more strings) of all the modules one
+             wishes to load into the top-level namespace.
+        verbose= : integer 
+             verbosity level [default: -1].
+             verbose=-1 will suspend also warnings.
+        force= : bool
+             when True, force reloading loaded packages [default: False].
+        postpone= : bool
+             when True, don't load packages [default: False]
 
-       - the names (one or more strings) of all the numpy modules one
-         wishes to load into the top-level namespace.
-
-     Optional keyword inputs:
-
-       - verbose - integer specifying verbosity level [default: -1].
-                   verbose=-1 will suspend also warnings.
-       - force   - when True, force reloading loaded packages
-                   [default: False].
-       - postpone - when True, don't load packages [default: False]
-
-     If no input arguments are given, then all of scipy's subpackages
-     are imported.
-
      """
         frame = self.parent_frame
         self.info_modules = {}

Modified: branches/maskedarray/numpy/add_newdocs.py
===================================================================
--- branches/maskedarray/numpy/add_newdocs.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/add_newdocs.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,3 +1,7 @@
+# This is only meant to add docs to
+#  objects defined in C-extension modules.
+# The purpose is to allow easier editing of the
+#  docstrings without requiring a re-compile. 
 from lib import add_newdoc
 
 add_newdoc('numpy.core','dtype',
@@ -132,30 +136,37 @@
 
     Return an array from object with the specified date-type.
 
-    Inputs:
-      object - an array, any object exposing the array interface, any
-                object whose __array__ method returns an array, or any
-                (nested) sequence.
-      dtype  - The desired data-type for the array.  If not given, then
-                the type will be determined as the minimum type required
-                to hold the objects in the sequence.  This argument can only
-                be used to 'upcast' the array.  For downcasting, use the
-                .astype(t) method.
-      copy   - If true, then force a copy.  Otherwise a copy will only occur
-                if __array__ returns a copy, obj is a nested sequence, or
-                a copy is needed to satisfy any of the other requirements
-      order  - Specify the order of the array.  If order is 'C', then the
-                array will be in C-contiguous order (last-index varies the
-                fastest).  If order is 'FORTRAN', then the returned array
-                will be in Fortran-contiguous order (first-index varies the
-                fastest).  If order is None, then the returned array may
-                be in either C-, or Fortran-contiguous order or even
-                discontiguous.
-      subok  - If True, then sub-classes will be passed-through, otherwise
-                the returned array will be forced to be a base-class array
-      ndmin  - Specifies the minimum number of dimensions that the resulting
-                array should have.  1's will be pre-pended to the shape as
-                needed to meet this requirement.
+    Parameters
+    ----------
+    object : array-like
+        an array, any object exposing the array interface, any
+        object whose __array__ method returns an array, or any
+        (nested) sequence.
+    dtype : data-type
+        The desired data-type for the array.  If not given, then
+        the type will be determined as the minimum type required
+        to hold the objects in the sequence.  This argument can only
+        be used to 'upcast' the array.  For downcasting, use the
+        .astype(t) method.
+    copy : bool
+        If true, then force a copy.  Otherwise a copy will only occur
+        if __array__ returns a copy, obj is a nested sequence, or
+        a copy is needed to satisfy any of the other requirements
+    order : {'C', 'F', 'A' (None)}
+        Specify the order of the array.  If order is 'C', then the
+        array will be in C-contiguous order (last-index varies the
+        fastest).  If order is 'FORTRAN', then the returned array
+        will be in Fortran-contiguous order (first-index varies the
+        fastest).  If order is None, then the returned array may
+        be in either C-, or Fortran-contiguous order or even
+        discontiguous.
+    subok : bool
+        If True, then sub-classes will be passed-through, otherwise
+        the returned array will be forced to be a base-class array
+    ndmin : int
+        Specifies the minimum number of dimensions that the resulting
+        array should have.  1's will be pre-pended to the shape as
+        needed to meet this requirement.
 
     """)
 
@@ -220,14 +231,17 @@
 add_newdoc('numpy.core.multiarray','fromfile',
     """fromfile(file=, dtype=float, count=-1, sep='') -> array.
 
-    Required arguments:
-        file -- open file object or string containing file name.
+    Parameters
+    ----------
+    file : file or string
+        open file object or string containing file name.
+    dtype : data-type
+        data type of the returned array
+    count : int 
+        number of items to read (-1 mean 'all')
+    sep : string
+        separater between items if file is a text file (default "")
 
-    Keyword arguments:
-        dtype -- type and order of the returned array (default float)
-        count -- number of items to input (default all)
-        sep -- separater between items if file is a text file (default "")
-
     Return an array of the given data type from a text or binary file. The
     'file' argument can be an open file or a string with the name of a file to
     read from.  If 'count' == -1 the entire file is read, otherwise count is the
@@ -236,7 +250,6 @@
     the separator between elements in a text file. The 'dtype' value is also
     used to determine the size and order of the items in binary files.
 
-
     Data written using the tofile() method can be conveniently recovered using
     this function.
 
@@ -268,8 +281,8 @@
     The tuple of sequences (a1, a2, ...) are joined along the given axis
     (default is the first one) into a single numpy array.
 
-    Example:
-
+    Examples
+    --------
     >>> concatenate( ([0,1,2], [5,6,7]) )
     array([0, 1, 2, 5, 6, 7])
 
@@ -343,26 +356,29 @@
 
     Return elements from `x` or `y`, depending on `condition`.
 
-    *Parameters*:
-        condition : array of bool
-            When True, yield x, otherwise yield y.
-        x,y : 1-dimensional arrays
-            Values from which to choose.
+    Parameters
+    ----------
+    condition : array of bool
+        When True, yield x, otherwise yield y.
+    x,y : 1-dimensional arrays
+        Values from which to choose.
 
-    *Notes*
-        This is equivalent to
+    Notes
+    -----
+    This is equivalent to
 
-            [xv if c else yv for (c,xv,yv) in zip(condition,x,y)]
+        [xv if c else yv for (c,xv,yv) in zip(condition,x,y)]
 
-        The result is shaped like `condition` and has elements of `x`
-        or `y` where `condition` is respectively True or False.
+    The result is shaped like `condition` and has elements of `x`
+    or `y` where `condition` is respectively True or False.
 
-        In the special case, where only `condition` is given, the
-        tuple condition.nonzero() is returned, instead.
+    In the special case, where only `condition` is given, the
+    tuple condition.nonzero() is returned, instead.
 
-    *Examples*
-        >>> where([True,False,True],[1,2,3],[4,5,6])
-        array([1, 5, 3])
+    Examples
+    --------
+    >>> where([True,False,True],[1,2,3],[4,5,6])
+    array([1, 5, 3])
 
     """)
 
@@ -379,36 +395,36 @@
     sort order, and so on).  The keys argument must be a sequence of things
     that can be converted to arrays of the same shape.
 
-    *Parameters*:
+    Parameters
+    ----------
+    keys : (k,N) array or tuple of (N,) sequences
+        Array containing values that the returned indices should sort.
 
-        keys : (k,N) array or tuple of (N,) sequences
-            Array containing values that the returned indices should sort.
+    axis : integer
+        Axis to be indirectly sorted.  Default is -1 (i.e. last axis).
 
-        axis : integer
-            Axis to be indirectly sorted.  Default is -1 (i.e. last axis).
+    Returns
+    -------
+    indices : (N,) integer array
+        Array of indices that sort the keys along the specified axis.
 
-    *Returns*:
+    See Also
+    --------
+    argsort : indirect sort
+    sort : inplace sort
 
-        indices : (N,) integer array
-            Array of indices that sort the keys along the specified axis.
+    Examples
+    --------
+    >>> a = [1,5,1,4,3,6,7]
+    >>> b = [9,4,0,4,0,4,3]
+    >>> ind = lexsort((b,a))
+    >>> print ind
+    [2 0 4 3 1 5 6]
+    >>> print take(a,ind)
+    [1 1 3 4 5 6 7]
+    >>> print take(b,ind)
+    [0 9 0 4 4 4 3]
 
-    *See Also*:
-
-        `argsort` : indirect sort
-        `sort` : inplace sort
-
-    *Examples*
-
-        >>> a = [1,5,1,4,3,6,7]
-        >>> b = [9,4,0,4,0,4,3]
-        >>> ind = lexsort((b,a))
-        >>> print ind
-        [2 0 4 3 1 5 6]
-        >>> print take(a,ind)
-        [1 1 3 4 5 6 7]
-        >>> print take(b,ind)
-        [0 9 0 4 4 4 3]
-
     """)
 
 add_newdoc('numpy.core.multiarray','can_cast',
@@ -623,12 +639,13 @@
 
     Return a copy of the array.
 
-    Argument:
-        order -- Order of returned copy (default 'C')
-            If order is 'C' (False) then the result is contiguous (default).
-            If order is 'Fortran' (True) then the result has fortran order.
-            If order is 'Any' (None) then the result has fortran order
-            only if m is already in fortran order.;
+    Parameters
+    ----------
+    order : {'C', 'F', 'A'}
+        If order is 'C' (False) then the result is contiguous (default).
+        If order is 'Fortran' (True) then the result has fortran order.
+        If order is 'Any' (None) then the result has fortran order
+        only if m is already in fortran order.;
 
     """))
 
@@ -650,16 +667,19 @@
 
 
 add_newdoc('numpy.core.multiarray', 'ndarray', ('__setstate__',
-    """a.__setstate__(version, shape, typecode, isfortran, rawdata)
+    """a.__setstate__(version, shape, dtype, isfortran, rawdata)
 
     For unpickling.
 
-    Arguments:
-        version -- optional pickle version. If omitted defaults to 0.
-        shape -- a tuple giving the shape
-        typecode -- a typecode
-        isFortran --  a bool stating if Fortran or no
-        rawdata -- a binary string with the data (or a list if Object array)
+    Parameters
+    ----------
+    version : int
+        optional pickle version. If omitted defaults to 0.
+    shape : tuple
+    dtype : data-type
+    isFortran : bool
+    rawdata : string or list
+        a binary string with the data (or a list if 'a' is an object array)
 
     """))
 
@@ -695,34 +715,32 @@
     by the kind keyword. It returns an array of indices of the same shape as
     'a' that index data along the given axis in sorted order.
 
-    :Parameters:
+    Parameters
+    ----------
+    axis : integer
+        Axis to be indirectly sorted. None indicates that the flattened
+        array should be used. Default is -1.
+    kind : string
+        Sorting algorithm to use. Possible values are 'quicksort',
+        'mergesort', or 'heapsort'. Default is 'quicksort'.
+    order : list type or None
+        When a is an array with fields defined, this argument specifies
+        which fields to compare first, second, etc.  Not all fields need be
+        specified.
 
-        axis : integer
-            Axis to be indirectly sorted. None indicates that the flattened
-            array should be used. Default is -1.
+    Returns
+    -------
+    indices : integer array
+        Array of indices that sort 'a' along the specified axis.
 
-        kind : string
-            Sorting algorithm to use. Possible values are 'quicksort',
-            'mergesort', or 'heapsort'. Default is 'quicksort'.
+    SeeAlso
+    -------
+    lexsort : indirect stable sort with multiple keys
+    sort : inplace sort
 
-        order : list type or None
-            When a is an array with fields defined, this argument specifies
-            which fields to compare first, second, etc.  Not all fields need be
-            specified.
+    Notes
+    -----
 
-    :Returns:
-
-        indices : integer array
-            Array of indices that sort 'a' along the specified axis.
-
-    :SeeAlso:
-
-      - lexsort : indirect stable sort with multiple keys
-      - sort : inplace sort
-
-    :Notes:
-    ------
-
     The various sorts are characterized by average speed, worst case
     performance, need for work space, and whether they are stable. A stable
     sort keeps items with the same key in the same relative order. The three
@@ -803,12 +821,13 @@
 
     Return a copy of the array.
 
-    Argument:
-        order -- Order of returned copy (default 'C')
-            If order is 'C' (False) then the result is contiguous (default).
-            If order is 'Fortran' (True) then the result has fortran order.
-            If order is 'Any' (None) then the result has fortran order
-            only if m is already in fortran order.;
+    Parameters
+    ----------
+    order : Order of returned copy (default 'C')
+        If order is 'C' (False) then the result is contiguous (default).
+        If order is 'Fortran' (True) then the result has fortran order.
+        If order is 'Any' (None) then the result has fortran order
+        only if m is already in fortran order.;
 
     """))
 
@@ -835,30 +854,32 @@
     be determined by removing axis1 and axis2 and appending an index to the
     right equal to the size of the resulting diagonals.
 
-    :Parameters:
-        offset : integer
-            Offset of the diagonal from the main diagonal. Can be both positive
-            and negative. Defaults to main diagonal.
-        axis1 : integer
-            Axis to be used as the first axis of the 2-d subarrays from which
-            the diagonals should be taken. Defaults to first index.
-        axis2 : integer
-            Axis to be used as the second axis of the 2-d subarrays from which
-            the diagonals should be taken. Defaults to second index.
+    Parameters
+    ----------
+    offset : integer
+        Offset of the diagonal from the main diagonal. Can be both positive
+        and negative. Defaults to main diagonal.
+    axis1 : integer
+        Axis to be used as the first axis of the 2-d subarrays from which
+        the diagonals should be taken. Defaults to first index.
+    axis2 : integer
+        Axis to be used as the second axis of the 2-d subarrays from which
+        the diagonals should be taken. Defaults to second index.
 
-    :Returns:
-        array_of_diagonals : same type as original array
-            If a is 2-d, then a 1-d array containing the diagonal is returned.
-            If a is n-d, n > 2, then an array of diagonals is returned.
+    Returns
+    -------
+    array_of_diagonals : same type as original array
+        If a is 2-d, then a 1-d array containing the diagonal is returned.
+        If a is n-d, n > 2, then an array of diagonals is returned.
 
-    :SeeAlso:
-        - diag : matlab workalike for 1-d and 2-d arrays.
-        - diagflat : creates diagonal arrays
-        - trace : sum along diagonals
+    SeeAlso
+    -------
+    diag : matlab workalike for 1-d and 2-d arrays.
+    diagflat : creates diagonal arrays
+    trace : sum along diagonals
 
     Examples
     --------
-
     >>> a = arange(4).reshape(2,2)
     >>> a
     array([[0, 1],
@@ -943,39 +964,36 @@
     Returns the average of the array elements.  The average is taken over the
     flattened array by default, otherwise over the specified axis.
 
-    :Parameters:
+    Parameters
+    ----------
+    axis : integer
+        Axis along which the means are computed. The default is
+        to compute the standard deviation of the flattened array.
+    dtype : type
+        Type to use in computing the means. For arrays of
+        integer type the default is float32, for arrays of float types it
+        is the same as the array type.
+    out : ndarray
+        Alternative output array in which to place the result. It must have
+        the same shape as the expected output but the type will be cast if
+        necessary.
 
-        axis : integer
-            Axis along which the means are computed. The default is
-            to compute the standard deviation of the flattened array.
+    Returns
+    -------
+    mean : The return type varies, see above.
+        A new array holding the result is returned unless out is specified,
+        in which case a reference to out is returned.
 
-        dtype : type
-            Type to use in computing the means. For arrays of
-            integer type the default is float32, for arrays of float types it
-            is the same as the array type.
+    SeeAlso
+    -------
+    var : variance
+    std : standard deviation
 
-        out : ndarray
-            Alternative output array in which to place the result. It must have
-            the same shape as the expected output but the type will be cast if
-            necessary.
-
-    :Returns:
-
-        mean : The return type varies, see above.
-            A new array holding the result is returned unless out is specified,
-            in which case a reference to out is returned.
-
-    :SeeAlso:
-
-        - var : variance
-        - std : standard deviation
-
     Notes
     -----
+    The mean is the sum of the elements along the axis divided by the
+    number of elements.
 
-        The mean is the sum of the elements along the axis divided by the
-        number of elements.
-
     """))
 
 
@@ -1070,14 +1088,17 @@
 
 
 add_newdoc('numpy.core.multiarray', 'ndarray', ('round',
-    """a.round(decimals=0, out=None) -> out (a). Rounds to 'decimals' places.
+    """a.round(decimals=0, out=None) -> out (new). Rounds to 'decimals' places.
 
-    Keyword arguments:
-        decimals -- number of decimals to round to (default 0). May be negative.
-        out -- existing array to use for output (default a).
+    Parameters
+    ----------
+    decimals : integer
+        number of decimals to round to. May be negative.
+    out : existing array to use for output (default new array).
 
-    Return:
-        Reference to out, where None specifies the original array a.
+    Returns
+    -------
+    Reference to out, where None specifies a new array.
 
     Round to the specified number of decimals. When 'decimals' is negative it
     specifies the number of positions to the left of the decimal point. The
@@ -1085,9 +1106,10 @@
     is done if the array is not of float type and 'decimals' is >= 0.
 
     The keyword 'out' may be used to specify a different array to hold the
-    result rather than the default 'a'. If the type of the array specified by
-    'out' differs from that of 'a', the result is cast to the new type,
-    otherwise the original type is kept. Floats round to floats by default.
+    result rather than the default new array. If the type of the array 
+    specified by 'out' differs from that of 'a', the result is cast to the 
+    new type, otherwise the original type is kept. Floats round to floats
+    by default.
 
     Numpy rounds to even. Thus 1.5 and 2.5 round to 2.0, -0.5 and 0.5 round to
     0.0, etc. Results may also be surprising due to the inexact representation
@@ -1107,31 +1129,28 @@
     is out of bounds, then the length of a is returned, i.e., the key would
     need to be appended. The returned index array has the same shape as v.
 
-    :Parameters:
+    Parameters
+    ----------
+    v : array or list type
+        Array of keys to be searched for in a.
+    side : string
+        Possible values are : 'left', 'right'. Default is 'left'. Return
+        the first or last index where the key could be inserted.
 
-        v : array or list type
-            Array of keys to be searched for in a.
+    Returns
+    -------
+    indices : integer array
+        The returned array has the same shape as v.
 
-        side : string
-            Possible values are : 'left', 'right'. Default is 'left'. Return
-            the first or last index where the key could be inserted.
-
-    :Returns:
-
-        indices : integer array
-            The returned array has the same shape as v.
-
-    :SeeAlso:
-
-        - sort
-        - histogram
-
-    :Notes:
+    SeeAlso
     -------
+    sort
+    histogram
 
-        The array a must be 1-d and is assumed to be sorted in ascending order.
-        Searchsorted uses binary search to find the required insertion points.
-
+    Notes
+    -----
+    The array a must be 1-d and is assumed to be sorted in ascending order.
+    Searchsorted uses binary search to find the required insertion points.
     """))
 
 
@@ -1154,34 +1173,28 @@
     Perform an inplace sort along the given axis using the algorithm specified
     by the kind keyword.
 
-    :Parameters:
+    Parameters
+    ----------
+    axis : integer
+        Axis to be sorted along. None indicates that the flattened array
+        should be used. Default is -1.
+    kind : string
+        Sorting algorithm to use. Possible values are 'quicksort',
+        'mergesort', or 'heapsort'. Default is 'quicksort'.
+    order : list type or None
+        When a is an array with fields defined, this argument specifies
+        which fields to compare first, second, etc.  Not all fields need be
+        specified.
 
-        axis : integer
-            Axis to be sorted along. None indicates that the flattened array
-            should be used. Default is -1.
+    SeeAlso
+    -------
+    argsort : indirect sort
+    lexsort : indirect stable sort on multiple keys
+    searchsorted : find keys in sorted array
 
-        kind : string
-            Sorting algorithm to use. Possible values are 'quicksort',
-            'mergesort', or 'heapsort'. Default is 'quicksort'.
+    Notes
+    -----
 
-        order : list type or None
-            When a is an array with fields defined, this argument specifies
-            which fields to compare first, second, etc.  Not all fields need be
-            specified.
-
-    :Returns:
-
-        None
-
-    :SeeAlso:
-
-      - argsort : indirect sort
-      - lexsort : indirect stable sort on multiple keys
-      - searchsorted : find keys in sorted array
-
-    :Notes:
-    ------
-
     The various sorts are characterized by average speed, worst case
     performance, need for work space, and whether they are stable. A stable
     sort keeps items with the same key in the same relative order. The three
@@ -1195,10 +1208,9 @@
     |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
     |------------------------------------------------------|
 
-    All the sort algorithms make temporary copies of the data when the sort is not
-    along the last axis. Consequently, sorts along the last axis are faster and use
-    less space than sorts along other axis.
-
+    All the sort algorithms make temporary copies of the data when the sort is 
+    not along the last axis. Consequently, sorts along the last axis are faster
+    and use less space than sorts along other axis.
     """))
 
 
@@ -1215,41 +1227,38 @@
     spread of a distribution. The standard deviation is computed for the
     flattened array by default, otherwise over the specified axis.
 
-    :Parameters:
+    Parameters
+    ----------
+    axis : integer
+        Axis along which the standard deviation is computed. The default is
+        to compute the standard deviation of the flattened array.
+    dtype : type
+        Type to use in computing the standard deviation. For arrays of
+        integer type the default is float32, for arrays of float types it
+        is the same as the array type.
+    out : ndarray
+        Alternative output array in which to place the result. It must have
+        the same shape as the expected output but the type will be cast if
+        necessary.
 
-        axis : integer
-            Axis along which the standard deviation is computed. The default is
-            to compute the standard deviation of the flattened array.
+    Returns
+    -------
+    standard deviation : The return type varies, see above.
+        A new array holding the result is returned unless out is specified,
+        in which case a reference to out is returned.
 
-        dtype : type
-            Type to use in computing the standard deviation. For arrays of
-            integer type the default is float32, for arrays of float types it
-            is the same as the array type.
+    SeeAlso
+    -------
+    var : variance
+    mean : average
 
-        out : ndarray
-            Alternative output array in which to place the result. It must have
-            the same shape as the expected output but the type will be cast if
-            necessary.
-
-    :Returns:
-
-        standard deviation : The return type varies, see above.
-            A new array holding the result is returned unless out is specified,
-            in which case a reference to out is returned.
-
-    :SeeAlso:
-
-        - var : variance
-        - mean : average
-
     Notes
     -----
+    The standard deviation is the square root of the average of the squared
+    deviations from the mean, i.e. var = sqrt(mean((x - x.mean())**2)).  The
+    computed standard deviation is biased, i.e., the mean is computed by
+    dividing by the number of elements, N, rather than by N-1.
 
-      The standard deviation is the square root of the average of the squared
-      deviations from the mean, i.e. var = sqrt(mean((x - x.mean())**2)).  The
-      computed standard deviation is biased, i.e., the mean is computed by
-      dividing by the number of elements, N, rather than by N-1.
-
     """))
 
 
@@ -1270,8 +1279,8 @@
 
     Warning: The arithmetic is modular and no error is raised on overflow.
 
-    Examples:
-
+    Examples
+    --------
     >>> array([0.5, 1.5]).sum()
     2.0
     >>> array([0.5, 1.5]).sum(dtype=int32)
@@ -1282,7 +1291,6 @@
     array([1, 5])
     >>> ones(128, dtype=int8).sum(dtype=int8) # overflow!
     -128
-
     """))
 
 
@@ -1304,13 +1312,15 @@
 add_newdoc('numpy.core.multiarray', 'ndarray', ('tofile',
     """a.tofile(fid, sep="", format="%s") -> None. Write the data to a file.
 
-    Required arguments:
-        file -- an open file object or a string containing a filename
+    Parameters
+    ----------
+    fid : file or string
+        an open file object or a string containing a filename
+    sep : string
+        separation for text output.  Write binary if this is empty.
+    format : string
+        format string for text file output
 
-    Keyword arguments:
-        sep -- separator for text output. Write binary if empty (default "")
-        format -- format string for text file output (default "%s")
-
     A convenience function for quick storage of array data. Information on
     endianess and precision is lost, so this method is not a good choice for
     files intended to archive data or transport data between machines with
@@ -1341,8 +1351,10 @@
 add_newdoc('numpy.core.multiarray', 'ndarray', ('tostring',
     """a.tostring(order='C') -> raw copy of array data as a Python string.
 
-    Keyword arguments:
-        order -- order of the data item in the copy {"C","F","A"} (default "C")
+    Parameters
+    ----------
+    order : {'C', 'F', 'A', None}
+        order of the data item in the copy
 
     Construct a Python string containing the raw bytes in the array. The order
     of the data in arrays with ndim > 1 is specified by the 'order' keyword and
@@ -1373,7 +1385,8 @@
     array, this is the usual matrix transpose. If axes are given,
     they describe how the axes are permuted.
 
-    Example:
+    Examples
+    --------
     >>> a = array([[1,2],[3,4]])
     >>> a
     array([[1, 2],
@@ -1398,41 +1411,38 @@
     distribution.  The variance is computed for the flattened array by default,
     otherwise over the specified axis.
 
-    :Parameters:
+    Parameters
+    ----------
+    axis : integer
+        Axis along which the variance is computed. The default is to
+        compute the variance of the flattened array.
+    dtype : data-type
+        Type to use in computing the variance. For arrays of integer type
+        the default is float32, for arrays of float types it is the same as
+        the array type.
+    out : ndarray
+        Alternative output array in which to place the result. It must have
+        the same shape as the expected output but the type will be cast if
+        necessary.
 
-        axis : integer
-            Axis along which the variance is computed. The default is to
-            compute the variance of the flattened array.
+    Returns
+    -------
+    variance : The return type varies, see above.
+        A new array holding the result is returned unless out is specified,
+        in which case a reference to out is returned.
 
-        dtype : type
-            Type to use in computing the variance. For arrays of integer type
-            the default is float32, for arrays of float types it is the same as
-            the array type.
+    SeeAlso
+    -------
+    std : standard deviation
+    mean: average
 
-        out : ndarray
-            Alternative output array in which to place the result. It must have
-            the same shape as the expected output but the type will be cast if
-            necessary.
-
-    :Returns:
-
-        variance : The return type varies, see above.
-            A new array holding the result is returned unless out is specified,
-            in which case a reference to out is returned.
-
-    :SeeAlso:
-
-        - std : standard deviation
-        - mean: average
-
     Notes
     -----
+    The variance is the average of the squared deviations from the mean, i.e.
+    var = mean((x - x.mean())**2).  The computed variance is biased, i.e.,
+    the mean is computed by dividing by the number of elements, N, rather
+    than by N-1.
 
-      The variance is the average of the squared deviations from the mean, i.e.
-      var = mean((x - x.mean())**2).  The computed variance is biased, i.e.,
-      the mean is computed by dividing by the number of elements, N, rather
-      than by N-1.
-
     """))
 
 
@@ -1442,3 +1452,31 @@
     Type can be either a new sub-type object or a data-descriptor object
 
     """))
+
+add_newdoc('numpy.core.umath','geterrobj',
+           """geterrobj()
+
+           Used internally by `geterr`.
+
+           Returns
+           -------
+           errobj : list
+               Internal numpy buffer size, error mask, error callback function.
+
+           """)
+
+add_newdoc('numpy.core.umath','seterrobj',
+           """seterrobj()
+
+           Used internally by `seterr`.
+
+           Parameters
+           ----------
+           errobj : list
+               [buffer_size, error_mask, callback_func]
+
+           See Also
+           --------
+           seterrcall
+
+           """)

Modified: branches/maskedarray/numpy/core/code_generators/generate_umath.py
===================================================================
--- branches/maskedarray/numpy/core/code_generators/generate_umath.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/code_generators/generate_umath.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -5,6 +5,16 @@
 None_ = "PyUFunc_None"
 
 class TypeDescription(object):
+    """Type signature for a ufunc
+
+    Attributes
+    ----------
+
+    type: character representing the type
+    func_data:
+    in_:
+    out:
+    """
     def __init__(self, type, f=None, in_=None, out=None):
         self.type = type
         self.func_data = f
@@ -55,6 +65,17 @@
     return tds
 
 class Ufunc(object):
+    """Description of a ufunc.
+
+    Attributes
+    ----------
+
+    nin: number of input arguments
+    nout: number of output arguments
+    identity: identity element for a two-argument function
+    docstring: docstring for the ufunc
+    type_descriptions: list of TypeDescription objects
+    """
     def __init__(self, nin, nout, identity, docstring,
                  *type_descriptions):
         self.nin = nin
@@ -69,7 +90,7 @@
         for td in self.type_descriptions:
             td.finish_signature(self.nin, self.nout)
 
-#each entry in defdict is
+#each entry in defdict is a Ufunc object.
 
 #name: [string of chars for which it is defined,
 #       string of characters using func interface,
@@ -304,6 +325,16 @@
           TD(ints),
           TD(O, f='PyNumber_Rshift'),
           ),
+'degrees' :
+    Ufunc(1, 1, None,
+          'converts angle from radians to degrees',
+          TD(fltsM, f='degrees'),
+          ),
+'radians' :
+    Ufunc(1, 1, None,
+          'converts angle from degrees to radians',
+          TD(fltsM, f='radians'),
+          ),
 'arccos' :
     Ufunc(1, 1, None,
           'inverse cosine elementwise.',

Modified: branches/maskedarray/numpy/core/code_generators/multiarray_api_order.txt
===================================================================
--- branches/maskedarray/numpy/core/code_generators/multiarray_api_order.txt	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/code_generators/multiarray_api_order.txt	2008-01-18 23:25:32 UTC (rev 4730)
@@ -81,3 +81,4 @@
 PyArray_DescrAlignConverter
 PyArray_DescrAlignConverter2
 PyArray_SearchsideConverter
+PyArray_CheckAxis

Modified: branches/maskedarray/numpy/core/defmatrix.py
===================================================================
--- branches/maskedarray/numpy/core/defmatrix.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/defmatrix.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -49,6 +49,34 @@
 
 
 class matrix(N.ndarray):
+    """mat = matrix(data, dtype=None, copy=True)
+
+    Returns a matrix from an array-like object, or a string of 
+    data.  A matrix is a specialized 2-d array that retains
+    it's 2-d nature through operations and where '*' means matrix
+    multiplication and '**' means matrix power. 
+
+    Parameters
+    ----------
+    data : array-like or string
+       If data is a string, then interpret the string as a matrix 
+         with commas or spaces separating columns and semicolons 
+         separating rows.
+       If data is array-like than convert the array to a matrix.
+    dtype : data-type
+       Anything that can be interpreted as a NumPy datatype.
+    copy : bool
+       If data is already an ndarray, then this flag determines whether
+       or not the data will be copied
+
+    Examples
+    --------
+    >>> import numpy as np
+    >>> a = np.matrix('1 2; 3 4')
+    >>> print a
+    [[1 2]
+     [3 4]]
+    """
     __array_priority__ = 10.0
     def __new__(subtype, data, dtype=None, copy=True):
         if isinstance(data, matrix):
@@ -244,39 +272,37 @@
         Returns the average of the array elements.  The average is taken over
         the flattened array by default, otherwise over the specified axis.
 
-        :Parameters:
+        Parameters
+        ----------        
+        axis : integer
+            Axis along which the means are computed. The default is
+            to compute the standard deviation of the flattened array.
 
-            axis : integer
-                Axis along which the means are computed. The default is
-                to compute the standard deviation of the flattened array.
+        dtype : type
+            Type to use in computing the means. For arrays of integer type
+            the default is float32, for arrays of float types it is the
+            same as the array type.
 
-            dtype : type
-                Type to use in computing the means. For arrays of integer type
-                the default is float32, for arrays of float types it is the
-                same as the array type.
+        out : ndarray
+            Alternative output array in which to place the result. It must
+            have the same shape as the expected output but the type will be
+            cast if necessary.
 
-            out : ndarray
-                Alternative output array in which to place the result. It must
-                have the same shape as the expected output but the type will be
-                cast if necessary.
+        Returns
+        -------        
+        mean : The return type varies, see above.
+            A new array holding the result is returned unless out is
+            specified, in which case a reference to out is returned.
 
-        :Returns:
+        SeeAlso
+        -------
+        var : variance
+        std : standard deviation
 
-            mean : The return type varies, see above.
-                A new array holding the result is returned unless out is
-                specified, in which case a reference to out is returned.
-
-        :SeeAlso:
-
-            - var : variance
-            - std : standard deviation
-
         Notes
         -----
-
-            The mean is the sum of the elements along the axis divided by the
-            number of elements.
-
+        The mean is the sum of the elements along the axis divided by the
+        number of elements.
         """
         return N.ndarray.mean(self, axis, out)._align(axis)
 
@@ -287,43 +313,41 @@
         spread of a distribution. The standard deviation is computed for the
         flattened array by default, otherwise over the specified axis.
 
-        :Parameters:
+        Parameters
+        ----------
+        axis : integer
+            Axis along which the standard deviation is computed. The
+            default is to compute the standard deviation of the flattened
+            array.
 
-            axis : integer
-                Axis along which the standard deviation is computed. The
-                default is to compute the standard deviation of the flattened
-                array.
+        dtype : type
+            Type to use in computing the standard deviation. For arrays of
+            integer type the default is float32, for arrays of float types
+            it is the same as the array type.
 
-            dtype : type
-                Type to use in computing the standard deviation. For arrays of
-                integer type the default is float32, for arrays of float types
-                it is the same as the array type.
+        out : ndarray
+            Alternative output array in which to place the result. It must
+            have the same shape as the expected output but the type will be
+            cast if necessary.
 
-            out : ndarray
-                Alternative output array in which to place the result. It must
-                have the same shape as the expected output but the type will be
-                cast if necessary.
+        Returns
+        -------
+        standard deviation : The return type varies, see above.
+            A new array holding the result is returned unless out is
+            specified, in which case a reference to out is returned.
 
-        :Returns:
+        SeeAlso
+        -------
+        var : variance
+        mean : average
 
-            standard deviation : The return type varies, see above.
-                A new array holding the result is returned unless out is
-                specified, in which case a reference to out is returned.
-
-        :SeeAlso:
-
-            - var : variance
-            - mean : average
-
         Notes
-        -----
-
-          The standard deviation is the square root of the average of the
-          squared deviations from the mean, i.e. var = sqrt(mean((x -
-          x.mean())**2)).  The computed standard deviation is biased, i.e., the
-          mean is computed by dividing by the number of elements, N, rather
-          than by N-1.
-
+        ----- 
+        The standard deviation is the square root of the
+        average of the squared deviations from the mean, i.e. var =
+        sqrt(mean((x - x.mean())**2)).  The computed standard
+        deviation is biased, i.e., the mean is computed by dividing by
+        the number of elements, N, rather than by N-1.
         """
         return N.ndarray.std(self, axis, dtype, out)._align(axis)
 
@@ -334,41 +358,38 @@
         a distribution.  The variance is computed for the flattened array by
         default, otherwise over the specified axis.
 
-        :Parameters:
+        Parameters
+        ----------
+        axis : integer
+            Axis along which the variance is computed. The default is to
+            compute the variance of the flattened array.            
+        dtype : data-type
+            Type to use in computing the variance. For arrays of integer
+            type the default is float32, for arrays of float types it is
+            the same as the array type.
+        out : ndarray
+            Alternative output array in which to place the result. It must
+            have the same shape as the expected output but the type will be
+            cast if necessary.
 
-            axis : integer
-                Axis along which the variance is computed. The default is to
-                compute the variance of the flattened array.
+        Returns
+        -------
+        variance : depends, see above
+            A new array holding the result is returned unless out is
+            specified, in which case a reference to out is returned.
 
-            dtype : type
-                Type to use in computing the variance. For arrays of integer
-                type the default is float32, for arrays of float types it is
-                the same as the array type.
+        SeeAlso
+        -------
+        std : standard deviation
+        mean : average
 
-            out : ndarray
-                Alternative output array in which to place the result. It must
-                have the same shape as the expected output but the type will be
-                cast if necessary.
-
-        :Returns:
-
-            variance : depends, see above
-                A new array holding the result is returned unless out is
-                specified, in which case a reference to out is returned.
-
-        :SeeAlso:
-
-            - std : standard deviation
-            - mean : average
-
         Notes
         -----
 
-          The variance is the average of the squared deviations from the mean,
-          i.e.  var = mean((x - x.mean())**2).  The computed variance is
-          biased, i.e., the mean is computed by dividing by the number of
-          elements, N, rather than by N-1.
-
+        The variance is the average of the squared deviations from the
+        mean, i.e.  var = mean((x - x.mean())**2).  The computed
+        variance is biased, i.e., the mean is computed by dividing by
+        the number of elements, N, rather than by N-1.
         """
         return N.ndarray.var(self, axis, dtype, out)._align(axis)
 
@@ -458,14 +479,16 @@
 def bmat(obj, ldict=None, gdict=None):
     """Build a matrix object from string, nested sequence, or array.
 
-    Ex:  F = bmat('A, B; C, D')
-         F = bmat([[A,B],[C,D]])
-         F = bmat(r_[c_[A,B],c_[C,D]])
+    Example
+    --------
+    F = bmat('A, B; C, D')
+    F = bmat([[A,B],[C,D]])
+    F = bmat(r_[c_[A,B],c_[C,D]])
 
-        all produce the same Matrix Object    [ A  B ]
-                                              [ C  D ]
+    all produce the same Matrix Object    [ A  B ]
+                                          [ C  D ]
 
-        if A, B, C, and D are appropriately shaped 2-d arrays.
+    if A, B, C, and D are appropriately shaped 2-d arrays.
     """
     if isinstance(obj, str):
         if gdict is None:

Modified: branches/maskedarray/numpy/core/numeric.py
===================================================================
--- branches/maskedarray/numpy/core/numeric.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/numeric.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -40,10 +40,11 @@
 
 # from Fernando Perez's IPython
 def zeros_like(a):
-    """Return an array of zeros of the shape and typecode of a.
+    """Return an array of zeros of the shape and data-type of a.
 
     If you don't explicitly need the array to be zeroed, you should instead
-    use empty_like(), which is faster as it only allocates memory."""
+    use empty_like(), which is faster as it only allocates memory.
+    """
     try:
         return zeros(a.shape, a.dtype, a.flags.fnc)
     except AttributeError:
@@ -58,7 +59,7 @@
         return res
 
 def empty_like(a):
-    """Return an empty (uninitialized) array of the shape and typecode of a.
+    """Return an empty (uninitialized) array of the shape and data-type of a.
 
     Note that this does NOT initialize the returned array.  If you require
     your array to be initialized, you should use zeros_like().
@@ -147,6 +148,29 @@
     return array(a, dtype, copy=False, order='F', ndmin=1)
 
 def require(a, dtype=None, requirements=None):
+    """Return an ndarray of the provided type that satisfies requirements.
+    
+    This function is useful to be sure that an array with the correct flags
+    is returned for passing to compiled code (perhaps through ctypes).
+
+    Parameters
+    ----------
+     a : array-like
+       The object to be converted to a type-and-requirement satisfying array
+     dtype : data-type
+       The required data-type (None is the default data-type -- float64)
+     requirements : list of strings
+       The requirements list can be any of the 
+       'ENSUREARRAY' ('E')  - ensure that  a base-class ndarray
+       'F_CONTIGUOUS' ('F') - ensure a Fortran-contiguous array
+       'C_CONTIGUOUS' ('C') - ensure a C-contiguous array
+       'ALIGNED' ('A')      - ensure a data-type aligned array
+       'WRITEABLE' ('W')    - ensure a writeable array
+       'OWNDATA' ('O')      - ensure an array that owns its own data
+
+       The returned array will be guaranteed to have the listed requirements
+       by making a copy if needed. 
+    """
     if requirements is None:
         requirements = []
     else:
@@ -252,11 +276,13 @@
 try:
     # importing this changes the dot function for basic 4 types
     # to blas-optimized versions.
-    from _dotblas import dot, vdot, inner, alterdot, restoredot
+    from _dotblas import dot, vdot, inner, alterdot, restoredot    
 except ImportError:
     def alterdot():
+        "Does Nothing"
         pass
     def restoredot():
+        "Does Nothing"
         pass
 
 
@@ -641,7 +667,7 @@
     fname can be a filename or a file handle.  Support for gzipped files is
     automatic, if the filename ends in .gz
 
-    See scipy.loadmat to read and write matfiles.
+    See scipy.io.loadmat to read and write matfiles.
 
     Example usage:
 
@@ -847,6 +873,9 @@
     return all(less_equal(absolute(x-y), atol + rtol * absolute(y)))
 
 def array_equal(a1, a2):
+    """Returns True if a1 and a2 have identical shapes
+    and all elements equal and False otherwise.
+    """
     try:
         a1, a2 = asarray(a1), asarray(a2)
     except:
@@ -856,6 +885,10 @@
     return logical_and.reduce(equal(a1,a2).ravel())
 
 def array_equiv(a1, a2):
+    """Returns True if a1 and a2 are shape consistent
+    (mutually broadcastable) and have all elements equal and False
+    otherwise.
+    """
     try:
         a1, a2 = asarray(a1), asarray(a2)
     except:

Modified: branches/maskedarray/numpy/core/records.py
===================================================================
--- branches/maskedarray/numpy/core/records.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/records.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -43,10 +43,40 @@
     return dup
 
 class format_parser:
+    """Class to convert formats, names, titles description to a dtype
+
+    After constructing the format_parser object, the dtype attribute is 
+      the converted data-type.
+    
+    dtype = format_parser(formats, names, titles).dtype
+
+    Parameters
+    ----------
+    formats : string or list
+        comma-separated format descriptions --- 'f8, i4, a5'
+        list of format description strings --- ['f8', 'i4', 'a5']
+    names : string or (list or tuple of strings)
+        comma-separated field names --- 'col1, col2, col3'
+        list or tuple of field names
+    titles : sequence
+        sequence of title strings or unicode        
+    aligned : bool
+        align the fields by padding as the C-compiler would
+    byteorder : 
+        If specified, all the fields will be changed to the 
+        provided byteorder.  Otherwise, the default byteorder is
+        used.
+
+    Returns
+    -------
+    object
+        A Python object whose dtype attribute is a data-type. 
+    """
     def __init__(self, formats, names, titles, aligned=False, byteorder=None):
         self._parseFormats(formats, aligned)
         self._setfieldnames(names, titles)
         self._createdescr(byteorder)
+        self.dtype = self._descr
 
     def _parseFormats(self, formats, aligned=0):
         """ Parse the field formats """
@@ -115,6 +145,8 @@
         self._descr = descr
 
 class record(nt.void):
+    """A data-type scalar that allows field access as attribute lookup.
+    """
     def __repr__(self):
         return self.__str__()
 
@@ -182,6 +214,29 @@
 #  the fields (and any subfields)
 
 class recarray(ndarray):
+    """recarray(shape, dtype=None, buf=None, **kwds)
+
+    Subclass of ndarray that allows field access using attribute lookup.
+
+    Parameters
+    ----------
+    shape : tuple
+        shape of record array
+    dtype : data-type or None
+        The desired data-type.  If this is None, then the data-type is determined
+        by the *formats*, *names*, *titles*, *aligned*, and *byteorder* keywords.
+    buf : [buffer] or None
+        If this is None, then a new array is created of the given shape and data-type
+        If this is an object exposing the buffer interface, then the array will 
+        use the memory from an existing buffer.  In this case, the *offset* and 
+        *strides* keywords can also be used. 
+
+    See Also
+    --------
+    format_parser : determine a data-type from formats, names, titles
+    record : fundamental data-type for recarray
+
+    """
     def __new__(subtype, shape, dtype=None, buf=None, offset=0, strides=None,
                 formats=None, names=None, titles=None,
                 byteorder=None, aligned=False):

Modified: branches/maskedarray/numpy/core/src/arrayobject.c
===================================================================
--- branches/maskedarray/numpy/core/src/arrayobject.c	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/src/arrayobject.c	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1691,6 +1691,12 @@
     return 0;
 }
 
+
+/* XXX: FIXME --- add ordering argument to 
+   Allow Fortran ordering on write
+   This will need the addition of a Fortran-order iterator.
+ */
+
 /*OBJECT_API
   To File
 */
@@ -3139,16 +3145,7 @@
 static Py_ssize_t
 array_getcharbuf(PyArrayObject *self, Py_ssize_t segment, constchar **ptrptr)
 {
-    if (self->descr->type_num == PyArray_STRING || \
-        self->descr->type_num == PyArray_UNICODE || \
-        self->descr->elsize == 1)
-        return array_getreadbuf(self, segment, (void **) ptrptr);
-    else {
-        PyErr_SetString(PyExc_TypeError,
-                        "non-character (or 8-bit) array cannot be "\
-                        "interpreted as character buffer");
-        return -1;
-    }
+    return array_getreadbuf(self, segment, (void **) ptrptr);
 }
 
 static PyBufferProcs array_as_buffer = {
@@ -4835,8 +4832,12 @@
     return result;
 }
 
+
+/*MULTIARRAY_API
+  PyArray_CheckAxis
+*/
 static PyObject *
-_check_axis(PyArrayObject *arr, int *axis, int flags)
+PyArray_CheckAxis(PyArrayObject *arr, int *axis, int flags)
 {
     PyObject *temp1, *temp2;
     int n = arr->nd;
@@ -4878,6 +4879,8 @@
     return temp2;
 }
 
+#define _check_axis PyArray_CheckAxis
+
 #include "arraymethods.c"
 
 /* Lifted from numarray */

Modified: branches/maskedarray/numpy/core/src/arraytypes.inc.src
===================================================================
--- branches/maskedarray/numpy/core/src/arraytypes.inc.src	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/src/arraytypes.inc.src	2008-01-18 23:25:32 UTC (rev 4730)
@@ -2059,7 +2059,7 @@
 @name at _fastclip(@type@ *in, intp ni, @type@ *min, @type@ *max, @type@ *out)
 {
         register npy_intp i;
-        @type@ max_val, min_val;
+        @type@ max_val = 0, min_val = 0;
 
 	if (max != NULL)
 		max_val = *max;

Modified: branches/maskedarray/numpy/core/src/multiarraymodule.c
===================================================================
--- branches/maskedarray/numpy/core/src/multiarraymodule.c	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/src/multiarraymodule.c	2008-01-18 23:25:32 UTC (rev 4730)
@@ -2231,7 +2231,6 @@
     return NULL;
 }
 
-
 /*MULTIARRAY_API
  */
 static PyObject *

Modified: branches/maskedarray/numpy/core/src/scalartypes.inc.src
===================================================================
--- branches/maskedarray/numpy/core/src/scalartypes.inc.src	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/src/scalartypes.inc.src	2008-01-18 23:25:32 UTC (rev 4730)
@@ -547,14 +547,19 @@
         Py_DECREF(arr);
         return ret;
 }
+/**begin repeat
 
+#name=float, double, longdouble#
+#NAME=FLOAT, DOUBLE, LONGDOUBLE#
+#PREFIX=NPY_,NPY_,#
+*/
 static void
-format_longdouble(char *buf, size_t buflen, longdouble val,
+format_ at name@(char *buf, size_t buflen, @name@ val,
                   unsigned int precision)
 {
         char *cp;
 
-        PyOS_snprintf(buf, buflen, "%.*" LONGDOUBLE_FMT, precision, val);
+        PyOS_snprintf(buf, buflen, "%.*" @PREFIX@@NAME at _FMT, precision, val);
         cp = buf;
         if (*cp == '-')
                 cp++;
@@ -568,6 +573,7 @@
                 *cp++ = '\0';
         }
 }
+/**end repeat**/
 
 /* over-ride repr and str of array-scalar strings and unicode to
    remove NULL bytes and then call the corresponding functions
@@ -602,43 +608,58 @@
 }
 /**end repeat**/
 
+/* These values are finfo.precision + 2 */
+#define FLOATPREC_REPR 8
+#define DOUBLEPREC_REPR 17
 
-
 #if SIZEOF_LONGDOUBLE == SIZEOF_DOUBLE
-#define PREC_REPR 17
-#define PREC_STR 17
-#else
-#define PREC_REPR 21
-#define PREC_STR 21
+#define LONGDOUBLEPREC_REPR DOUBLEPREC_REPR
+#define LONGDOUBLEPREC_STR DOUBLEPREC_REPR
+#else /* More than probably needed on Intel FP */
+#define LONGDOUBLEPREC_REPR 22
+#define LONGDOUBLEPREC_STR 22
 #endif
 
+/* floattype_repr */
+/**begin repeat
+
+#name=float, double, longdouble#
+#Name=Float, Double, LongDouble#
+#NAME=FLOAT, DOUBLE, LONGDOUBLE#
+*/
 static PyObject *
-longdoubletype_repr(PyObject *self)
+ at name@type_repr(PyObject *self)
 {
         static char buf[100];
-        format_longdouble(buf, sizeof(buf),
-                          ((PyLongDoubleScalarObject *)self)->obval, PREC_REPR);
+        format_ at name@(buf, sizeof(buf),
+                          ((Py at Name@ScalarObject *)self)->obval, @NAME at PREC_REPR);
         return PyString_FromString(buf);
 }
 
 static PyObject *
-clongdoubletype_repr(PyObject *self)
+c at name@type_repr(PyObject *self)
 {
         static char buf1[100];
         static char buf2[100];
         static char buf3[202];
-        clongdouble x;
-        x = ((PyCLongDoubleScalarObject *)self)->obval;
-        format_longdouble(buf1, sizeof(buf1), x.real, PREC_REPR);
-        format_longdouble(buf2, sizeof(buf2), x.imag, PREC_REPR);
+        c at name@ x;
+        x = ((PyC at Name@ScalarObject *)self)->obval;
+        format_ at name@(buf1, sizeof(buf1), x.real, @NAME at PREC_REPR);
+        format_ at name@(buf2, sizeof(buf2), x.imag, @NAME at PREC_REPR);
 
         snprintf(buf3, sizeof(buf3), "(%s+%sj)", buf1, buf2);
         return PyString_FromString(buf3);
 }
+/**end repeat**/
 
-#define longdoubletype_str longdoubletype_repr
-#define clongdoubletype_str clongdoubletype_repr
+/**begin repeat
 
+#name=float, double, longdouble#
+*/
+#define @name at type_str @name at type_repr
+#define c at name@type_str c at name@type_repr
+/**end repeat**/
+
 /** Could improve this with a PyLong_FromLongDouble(longdouble ldval)
     but this would need some more work...
 **/
@@ -842,6 +863,7 @@
         arr = (PyArrayObject *)PyArray_FromScalar(self, NULL);
         if (arr == NULL) return NULL;
         inter = PyObject_GetAttrString((PyObject *)arr, "__array_interface__");
+	if (inter != NULL) PyDict_SetItemString(inter, "__ref", (PyObject *)arr);
         Py_DECREF(arr);
         return inter;
 }
@@ -2537,6 +2559,16 @@
         PyLongLongArrType_Type.tp_hash = longlong_arrtype_hash;
 #endif
 
+        /**begin repeat
+#name=repr, str#
+        */
+        PyFloatArrType_Type.tp_ at name@ = floattype_ at name@;
+        PyCFloatArrType_Type.tp_ at name@ = cfloattype_ at name@;
+
+        PyDoubleArrType_Type.tp_ at name@ = doubletype_ at name@;
+        PyCDoubleArrType_Type.tp_ at name@  = cdoubletype_ at name@;
+        /**end repeat**/
+
         /* These need to be coded specially because getitem does not
            return a normal Python type
         */

Modified: branches/maskedarray/numpy/core/src/umathmodule.c.src
===================================================================
--- branches/maskedarray/numpy/core/src/umathmodule.c.src	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/src/umathmodule.c.src	2008-01-18 23:25:32 UTC (rev 4730)
@@ -413,7 +413,26 @@
 #define isfinitef(x) (!(isinff((x)) || isnanf((x))))
 #define isfinitel(x) (!(isinfl((x)) || isnanl((x))))
 
+float degreesf(float x) {
+    return x * (float)(180.0/M_PI);
+}
+double degrees(double x) {
+    return x * (180.0/M_PI);
+}
+longdouble degreesl(longdouble x) {
+    return x * (180.0L/M_PI);
+}
 
+float radiansf(float x) {
+    return x * (float)(M_PI/180.0);
+}
+double radians(double x) {
+    return x * (M_PI/180.0);
+}
+longdouble radiansl(longdouble x) {
+    return x * (M_PI/180.0L);
+}
+
 /* First, the C functions that do the real work */
 
 /* if C99 extensions not available then define dummy functions that use the

Modified: branches/maskedarray/numpy/core/tests/test_multiarray.py
===================================================================
--- branches/maskedarray/numpy/core/tests/test_multiarray.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/tests/test_multiarray.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,10 +1,9 @@
+import tempfile
+
+import numpy as np
 from numpy.testing import *
 from numpy.core import *
-from numpy import random
-import numpy as N
 
-import tempfile
-
 class TestFlags(NumpyTestCase):
     def setUp(self):
         self.a = arange(10)
@@ -357,7 +356,7 @@
 
 class TestArgmax(NumpyTestCase):
     def check_all(self):
-        a = random.normal(0,1,(4,5,6,7,8))
+        a = np.random.normal(0,1,(4,5,6,7,8))
         for i in xrange(a.ndim):
             amax = a.max(i)
             aargmax = a.argmax(i)
@@ -373,8 +372,8 @@
 
 class TestClip(NumpyTestCase):
     def _check_range(self,x,cmin,cmax):
-        assert N.all(x >= cmin)
-        assert N.all(x <= cmax)
+        assert np.all(x >= cmin)
+        assert np.all(x <= cmax)
 
     def _clip_type(self,type_group,array_max,
                    clip_min,clip_max,inplace=False,
@@ -384,16 +383,16 @@
         if expected_max is None:
             expected_max = clip_max
 
-        for T in N.sctypes[type_group]:
+        for T in np.sctypes[type_group]:
             if sys.byteorder == 'little':
                 byte_orders = ['=','>']
             else:
                 byte_orders = ['<','=']
 
             for byteorder in byte_orders:
-                dtype = N.dtype(T).newbyteorder(byteorder)
+                dtype = np.dtype(T).newbyteorder(byteorder)
 
-                x = (N.random.random(1000) * array_max).astype(dtype)
+                x = (np.random.random(1000) * array_max).astype(dtype)
                 if inplace:
                     x.clip(clip_min,clip_max,x)
                 else:
@@ -417,46 +416,46 @@
             x = self._clip_type('uint',1024,0,0, inplace=inplace)
 
     def check_record_array(self):
-        rec = N.array([(-5, 2.0, 3.0), (5.0, 4.0, 3.0)],
+        rec = np.array([(-5, 2.0, 3.0), (5.0, 4.0, 3.0)],
                       dtype=[('x', '<f8'), ('y', '<f8'), ('z', '<f8')])
         y = rec['x'].clip(-0.3,0.5)
         self._check_range(y,-0.3,0.5)
 
     def check_max_or_min(self):
-        val = N.array([0,1,2,3,4,5,6,7])
+        val = np.array([0,1,2,3,4,5,6,7])
         x = val.clip(3)
-        assert N.all(x >= 3)
+        assert np.all(x >= 3)
         x = val.clip(min=3)
-        assert N.all(x >= 3)
+        assert np.all(x >= 3)
         x = val.clip(max=4)
-        assert N.all(x <= 4)
+        assert np.all(x <= 4)
 
 class TestPutmask(ParametricTestCase):
     def tst_basic(self,x,T,mask,val):
-        N.putmask(x,mask,val)
-        assert N.all(x[mask] == T(val))
+        np.putmask(x,mask,val)
+        assert np.all(x[mask] == T(val))
         assert x.dtype == T
 
     def testip_types(self):
-        unchecked_types = [str,unicode,N.void,object]
+        unchecked_types = [str, unicode, np.void, object]
 
-        x = N.random.random(1000)*100
+        x = np.random.random(1000)*100
         mask = x < 40
 
         tests = []
         for val in [-100,0,15]:
-            for types in N.sctypes.itervalues():
+            for types in np.sctypes.itervalues():
                 tests.extend([(self.tst_basic,x.copy().astype(T),T,mask,val)
                               for T in types if T not in unchecked_types])
         return tests
 
     def test_mask_size(self):
-        self.failUnlessRaises(ValueError,N.putmask,
-                              N.array([1,2,3]),[True],5)
+        self.failUnlessRaises(ValueError, np.putmask,
+                              np.array([1,2,3]), [True], 5)
 
     def tst_byteorder(self,dtype):
-        x = N.array([1,2,3],dtype)
-        N.putmask(x,[True,False,True],-1)
+        x = np.array([1,2,3],dtype)
+        np.putmask(x,[True,False,True],-1)
         assert_array_equal(x,[-1,2,-1])
 
     def testip_byteorder(self):
@@ -464,46 +463,54 @@
 
     def test_record_array(self):
         # Note mixed byteorder.
-        rec = N.array([(-5, 2.0, 3.0), (5.0, 4.0, 3.0)],
+        rec = np.array([(-5, 2.0, 3.0), (5.0, 4.0, 3.0)],
                       dtype=[('x', '<f8'), ('y', '>f8'), ('z', '<f8')])
-        N.putmask(rec['x'],[True,False],10)
+        np.putmask(rec['x'],[True,False],10)
         assert_array_equal(rec['x'],[10,5])
-        N.putmask(rec['y'],[True,False],10)
+        np.putmask(rec['y'],[True,False],10)
         assert_array_equal(rec['y'],[10,4])
 
     def test_masked_array(self):
-        ## x = N.array([1,2,3])
-        ## z = N.ma.array(x,mask=[True,False,False])
-        ## N.putmask(z,[True,True,True],3)
+        ## x = np.array([1,2,3])
+        ## z = np.ma.array(x,mask=[True,False,False])
+        ## np.putmask(z,[True,True,True],3)
         pass
 
 class TestLexsort(NumpyTestCase):
     def test_basic(self):
         a = [1,2,1,3,1,5]
         b = [0,4,5,6,2,3]
-        idx = N.lexsort((b,a))
-        expected_idx = N.array([0,4,2,1,3,5])
+        idx = np.lexsort((b,a))
+        expected_idx = np.array([0,4,2,1,3,5])
         assert_array_equal(idx,expected_idx)
 
-        x = N.vstack((b,a))
-        idx = N.lexsort(x)
+        x = np.vstack((b,a))
+        idx = np.lexsort(x)
         assert_array_equal(idx,expected_idx)
 
-        assert_array_equal(x[1][idx],N.sort(x[1]))
+        assert_array_equal(x[1][idx],np.sort(x[1]))
 
 class TestFromToFile(NumpyTestCase):
     def setUp(self):
         shape = (4,7)
-        rand = N.random.random
+        rand = np.random.random
 
-        self.x = rand(shape) + rand(shape).astype(N.complex)*1j
-        self.dtype = N.complex
+        self.x = rand(shape) + rand(shape).astype(np.complex)*1j
+        self.dtype = np.complex
 
     def test_file(self):
-        f = tempfile.TemporaryFile()
+        # Python under Windows does not believe that TemporaryFile
+        # is an open file
+        if sys.platform.startswith('win'):
+            filename = tempfile.mktemp()
+            f = open(filename,'wb')
+        else:
+            f = tempfile.TemporaryFile()
+
         self.x.tofile(f)
+        f.flush()
         f.seek(0)
-        y = N.fromfile(f,dtype=self.dtype)
+        y = np.fromfile(f,dtype=self.dtype)
         assert_array_equal(y,self.x.flat)
 
     def test_filename(self):
@@ -511,32 +518,32 @@
         f = open(filename,'wb')
         self.x.tofile(f)
         f.close()
-        y = N.fromfile(filename,dtype=self.dtype)
+        y = np.fromfile(filename,dtype=self.dtype)
         assert_array_equal(y,self.x.flat)
 
 class TestFromBuffer(ParametricTestCase):
     def tst_basic(self,buffer,expected,kwargs):
-        assert_array_equal(N.frombuffer(buffer,**kwargs),expected)
+        assert_array_equal(np.frombuffer(buffer,**kwargs),expected)
 
     def testip_basic(self):
         tests = []
         for byteorder in ['<','>']:
-            for dtype in [float,int,N.complex]:
-                dt = N.dtype(dtype).newbyteorder(byteorder)
-                x = (N.random.random((4,7))*5).astype(dt)
+            for dtype in [float,int,np.complex]:
+                dt = np.dtype(dtype).newbyteorder(byteorder)
+                x = (np.random.random((4,7))*5).astype(dt)
                 buf = x.tostring()
                 tests.append((self.tst_basic,buf,x.flat,{'dtype':dt}))
         return tests
 
 class TestResize(NumpyTestCase):
     def test_basic(self):
-        x = N.eye(3)
+        x = np.eye(3)
         x.resize((5,5))
-        assert_array_equal(x.flat[:9],N.eye(3).flat)
+        assert_array_equal(x.flat[:9],np.eye(3).flat)
         assert_array_equal(x[9:].flat,0)
 
     def test_check_reference(self):
-        x = N.eye(3)
+        x = np.eye(3)
         y = x
         self.failUnlessRaises(ValueError,x.resize,(5,1))
 

Modified: branches/maskedarray/numpy/core/tests/test_regression.py
===================================================================
--- branches/maskedarray/numpy/core/tests/test_regression.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/tests/test_regression.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -4,14 +4,14 @@
 import sys
 
 set_local_path()
-import numpy as N
+import numpy as np
 restore_path()
 
 rlevel = 1
 
 def assert_valid_refcount(op):
-    a = N.arange(100 * 100)
-    b = N.arange(100*100).reshape(100, 100)
+    a = np.arange(100 * 100)
+    b = np.arange(100*100).reshape(100, 100)
     c = b
 
     i = 1
@@ -26,15 +26,15 @@
     def check_invalid_round(self,level=rlevel):
         """Ticket #3"""
         v = 4.7599999999999998
-        assert_array_equal(N.array([v]),N.array(v))
+        assert_array_equal(np.array([v]),np.array(v))
 
     def check_mem_empty(self,level=rlevel):
         """Ticket #7"""
-        N.empty((1,),dtype=[('x',N.int64)])
+        np.empty((1,),dtype=[('x',np.int64)])
 
     def check_pickle_transposed(self,level=rlevel):
         """Ticket #16"""
-        a = N.transpose(N.array([[2,9],[7,0],[3,8]]))
+        a = np.transpose(np.array([[2,9],[7,0],[3,8]]))
         f = StringIO()
         pickle.dump(a,f)
         f.seek(0)
@@ -44,45 +44,45 @@
 
     def check_masked_array_create(self,level=rlevel):
         """Ticket #17"""
-        x = N.ma.masked_array([0,1,2,3,0,4,5,6],mask=[0,0,0,1,1,1,0,0])
-        assert_array_equal(N.ma.nonzero(x),[[1,2,6,7]])
+        x = np.ma.masked_array([0,1,2,3,0,4,5,6],mask=[0,0,0,1,1,1,0,0])
+        assert_array_equal(np.ma.nonzero(x),[[1,2,6,7]])
 
     def check_poly1d(self,level=rlevel):
         """Ticket #28"""
-        assert_equal(N.poly1d([1]) - N.poly1d([1,0]),
-                     N.poly1d([-1,1]))
+        assert_equal(np.poly1d([1]) - np.poly1d([1,0]),
+                     np.poly1d([-1,1]))
 
     def check_typeNA(self,level=rlevel):
         """Ticket #31"""
-        assert_equal(N.typeNA[N.int64],'Int64')
-        assert_equal(N.typeNA[N.uint64],'UInt64')
+        assert_equal(np.typeNA[np.int64],'Int64')
+        assert_equal(np.typeNA[np.uint64],'UInt64')
 
     def check_dtype_names(self,level=rlevel):
         """Ticket #35"""
-        dt = N.dtype([(('name','label'),N.int32,3)])
+        dt = np.dtype([(('name','label'),np.int32,3)])
 
     def check_reduce(self,level=rlevel):
         """Ticket #40"""
-        assert_almost_equal(N.add.reduce([1.,.5],dtype=None), 1.5)
+        assert_almost_equal(np.add.reduce([1.,.5],dtype=None), 1.5)
 
     def check_zeros_order(self,level=rlevel):
         """Ticket #43"""
-        N.zeros([3], int, 'C')
-        N.zeros([3], order='C')
-        N.zeros([3], int, order='C')
+        np.zeros([3], int, 'C')
+        np.zeros([3], order='C')
+        np.zeros([3], int, order='C')
 
     def check_sort_bigendian(self,level=rlevel):
         """Ticket #47"""
-        a = N.linspace(0, 10, 11)
-        c = a.astype(N.dtype('<f8'))
+        a = np.linspace(0, 10, 11)
+        c = a.astype(np.dtype('<f8'))
         c.sort()
         assert_array_almost_equal(c, a)
 
     def check_negative_nd_indexing(self,level=rlevel):
         """Ticket #49"""
-        c = N.arange(125).reshape((5,5,5))
-        origidx = N.array([-1, 0, 1])
-        idx = N.array(origidx)
+        c = np.arange(125).reshape((5,5,5))
+        origidx = np.array([-1, 0, 1])
+        idx = np.array(origidx)
         c[idx]
         assert_array_equal(idx, origidx)
 
@@ -90,15 +90,15 @@
         """Ticket #50"""
         import tempfile
         f = StringIO()
-        ca = N.char.array(N.arange(1000,1010),itemsize=4)
+        ca = np.char.array(np.arange(1000,1010),itemsize=4)
         ca.dump(f)
         f.seek(0)
-        ca = N.load(f)
+        ca = np.load(f)
         f.close()
 
     def check_noncontiguous_fill(self,level=rlevel):
         """Ticket #58."""
-        a = N.zeros((5,3))
+        a = np.zeros((5,3))
         b = a[:,:2,]
         def rs():
             b.shape = (10,)
@@ -106,7 +106,7 @@
 
     def check_bool(self,level=rlevel):
         """Ticket #60"""
-        x = N.bool_(1)
+        x = np.bool_(1)
 
     def check_masked_array(self,level=rlevel):
         """Ticket #61"""
@@ -115,8 +115,8 @@
     def check_mem_masked_where(self,level=rlevel):
         """Ticket #62"""
         from numpy.ma import masked_where, MaskType
-        a = N.zeros((1,1))
-        b = N.zeros(a.shape, MaskType)
+        a = np.zeros((1,1))
+        b = np.zeros(a.shape, MaskType)
         c = masked_where(b,a)
         a-c
 
@@ -124,33 +124,33 @@
         """Ticket #64"""
         descr = [('x', [('y', [('z', 'c16', (2,)),]),]),]
         buffer = ((([6j,4j],),),)
-        h = N.array(buffer, dtype=descr)
+        h = np.array(buffer, dtype=descr)
         h['x']['y']['z']
 
     def check_indexing2(self,level=rlevel):
         """Ticket #65"""
         descr = [('x', 'i4', (2,))]
         buffer = ([3,2],)
-        h = N.array(buffer, dtype=descr)
+        h = np.array(buffer, dtype=descr)
         h['x']
 
     def check_round(self,level=rlevel):
         """Ticket #67"""
-        x = N.array([1+2j])
+        x = np.array([1+2j])
         assert_almost_equal(x**(-1), [1/(1+2j)])
 
     def check_kron_matrix(self,level=rlevel):
         """Ticket #71"""
-        x = N.matrix('[1 0; 1 0]')
-        assert_equal(type(N.kron(x,x)),type(x))
+        x = np.matrix('[1 0; 1 0]')
+        assert_equal(type(np.kron(x,x)),type(x))
 
     def check_scalar_compare(self,level=rlevel):
         """Ticket #72"""
-        a = N.array(['test', 'auto'])
-        assert_array_equal(a == 'auto', N.array([False,True]))
+        a = np.array(['test', 'auto'])
+        assert_array_equal(a == 'auto', np.array([False,True]))
         self.assert_(a[1] == 'auto')
         self.assert_(a[0] != 'auto')
-        b = N.linspace(0, 10, 11)
+        b = np.linspace(0, 10, 11)
         self.assert_(b != 'auto')
         self.assert_(b[0] != 'auto')
 
@@ -158,164 +158,164 @@
         """Ticket #79"""
         ulen = 1
         ucs_value = u'\U0010FFFF'
-        ua = N.array([[[ucs_value*ulen]*2]*3]*4, dtype='U%s' % ulen)
+        ua = np.array([[[ucs_value*ulen]*2]*3]*4, dtype='U%s' % ulen)
         ua2 = ua.newbyteorder()
 
     def check_matrix_std_argmax(self,level=rlevel):
         """Ticket #83"""
-        x = N.asmatrix(N.random.uniform(0,1,(3,3)))
+        x = np.asmatrix(np.random.uniform(0,1,(3,3)))
         self.assertEqual(x.std().shape, ())
         self.assertEqual(x.argmax().shape, ())
 
     def check_object_array_fill(self,level=rlevel):
         """Ticket #86"""
-        x = N.zeros(1, 'O')
+        x = np.zeros(1, 'O')
         x.fill([])
 
     def check_cov_parameters(self,level=rlevel):
         """Ticket #91"""
-        x = N.random.random((3,3))
+        x = np.random.random((3,3))
         y = x.copy()
-        N.cov(x,rowvar=1)
-        N.cov(y,rowvar=0)
+        np.cov(x,rowvar=1)
+        np.cov(y,rowvar=0)
         assert_array_equal(x,y)
 
     def check_mem_dtype_align(self,level=rlevel):
         """Ticket #93"""
-        self.failUnlessRaises(TypeError,N.dtype,
+        self.failUnlessRaises(TypeError,np.dtype,
                               {'names':['a'],'formats':['foo']},align=1)
 
     def check_mem_digitize(self,level=rlevel):
         """Ticket #95"""
         for i in range(100):
-            N.digitize([1,2,3,4],[1,3])
-            N.digitize([0,1,2,3,4],[1,3])
+            np.digitize([1,2,3,4],[1,3])
+            np.digitize([0,1,2,3,4],[1,3])
 
     def check_intp(self,level=rlevel):
         """Ticket #99"""
-        i_width = N.int_(0).nbytes*2 - 1
-        N.intp('0x' + 'f'*i_width,16)
-        self.failUnlessRaises(OverflowError,N.intp,'0x' + 'f'*(i_width+1),16)
-        self.failUnlessRaises(ValueError,N.intp,'0x1',32)
-        assert_equal(255,N.intp('0xFF',16))
-        assert_equal(1024,N.intp(1024))
+        i_width = np.int_(0).nbytes*2 - 1
+        np.intp('0x' + 'f'*i_width,16)
+        self.failUnlessRaises(OverflowError,np.intp,'0x' + 'f'*(i_width+1),16)
+        self.failUnlessRaises(ValueError,np.intp,'0x1',32)
+        assert_equal(255,np.intp('0xFF',16))
+        assert_equal(1024,np.intp(1024))
 
     def check_endian_bool_indexing(self,level=rlevel):
         """Ticket #105"""
-        a = N.arange(10.,dtype='>f8')
-        b = N.arange(10.,dtype='<f8')
-        xa = N.where((a>2) & (a<6))
-        xb = N.where((b>2) & (b<6))
+        a = np.arange(10.,dtype='>f8')
+        b = np.arange(10.,dtype='<f8')
+        xa = np.where((a>2) & (a<6))
+        xb = np.where((b>2) & (b<6))
         ya = ((a>2) & (a<6))
         yb = ((b>2) & (b<6))
         assert_array_almost_equal(xa,ya.nonzero())
         assert_array_almost_equal(xb,yb.nonzero())
-        assert(N.all(a[ya] > 0.5))
-        assert(N.all(b[yb] > 0.5))
+        assert(np.all(a[ya] > 0.5))
+        assert(np.all(b[yb] > 0.5))
 
     def check_mem_dot(self,level=rlevel):
         """Ticket #106"""
-        x = N.random.randn(0,1)
-        y = N.random.randn(10,1)
-        z = N.dot(x, N.transpose(y))
+        x = np.random.randn(0,1)
+        y = np.random.randn(10,1)
+        z = np.dot(x, np.transpose(y))
 
     def check_arange_endian(self,level=rlevel):
         """Ticket #111"""
-        ref = N.arange(10)
-        x = N.arange(10,dtype='<f8')
+        ref = np.arange(10)
+        x = np.arange(10,dtype='<f8')
         assert_array_equal(ref,x)
-        x = N.arange(10,dtype='>f8')
+        x = np.arange(10,dtype='>f8')
         assert_array_equal(ref,x)
 
 #    Longfloat support is not consistent enough across
 #     platforms for this test to be meaningful.
 #    def check_longfloat_repr(self,level=rlevel):
 #        """Ticket #112"""
-#        if N.longfloat(0).itemsize > 8:
-#            a = N.exp(N.array([1000],dtype=N.longfloat))
+#        if np.longfloat(0).itemsize > 8:
+#            a = np.exp(np.array([1000],dtype=np.longfloat))
 #            assert(str(a)[1:9] == str(a[0])[:8])
 
     def check_argmax(self,level=rlevel):
         """Ticket #119"""
-        a = N.random.normal(0,1,(4,5,6,7,8))
+        a = np.random.normal(0,1,(4,5,6,7,8))
         for i in xrange(a.ndim):
             aargmax = a.argmax(i)
 
     def check_matrix_properties(self,level=rlevel):
         """Ticket #125"""
-        a = N.matrix([1.0],dtype=float)
-        assert(type(a.real) is N.matrix)
-        assert(type(a.imag) is N.matrix)
-        c,d = N.matrix([0.0]).nonzero()
-        assert(type(c) is N.matrix)
-        assert(type(d) is N.matrix)
+        a = np.matrix([1.0],dtype=float)
+        assert(type(a.real) is np.matrix)
+        assert(type(a.imag) is np.matrix)
+        c,d = np.matrix([0.0]).nonzero()
+        assert(type(c) is np.matrix)
+        assert(type(d) is np.matrix)
 
     def check_mem_divmod(self,level=rlevel):
         """Ticket #126"""
         for i in range(10):
-            divmod(N.array([i])[0],10)
+            divmod(np.array([i])[0],10)
 
 
     def check_hstack_invalid_dims(self,level=rlevel):
         """Ticket #128"""
-        x = N.arange(9).reshape((3,3))
-        y = N.array([0,0,0])
-        self.failUnlessRaises(ValueError,N.hstack,(x,y))
+        x = np.arange(9).reshape((3,3))
+        y = np.array([0,0,0])
+        self.failUnlessRaises(ValueError,np.hstack,(x,y))
 
     def check_squeeze_type(self,level=rlevel):
         """Ticket #133"""
-        a = N.array([3])
-        b = N.array(3)
-        assert(type(a.squeeze()) is N.ndarray)
-        assert(type(b.squeeze()) is N.ndarray)
+        a = np.array([3])
+        b = np.array(3)
+        assert(type(a.squeeze()) is np.ndarray)
+        assert(type(b.squeeze()) is np.ndarray)
 
     def check_add_identity(self,level=rlevel):
         """Ticket #143"""
-        assert_equal(0,N.add.identity)
+        assert_equal(0,np.add.identity)
 
     def check_binary_repr_0(self,level=rlevel):
         """Ticket #151"""
-        assert_equal('0',N.binary_repr(0))
+        assert_equal('0',np.binary_repr(0))
 
     def check_rec_iterate(self,level=rlevel):
         """Ticket #160"""
-        descr = N.dtype([('i',int),('f',float),('s','|S3')])
-        x = N.rec.array([(1,1.1,'1.0'),
+        descr = np.dtype([('i',int),('f',float),('s','|S3')])
+        x = np.rec.array([(1,1.1,'1.0'),
                          (2,2.2,'2.0')],dtype=descr)
         x[0].tolist()
         [i for i in x[0]]
 
     def check_unicode_string_comparison(self,level=rlevel):
         """Ticket #190"""
-        a = N.array('hello',N.unicode_)
-        b = N.array('world')
+        a = np.array('hello',np.unicode_)
+        b = np.array('world')
         a == b
 
     def check_tostring_FORTRANORDER_discontiguous(self,level=rlevel):
         """Fix in r2836"""
         # Create discontiguous Fortran-ordered array
-        x = N.array(N.random.rand(3,3),order='F')[:,:2]
-        assert_array_almost_equal(x.ravel(),N.fromstring(x.tostring()))
+        x = np.array(np.random.rand(3,3),order='F')[:,:2]
+        assert_array_almost_equal(x.ravel(),np.fromstring(x.tostring()))
 
     def check_flat_assignment(self,level=rlevel):
         """Correct behaviour of ticket #194"""
-        x = N.empty((3,1))
-        x.flat = N.arange(3)
+        x = np.empty((3,1))
+        x.flat = np.arange(3)
         assert_array_almost_equal(x,[[0],[1],[2]])
-        x.flat = N.arange(3,dtype=float)
+        x.flat = np.arange(3,dtype=float)
         assert_array_almost_equal(x,[[0],[1],[2]])
 
     def check_broadcast_flat_assignment(self,level=rlevel):
         """Ticket #194"""
-        x = N.empty((3,1))
-        def bfa(): x[:] = N.arange(3)
-        def bfb(): x[:] = N.arange(3,dtype=float)
+        x = np.empty((3,1))
+        def bfa(): x[:] = np.arange(3)
+        def bfb(): x[:] = np.arange(3,dtype=float)
         self.failUnlessRaises(ValueError, bfa)
         self.failUnlessRaises(ValueError, bfb)
 
     def check_unpickle_dtype_with_object(self,level=rlevel):
         """Implemented in r2840"""
-        dt = N.dtype([('x',int),('y',N.object_),('z','O')])
+        dt = np.dtype([('x',int),('y',np.object_),('z','O')])
         f = StringIO()
         pickle.dump(dt,f)
         f.seek(0)
@@ -325,107 +325,107 @@
 
     def check_mem_array_creation_invalid_specification(self,level=rlevel):
         """Ticket #196"""
-        dt = N.dtype([('x',int),('y',N.object_)])
+        dt = np.dtype([('x',int),('y',np.object_)])
         # Wrong way
-        self.failUnlessRaises(ValueError, N.array, [1,'object'], dt)
+        self.failUnlessRaises(ValueError, np.array, [1,'object'], dt)
         # Correct way
-        N.array([(1,'object')],dt)
+        np.array([(1,'object')],dt)
 
     def check_recarray_single_element(self,level=rlevel):
         """Ticket #202"""
-        a = N.array([1,2,3],dtype=N.int32)
+        a = np.array([1,2,3],dtype=np.int32)
         b = a.copy()
-        r = N.rec.array(a,shape=1,formats=['3i4'],names=['d'])
+        r = np.rec.array(a,shape=1,formats=['3i4'],names=['d'])
         assert_array_equal(a,b)
         assert_equal(a,r[0][0])
 
     def check_zero_sized_array_indexing(self,level=rlevel):
         """Ticket #205"""
-        tmp = N.array([])
-        def index_tmp(): tmp[N.array(10)]
+        tmp = np.array([])
+        def index_tmp(): tmp[np.array(10)]
         self.failUnlessRaises(IndexError, index_tmp)
 
     def check_unique_zero_sized(self,level=rlevel):
         """Ticket #205"""
-        assert_array_equal([], N.unique(N.array([])))
+        assert_array_equal([], np.unique(np.array([])))
 
     def check_chararray_rstrip(self,level=rlevel):
         """Ticket #222"""
-        x = N.chararray((1,),5)
+        x = np.chararray((1,),5)
         x[0] = 'a   '
         x = x.rstrip()
         assert_equal(x[0], 'a')
 
     def check_object_array_shape(self,level=rlevel):
         """Ticket #239"""
-        assert_equal(N.array([[1,2],3,4],dtype=object).shape, (3,))
-        assert_equal(N.array([[1,2],[3,4]],dtype=object).shape, (2,2))
-        assert_equal(N.array([(1,2),(3,4)],dtype=object).shape, (2,2))
-        assert_equal(N.array([],dtype=object).shape, (0,))
-        assert_equal(N.array([[],[],[]],dtype=object).shape, (3,0))
-        assert_equal(N.array([[3,4],[5,6],None],dtype=object).shape, (3,))
+        assert_equal(np.array([[1,2],3,4],dtype=object).shape, (3,))
+        assert_equal(np.array([[1,2],[3,4]],dtype=object).shape, (2,2))
+        assert_equal(np.array([(1,2),(3,4)],dtype=object).shape, (2,2))
+        assert_equal(np.array([],dtype=object).shape, (0,))
+        assert_equal(np.array([[],[],[]],dtype=object).shape, (3,0))
+        assert_equal(np.array([[3,4],[5,6],None],dtype=object).shape, (3,))
 
     def check_mem_around(self,level=rlevel):
         """Ticket #243"""
-        x = N.zeros((1,))
+        x = np.zeros((1,))
         y = [0]
         decimal = 6
-        N.around(abs(x-y),decimal) <= 10.0**(-decimal)
+        np.around(abs(x-y),decimal) <= 10.0**(-decimal)
 
     def check_character_array_strip(self,level=rlevel):
         """Ticket #246"""
-        x = N.char.array(("x","x ","x  "))
+        x = np.char.array(("x","x ","x  "))
         for c in x: assert_equal(c,"x")
 
     def check_lexsort(self,level=rlevel):
         """Lexsort memory error"""
-        v = N.array([1,2,3,4,5,6,7,8,9,10])
-        assert_equal(N.lexsort(v),0)
+        v = np.array([1,2,3,4,5,6,7,8,9,10])
+        assert_equal(np.lexsort(v),0)
 
     def check_pickle_dtype(self,level=rlevel):
         """Ticket #251"""
         import pickle
-        pickle.dumps(N.float)
+        pickle.dumps(np.float)
 
     def check_masked_array_multiply(self,level=rlevel):
         """Ticket #254"""
-        a = N.ma.zeros((4,1))
-        a[2,0] = N.ma.masked
-        b = N.zeros((4,2))
+        a = np.ma.zeros((4,1))
+        a[2,0] = np.ma.masked
+        b = np.zeros((4,2))
         a*b
         b*a
 
     def check_swap_real(self, level=rlevel):
         """Ticket #265"""
-        assert_equal(N.arange(4,dtype='>c8').imag.max(),0.0)
-        assert_equal(N.arange(4,dtype='<c8').imag.max(),0.0)
-        assert_equal(N.arange(4,dtype='>c8').real.max(),3.0)
-        assert_equal(N.arange(4,dtype='<c8').real.max(),3.0)
+        assert_equal(np.arange(4,dtype='>c8').imag.max(),0.0)
+        assert_equal(np.arange(4,dtype='<c8').imag.max(),0.0)
+        assert_equal(np.arange(4,dtype='>c8').real.max(),3.0)
+        assert_equal(np.arange(4,dtype='<c8').real.max(),3.0)
 
     def check_object_array_from_list(self, level=rlevel):
         """Ticket #270"""
-        a = N.array([1,'A',None])
+        a = np.array([1,'A',None])
 
     def check_masked_array_repeat(self, level=rlevel):
         """Ticket #271"""
-        N.ma.array([1],mask=False).repeat(10)
+        np.ma.array([1],mask=False).repeat(10)
 
     def check_multiple_assign(self, level=rlevel):
         """Ticket #273"""
-        a = N.zeros((3,1),int)
+        a = np.zeros((3,1),int)
         a[[1,2]] = 1
 
     def check_empty_array_type(self, level=rlevel):
-        assert_equal(N.array([]).dtype, N.zeros(0).dtype)
+        assert_equal(np.array([]).dtype, np.zeros(0).dtype)
 
     def check_void_coercion(self, level=rlevel):
-        dt = N.dtype([('a','f4'),('b','i4')])
-        x = N.zeros((1,),dt)
-        assert(N.r_[x,x].dtype == dt)
+        dt = np.dtype([('a','f4'),('b','i4')])
+        x = np.zeros((1,),dt)
+        assert(np.r_[x,x].dtype == dt)
 
     def check_void_copyswap(self, level=rlevel):
-        dt = N.dtype([('one', '<i4'),('two', '<i4')])
-        x = N.array((1,2), dtype=dt)
+        dt = np.dtype([('one', '<i4'),('two', '<i4')])
+        x = np.array((1,2), dtype=dt)
         x = x.byteswap()
         assert(x['one'] > 1 and x['two'] > 2)
 
@@ -440,7 +440,7 @@
         funcs2 = ['compress', 'take', 'repeat']
 
         for func in funcs1:
-            arr = N.random.rand(8,7)
+            arr = np.random.rand(8,7)
             arr2 = arr.copy()
             if isinstance(func, tuple):
                 func_meth = func[1]
@@ -448,15 +448,15 @@
             else:
                 func_meth = func
             res1 = getattr(arr, func_meth)()
-            res2 = getattr(N, func)(arr2)
+            res2 = getattr(np, func)(arr2)
             if res1 is None:
                 assert abs(arr-res2).max() < 1e-8, func
             else:
                 assert abs(res1-res2).max() < 1e-8, func
 
         for func in funcs2:
-            arr1 = N.random.rand(8,7)
-            arr2 = N.random.rand(8,7)
+            arr1 = np.random.rand(8,7)
+            arr2 = np.random.rand(8,7)
             res1 = None
             if func == 'compress':
                 arr1 = arr1.ravel()
@@ -465,219 +465,219 @@
                 arr2 = (15*arr2).astype(int).ravel()
             if res1 is None:
                 res1 = getattr(arr1, func)(arr2)
-            res2 = getattr(N, func)(arr1, arr2)
+            res2 = getattr(np, func)(arr1, arr2)
             assert abs(res1-res2).max() < 1e-8, func
 
     def check_mem_lexsort_strings(self, level=rlevel):
         """Ticket #298"""
         lst = ['abc','cde','fgh']
-        N.lexsort((lst,))
+        np.lexsort((lst,))
 
     def check_fancy_index(self, level=rlevel):
         """Ticket #302"""
-        x = N.array([1,2])[N.array([0])]
+        x = np.array([1,2])[np.array([0])]
         assert_equal(x.shape,(1,))
 
     def check_recarray_copy(self, level=rlevel):
         """Ticket #312"""
-        dt = [('x',N.int16),('y',N.float64)]
-        ra = N.array([(1,2.3)], dtype=dt)
-        rb = N.rec.array(ra, dtype=dt)
+        dt = [('x',np.int16),('y',np.float64)]
+        ra = np.array([(1,2.3)], dtype=dt)
+        rb = np.rec.array(ra, dtype=dt)
         rb['x'] = 2.
         assert ra['x'] != rb['x']
 
     def check_rec_fromarray(self, level=rlevel):
         """Ticket #322"""
-        x1 = N.array([[1,2],[3,4],[5,6]])
-        x2 = N.array(['a','dd','xyz'])
-        x3 = N.array([1.1,2,3])
-        N.rec.fromarrays([x1,x2,x3], formats="(2,)i4,a3,f8")
+        x1 = np.array([[1,2],[3,4],[5,6]])
+        x2 = np.array(['a','dd','xyz'])
+        x3 = np.array([1.1,2,3])
+        np.rec.fromarrays([x1,x2,x3], formats="(2,)i4,a3,f8")
 
     def check_object_array_assign(self, level=rlevel):
-        x = N.empty((2,2),object)
+        x = np.empty((2,2),object)
         x.flat[2] = (1,2,3)
         assert_equal(x.flat[2],(1,2,3))
 
     def check_ndmin_float64(self, level=rlevel):
         """Ticket #324"""
-        x = N.array([1,2,3],dtype=N.float64)
-        assert_equal(N.array(x,dtype=N.float32,ndmin=2).ndim,2)
-        assert_equal(N.array(x,dtype=N.float64,ndmin=2).ndim,2)
+        x = np.array([1,2,3],dtype=np.float64)
+        assert_equal(np.array(x,dtype=np.float32,ndmin=2).ndim,2)
+        assert_equal(np.array(x,dtype=np.float64,ndmin=2).ndim,2)
 
     def check_mem_vectorise(self, level=rlevel):
         """Ticket #325"""
-        vt = N.vectorize(lambda *args: args)
-        vt(N.zeros((1,2,1)), N.zeros((2,1,1)), N.zeros((1,1,2)))
-        vt(N.zeros((1,2,1)), N.zeros((2,1,1)), N.zeros((1,1,2)), N.zeros((2,2)))
+        vt = np.vectorize(lambda *args: args)
+        vt(np.zeros((1,2,1)), np.zeros((2,1,1)), np.zeros((1,1,2)))
+        vt(np.zeros((1,2,1)), np.zeros((2,1,1)), np.zeros((1,1,2)), np.zeros((2,2)))
 
     def check_mem_axis_minimization(self, level=rlevel):
         """Ticket #327"""
-        data = N.arange(5)
-        data = N.add.outer(data,data)
+        data = np.arange(5)
+        data = np.add.outer(data,data)
 
     def check_mem_float_imag(self, level=rlevel):
         """Ticket #330"""
-        N.float64(1.0).imag
+        np.float64(1.0).imag
 
     def check_dtype_tuple(self, level=rlevel):
         """Ticket #334"""
-        assert N.dtype('i4') == N.dtype(('i4',()))
+        assert np.dtype('i4') == np.dtype(('i4',()))
 
     def check_dtype_posttuple(self, level=rlevel):
         """Ticket #335"""
-        N.dtype([('col1', '()i4')])
+        np.dtype([('col1', '()i4')])
 
     def check_mgrid_single_element(self, level=rlevel):
         """Ticket #339"""
-        assert_array_equal(N.mgrid[0:0:1j],[0])
-        assert_array_equal(N.mgrid[0:0],[])
+        assert_array_equal(np.mgrid[0:0:1j],[0])
+        assert_array_equal(np.mgrid[0:0],[])
 
     def check_numeric_carray_compare(self, level=rlevel):
         """Ticket #341"""
-        assert_equal(N.array([ 'X' ], 'c'),'X')
+        assert_equal(np.array([ 'X' ], 'c'),'X')
 
     def check_string_array_size(self, level=rlevel):
         """Ticket #342"""
         self.failUnlessRaises(ValueError,
-                              N.array,[['X'],['X','X','X']],'|S1')
+                              np.array,[['X'],['X','X','X']],'|S1')
 
     def check_dtype_repr(self, level=rlevel):
         """Ticket #344"""
-        dt1=N.dtype(('uint32', 2))
-        dt2=N.dtype(('uint32', (2,)))
+        dt1=np.dtype(('uint32', 2))
+        dt2=np.dtype(('uint32', (2,)))
         assert_equal(dt1.__repr__(), dt2.__repr__())
 
     def check_reshape_order(self, level=rlevel):
         """Make sure reshape order works."""
-        a = N.arange(6).reshape(2,3,order='F')
+        a = np.arange(6).reshape(2,3,order='F')
         assert_equal(a,[[0,2,4],[1,3,5]])
-        a = N.array([[1,2],[3,4],[5,6],[7,8]])
+        a = np.array([[1,2],[3,4],[5,6],[7,8]])
         b = a[:,1]
         assert_equal(b.reshape(2,2,order='F'), [[2,6],[4,8]])
 
     def check_repeat_discont(self, level=rlevel):
         """Ticket #352"""
-        a = N.arange(12).reshape(4,3)[:,2]
+        a = np.arange(12).reshape(4,3)[:,2]
         assert_equal(a.repeat(3), [2,2,2,5,5,5,8,8,8,11,11,11])
 
     def check_array_index(self, level=rlevel):
         """Make sure optimization is not called in this case."""
-        a = N.array([1,2,3])
-        a2 = N.array([[1,2,3]])
-        assert_equal(a[N.where(a==3)], a2[N.where(a2==3)])
+        a = np.array([1,2,3])
+        a2 = np.array([[1,2,3]])
+        assert_equal(a[np.where(a==3)], a2[np.where(a2==3)])
 
     def check_object_argmax(self, level=rlevel):
-        a = N.array([1,2,3],dtype=object)
+        a = np.array([1,2,3],dtype=object)
         assert a.argmax() == 2
 
     def check_recarray_fields(self, level=rlevel):
         """Ticket #372"""
-        dt0 = N.dtype([('f0','i4'),('f1','i4')])
-        dt1 = N.dtype([('f0','i8'),('f1','i8')])
-        for a in [N.array([(1,2),(3,4)],"i4,i4"),
-                  N.rec.array([(1,2),(3,4)],"i4,i4"),
-                  N.rec.array([(1,2),(3,4)]),
-                  N.rec.fromarrays([(1,2),(3,4)],"i4,i4"),
-                  N.rec.fromarrays([(1,2),(3,4)])]:
+        dt0 = np.dtype([('f0','i4'),('f1','i4')])
+        dt1 = np.dtype([('f0','i8'),('f1','i8')])
+        for a in [np.array([(1,2),(3,4)],"i4,i4"),
+                  np.rec.array([(1,2),(3,4)],"i4,i4"),
+                  np.rec.array([(1,2),(3,4)]),
+                  np.rec.fromarrays([(1,2),(3,4)],"i4,i4"),
+                  np.rec.fromarrays([(1,2),(3,4)])]:
             assert(a.dtype in [dt0,dt1])
 
     def check_random_shuffle(self, level=rlevel):
         """Ticket #374"""
-        a = N.arange(5).reshape((5,1))
+        a = np.arange(5).reshape((5,1))
         b = a.copy()
-        N.random.shuffle(b)
-        assert_equal(N.sort(b, axis=0),a)
+        np.random.shuffle(b)
+        assert_equal(np.sort(b, axis=0),a)
 
     def check_refcount_vectorize(self, level=rlevel):
         """Ticket #378"""
         def p(x,y): return 123
-        v = N.vectorize(p)
+        v = np.vectorize(p)
         assert_valid_refcount(v)
 
     def check_poly1d_nan_roots(self, level=rlevel):
         """Ticket #396"""
-        p = N.poly1d([N.nan,N.nan,1], r=0)
-        self.failUnlessRaises(N.linalg.LinAlgError,getattr,p,"r")
+        p = np.poly1d([np.nan,np.nan,1], r=0)
+        self.failUnlessRaises(np.linalg.LinAlgError,getattr,p,"r")
 
     def check_refcount_vdot(self, level=rlevel):
         """Changeset #3443"""
-        assert_valid_refcount(N.vdot)
+        assert_valid_refcount(np.vdot)
 
     def check_startswith(self, level=rlevel):
-        ca = N.char.array(['Hi','There'])
+        ca = np.char.array(['Hi','There'])
         assert_equal(ca.startswith('H'),[True,False])
 
     def check_noncommutative_reduce_accumulate(self, level=rlevel):
         """Ticket #413"""
-        tosubtract = N.arange(5)
-        todivide = N.array([2.0, 0.5, 0.25])
-        assert_equal(N.subtract.reduce(tosubtract), -10)
-        assert_equal(N.divide.reduce(todivide), 16.0)
-        assert_array_equal(N.subtract.accumulate(tosubtract),
-            N.array([0, -1, -3, -6, -10]))
-        assert_array_equal(N.divide.accumulate(todivide),
-            N.array([2., 4., 16.]))
+        tosubtract = np.arange(5)
+        todivide = np.array([2.0, 0.5, 0.25])
+        assert_equal(np.subtract.reduce(tosubtract), -10)
+        assert_equal(np.divide.reduce(todivide), 16.0)
+        assert_array_equal(np.subtract.accumulate(tosubtract),
+            np.array([0, -1, -3, -6, -10]))
+        assert_array_equal(np.divide.accumulate(todivide),
+            np.array([2., 4., 16.]))
 
     def check_mem_polymul(self, level=rlevel):
         """Ticket #448"""
-        N.polymul([],[1.])
+        np.polymul([],[1.])
 
     def check_convolve_empty(self, level=rlevel):
         """Convolve should raise an error for empty input array."""
-        self.failUnlessRaises(AssertionError,N.convolve,[],[1])
-        self.failUnlessRaises(AssertionError,N.convolve,[1],[])
+        self.failUnlessRaises(AssertionError,np.convolve,[],[1])
+        self.failUnlessRaises(AssertionError,np.convolve,[1],[])
 
     def check_multidim_byteswap(self, level=rlevel):
         """Ticket #449"""
-        r=N.array([(1,(0,1,2))], dtype="i2,3i2")
+        r=np.array([(1,(0,1,2))], dtype="i2,3i2")
         assert_array_equal(r.byteswap(),
-                           N.array([(256,(0,256,512))],r.dtype))
+                           np.array([(256,(0,256,512))],r.dtype))
 
     def check_string_NULL(self, level=rlevel):
         """Changeset 3557"""
-        assert_equal(N.array("a\x00\x0b\x0c\x00").item(),
+        assert_equal(np.array("a\x00\x0b\x0c\x00").item(),
                      'a\x00\x0b\x0c')
 
     def check_mem_string_concat(self, level=rlevel):
         """Ticket #469"""
-        x = N.array([])
-        N.append(x,'asdasd\tasdasd')
+        x = np.array([])
+        np.append(x,'asdasd\tasdasd')
 
     def check_matrix_multiply_by_1d_vector(self, level=rlevel) :
         """Ticket #473"""
         def mul() :
-            N.mat(N.eye(2))*N.ones(2)
+            np.mat(np.eye(2))*np.ones(2)
 
         self.failUnlessRaises(ValueError,mul)
 
     def check_junk_in_string_fields_of_recarray(self, level=rlevel):
         """Ticket #483"""
-        r = N.array([['abc']], dtype=[('var1', '|S20')])
+        r = np.array([['abc']], dtype=[('var1', '|S20')])
         assert str(r['var1'][0][0]) == 'abc'
 
     def check_take_output(self, level=rlevel):
         """Ensure that 'take' honours output parameter."""
-        x = N.arange(12).reshape((3,4))
-        a = N.take(x,[0,2],axis=1)
-        b = N.zeros_like(a)
-        N.take(x,[0,2],axis=1,out=b)
+        x = np.arange(12).reshape((3,4))
+        a = np.take(x,[0,2],axis=1)
+        b = np.zeros_like(a)
+        np.take(x,[0,2],axis=1,out=b)
         assert_array_equal(a,b)
 
     def check_array_str_64bit(self, level=rlevel):
         """Ticket #501"""
-        s = N.array([1, N.nan],dtype=N.float64)
-        errstate = N.seterr(all='raise')
+        s = np.array([1, np.nan],dtype=np.float64)
+        errstate = np.seterr(all='raise')
         try:
-            sstr = N.array_str(s)
+            sstr = np.array_str(s)
         finally:
-            N.seterr(**errstate)
+            np.seterr(**errstate)
 
     def check_frompyfunc_endian(self, level=rlevel):
         """Ticket #503"""
         from math import radians
-        uradians = N.frompyfunc(radians, 1, 1)
-        big_endian = N.array([83.4, 83.5], dtype='>f8')
-        little_endian = N.array([83.4, 83.5], dtype='<f8')
+        uradians = np.frompyfunc(radians, 1, 1)
+        big_endian = np.array([83.4, 83.5], dtype='>f8')
+        little_endian = np.array([83.4, 83.5], dtype='<f8')
         assert_almost_equal(uradians(big_endian).astype(float),
                             uradians(little_endian).astype(float))
 
@@ -685,21 +685,21 @@
         """Ticket #514"""
         s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
         t = []
-        N.hstack((t, s ))
+        np.hstack((t, s ))
 
     def check_arr_transpose(self, level=rlevel):
         """Ticket #516"""
-        x = N.random.rand(*(2,)*16)
+        x = np.random.rand(*(2,)*16)
         y = x.transpose(range(16))
 
     def check_string_mergesort(self, level=rlevel):
         """Ticket #540"""
-        x = N.array(['a']*32)
-        assert_array_equal(x.argsort(kind='m'), N.arange(32))
+        x = np.array(['a']*32)
+        assert_array_equal(x.argsort(kind='m'), np.arange(32))
 
     def check_argmax_byteorder(self, level=rlevel):
         """Ticket #546"""
-        a = N.arange(3, dtype='>f')
+        a = np.arange(3, dtype='>f')
         assert a[a.argmax()] == a.max()
 
     def check_numeric_random(self, level=rlevel):
@@ -709,41 +709,41 @@
 
     def check_poly_div(self, level=rlevel):
         """Ticket #553"""
-        u = N.poly1d([1,2,3])
-        v = N.poly1d([1,2,3,4,5])
-        q,r = N.polydiv(u,v)
+        u = np.poly1d([1,2,3])
+        v = np.poly1d([1,2,3,4,5])
+        q,r = np.polydiv(u,v)
         assert_equal(q*v + r, u)
 
     def check_poly_eq(self, level=rlevel):
         """Ticket #554"""
-        x = N.poly1d([1,2,3])
-        y = N.poly1d([3,4])
+        x = np.poly1d([1,2,3])
+        y = np.poly1d([3,4])
         assert x != y
         assert x == x
 
     def check_mem_insert(self, level=rlevel):
         """Ticket #572"""
-        N.lib.place(1,1,1)
+        np.lib.place(1,1,1)
 
     def check_dot_negative_stride(self, level=rlevel):
         """Ticket #588"""
-        x = N.array([[1,5,25,125.,625]])
-        y = N.array([[20.],[160.],[640.],[1280.],[1024.]])
+        x = np.array([[1,5,25,125.,625]])
+        y = np.array([[20.],[160.],[640.],[1280.],[1024.]])
         z = y[::-1].copy()
         y2 = y[::-1]
-        assert_equal(N.dot(x,z),N.dot(x,y2))
+        assert_equal(np.dot(x,z),np.dot(x,y2))
 
     def check_object_casting(self, level=rlevel):
         def rs():
-            x = N.ones([484,286])
-            y = N.zeros([484,286])
+            x = np.ones([484,286])
+            y = np.zeros([484,286])
             x |= y
         self.failUnlessRaises(TypeError,rs)
 
     def check_unicode_scalar(self, level=rlevel):
         """Ticket #600"""
         import cPickle
-        x = N.array(["DROND", "DROND1"], dtype="U6")
+        x = np.array(["DROND", "DROND1"], dtype="U6")
         el = x[1]
         new = cPickle.loads(cPickle.dumps(el))
         assert_equal(new, el)
@@ -751,23 +751,25 @@
     def check_arange_non_native_dtype(self, level=rlevel):
         """Ticket #616"""
         for T in ('>f4','<f4'):
-            dt = N.dtype(T)
-            assert_equal(N.arange(0,dtype=dt).dtype,dt)
-            assert_equal(N.arange(0.5,dtype=dt).dtype,dt)
-            assert_equal(N.arange(5,dtype=dt).dtype,dt)
+            dt = np.dtype(T)
+            assert_equal(np.arange(0,dtype=dt).dtype,dt)
+            assert_equal(np.arange(0.5,dtype=dt).dtype,dt)
+            assert_equal(np.arange(5,dtype=dt).dtype,dt)
 
     def check_bool_indexing_invalid_nr_elements(self, level=rlevel):
-        s = N.ones(10,dtype=float)
-        x = N.array((15,),dtype=float)
+        s = np.ones(10,dtype=float)
+        x = np.array((15,),dtype=float)
         def ia(x,s): x[(s>0)]=1.0
         self.failUnlessRaises(ValueError,ia,x,s)
 
     def check_mem_scalar_indexing(self, level=rlevel):
         """Ticket #603"""
-        x = N.array([0],dtype=float)
-        index = N.array(0,dtype=N.int32)
+        x = np.array([0],dtype=float)
+        index = np.array(0,dtype=np.int32)
         x[index]
 
+    def check_binary_repr_0_width(self, level=rlevel):
+        assert_equal(np.binary_repr(0,width=3),'000')
 
 if __name__ == "__main__":
     NumpyTest().run()

Modified: branches/maskedarray/numpy/core/tests/test_scalarmath.py
===================================================================
--- branches/maskedarray/numpy/core/tests/test_scalarmath.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/tests/test_scalarmath.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,14 +1,12 @@
 from numpy.testing import *
-set_package_path()
 import numpy.core.umath as ncu
 from numpy import array
-import numpy as N
-restore_path()
+import numpy as np
 
-types = [N.bool_, N.byte, N.ubyte, N.short, N.ushort, N.intc, N.uintc,
-         N.int_, N.uint, N.longlong, N.ulonglong,
-         N.single, N.double, N.longdouble, N.csingle,
-         N.cdouble, N.clongdouble]
+types = [np.bool_, np.byte, np.ubyte, np.short, np.ushort, np.intc, np.uintc,
+         np.int_, np.uint, np.longlong, np.ulonglong,
+         np.single, np.double, np.longdouble, np.csingle,
+         np.cdouble, np.clongdouble]
 
 # This compares scalarmath against ufuncs.
 
@@ -40,13 +38,13 @@
 
 class TestPower(NumpyTestCase):
     def check_small_types(self):
-        for t in [N.int8, N.int16]:
+        for t in [np.int8, np.int16]:
             a = t(3)
             b = a ** 4
             assert b == 81, "error with %r: got %r" % (t,b)
 
     def check_large_types(self):
-        for t in [N.int32, N.int64, N.float32, N.float64, N.longdouble]:
+        for t in [np.int32, np.int64, np.float32, np.float64, np.longdouble]:
             a = t(51)
             b = a ** 4
             assert b == 6765201, "error with %r: got %r" % (t,b)
@@ -55,12 +53,20 @@
     def test_int_from_long(self):
         l = [1e6, 1e12, 1e18, -1e6, -1e12, -1e18]
         li = [10**6, 10**12, 10**18, -10**6, -10**12, -10**18]
-        for T in [None,N.float64,N.int64]:
-            a = N.array(l,dtype=T)
+        for T in [None, np.float64, np.int64]:
+            a = np.array(l,dtype=T)
             assert_equal(map(int,a), li)
 
-        a = N.array(l[:3],dtype=N.uint64)
+        a = np.array(l[:3], dtype=np.uint64)
         assert_equal(map(int,a), li[:3])
 
+#class TestRepr(NumpyTestCase):
+#    def check_repr(self):
+#        for t in types:
+#            val = t(1197346475.0137341)
+#            val_repr = repr(val)
+#            val2 = eval(val_repr)
+#            assert_equal( val, val2 )
+
 if __name__ == "__main__":
     NumpyTest().run()

Modified: branches/maskedarray/numpy/core/tests/test_ufunc.py
===================================================================
--- branches/maskedarray/numpy/core/tests/test_ufunc.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/tests/test_ufunc.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,15 +1,12 @@
+import numpy as np
 from numpy.testing import *
 
-set_package_path()
-import numpy as N
-restore_path()
-
 class TestUfunc(NumpyTestCase):
     def test_reduceat_shifting_sum(self):
         L = 6
-        x = N.arange(L)
-        idx = N.array(zip(N.arange(L-2),N.arange(L-2)+2)).ravel()
-        assert_array_equal(N.add.reduceat(x,idx)[::2],
+        x = np.arange(L)
+        idx = np.array(zip(np.arange(L-2), np.arange(L-2)+2)).ravel()
+        assert_array_equal(np.add.reduceat(x,idx)[::2],
                            [1,3,5,7])
 
 if __name__ == "__main__":

Modified: branches/maskedarray/numpy/core/tests/test_umath.py
===================================================================
--- branches/maskedarray/numpy/core/tests/test_umath.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/core/tests/test_umath.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -2,7 +2,7 @@
 set_package_path()
 from numpy.core.umath import minimum, maximum, exp
 import numpy.core.umath as ncu
-from numpy import zeros, ndarray, array, choose
+from numpy import zeros, ndarray, array, choose, pi
 restore_path()
 
 class TestDivision(NumpyTestCase):
@@ -61,6 +61,16 @@
     def check_floating_point(self):
         assert_equal(ncu.FLOATING_POINT_SUPPORT, 1)
 
+def TestDegrees(NumpyTestCase):
+    def check_degrees(self):
+        assert_almost_equal(ncu.degrees(pi), 180.0)
+        assert_almost_equal(ncu.degrees(-0.5*pi), -90.0)
+
+def TestRadians(NumpyTestCase):
+    def check_radians(self):
+        assert_almost_equal(ncu.radians(180.0), pi)
+        assert_almost_equal(ncu.degrees(-90.0), -0.5*pi)
+
 class TestSpecialMethods(NumpyTestCase):
     def test_wrap(self):
         class with_wrap(object):

Modified: branches/maskedarray/numpy/distutils/command/build_src.py
===================================================================
--- branches/maskedarray/numpy/distutils/command/build_src.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/distutils/command/build_src.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -4,6 +4,7 @@
 import os
 import re
 import sys
+import shlex
 
 from distutils.command import build_ext
 from distutils.dep_util import newer_group, newer
@@ -24,7 +25,6 @@
      appendpath, is_string, is_sequence
 from numpy.distutils.from_template import process_file as process_f_file
 from numpy.distutils.conv_template import process_file as process_c_file
-from numpy.distutils.exec_command import splitcmdline
 
 class build_src(build_ext.build_ext):
 
@@ -94,7 +94,7 @@
         if self.f2py_opts is None:
             self.f2py_opts = []
         else:
-            self.f2py_opts = splitcmdline(self.f2py_opts)
+            self.f2py_opts = shlex.split(self.f2py_opts)
 
         if self.swigflags:
             if self.swig_opts:
@@ -106,7 +106,7 @@
         if self.swig_opts is None:
             self.swig_opts = []
         else:
-            self.swig_opts = splitcmdline(self.swig_opts)
+            self.swig_opts = shlex.split(self.swig_opts)
 
         # use options from build_ext command
         build_ext = self.get_finalized_command('build_ext')

Modified: branches/maskedarray/numpy/distutils/exec_command.py
===================================================================
--- branches/maskedarray/numpy/distutils/exec_command.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/distutils/exec_command.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -11,7 +11,6 @@
 Provides functions:
   exec_command  --- execute command in a specified directory and
                     in the modified environment.
-  splitcmdline  --- inverse of ' '.join(argv)
   find_executable --- locate a command using info from environment
                     variable PATH. Equivalent to posix `which`
                     command.
@@ -50,6 +49,7 @@
 
 import os
 import sys
+import shlex
 
 from numpy.distutils.misc_util import is_sequence, make_temp_file
 from numpy.distutils import log
@@ -59,8 +59,6 @@
     fo.close()
     return name
 
-############################################################
-
 def get_pythonexe():
     pythonexe = sys.executable
     if os.name in ['nt','dos']:
@@ -70,58 +68,12 @@
         assert os.path.isfile(pythonexe), '%r is not a file' % (pythonexe,)
     return pythonexe
 
-############################################################
-
 def splitcmdline(line):
-    """ Inverse of ' '.join(sys.argv).
-    """
-    log.debug('splitcmdline(%r)' % (line))
-    lst = []
-    flag = 0
-    s,pc,cc = '','',''
-    for nc in line+' ':
-        if flag==0:
-            flag = (pc != '\\' and \
-                     ((cc=='"' and 1) or (cc=="'" and 2) or \
-                       (cc==' ' and pc!=' ' and -2))) or flag
-        elif flag==1:
-            flag = (cc=='"' and pc!='\\' and nc==' ' and -1) or flag
-        elif flag==2:
-            flag = (cc=="'" and pc!='\\' and nc==' ' and -1) or flag
-        if flag!=-2:
-            s += cc
-        if flag<0:
-            flag = 0
-            s = s.strip()
-            if s:
-                lst.append(s)
-                s = ''
-        pc,cc = cc,nc
-    else:
-        s = s.strip()
-        if s:
-            lst.append(s)
-    log.debug('splitcmdline -> %r' % (lst))
-    return lst
+    import warnings
+    warnings.warn('splitcmdline is deprecated; use shlex.split',
+                  DeprecationWarning)
+    return shlex.split(line)
 
-def test_splitcmdline():
-    l = splitcmdline('a   b  cc')
-    assert l==['a','b','cc'], repr(l)
-    l = splitcmdline('a')
-    assert l==['a'], repr(l)
-    l = splitcmdline('a "  b  cc"')
-    assert l==['a','"  b  cc"'], repr(l)
-    l = splitcmdline('"a bcc"  -h')
-    assert l==['"a bcc"','-h'], repr(l)
-    l = splitcmdline(r'"\"a \" bcc" -h')
-    assert l==[r'"\"a \" bcc"','-h'], repr(l)
-    l = splitcmdline(" 'a bcc'  -h")
-    assert l==["'a bcc'",'-h'], repr(l)
-    l = splitcmdline(r"'\'a \' bcc' -h")
-    assert l==[r"'\'a \' bcc'",'-h'], repr(l)
-
-############################################################
-
 def find_executable(exe, path=None, _cache={}):
     """Return full path of a executable or None.
 
@@ -379,7 +331,7 @@
         if is_sequence(command):
             argv = command[:]
         else:
-            argv = splitcmdline(command)
+            argv = shlex.split(command)
 
     if hasattr(os,'spawnvpe'):
         spawn_command = os.spawnvpe
@@ -632,7 +584,6 @@
 
 if __name__ == "__main__":
 
-    test_splitcmdline()
     test(use_tee=0)
     test(use_tee=1)
     test_execute_in(use_tee=0)

Modified: branches/maskedarray/numpy/distutils/fcompiler/intel.py
===================================================================
--- branches/maskedarray/numpy/distutils/fcompiler/intel.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/distutils/fcompiler/intel.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -114,7 +114,7 @@
                 opt.remove('-shared')
             except ValueError:
                 idx = 0
-            opt[idx:idx] = ['-dynamiclib', '-Wl,-undefined,dynamic_lookup']
+            opt[idx:idx] = ['-dynamiclib', '-Wl,-undefined,dynamic_lookup', '-Wl,-framework,Python']
         return opt
 
 class IntelItaniumFCompiler(IntelFCompiler):

Modified: branches/maskedarray/numpy/distutils/interactive.py
===================================================================
--- branches/maskedarray/numpy/distutils/interactive.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/distutils/interactive.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -50,7 +50,7 @@
     """ % (ccompiler, fcompiler, argv)
 
 
-from exec_command import splitcmdline
+import shlex
 
 def edit_argv(*args):
     argv = args[0]
@@ -62,7 +62,7 @@
     except EOFError:
         return
     if s:
-        argv[1:] = splitcmdline(s)
+        argv[1:] = shlex.split(s)
     return
 
 def interactive_sys_argv(argv):

Modified: branches/maskedarray/numpy/distutils/log.py
===================================================================
--- branches/maskedarray/numpy/distutils/log.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/distutils/log.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -18,9 +18,13 @@
     def _log(self, level, msg, args):
         if level >= self.threshold:
             if args:
-                print _global_color_map[level](msg % _fix_args(args))
-            else:
-                print _global_color_map[level](msg)
+                msg = msg % _fix_args(args)
+            if 0:
+                if msg.startswith('copying ') and msg.find(' -> ') != -1:
+                    return
+                if msg.startswith('byte-compiling '):
+                    return
+            print _global_color_map[level](msg)
             sys.stdout.flush()
 
     def good(self, msg, *args):

Modified: branches/maskedarray/numpy/doc/DISTUTILS.txt
===================================================================
--- branches/maskedarray/numpy/doc/DISTUTILS.txt	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/DISTUTILS.txt	2008-01-18 23:25:32 UTC (rev 4730)
@@ -399,7 +399,6 @@
 ---------------------------------------
 
 + ``get_pythonexe()``
-+ ``splitcmdline(line)``
 + ``find_executable(exe, path=None)``
 + ``exec_command( command, execute_in='', use_shell=None, use_tee=None, **env )``
 

Modified: branches/maskedarray/numpy/doc/HOWTO_DOCUMENT.txt
===================================================================
--- branches/maskedarray/numpy/doc/HOWTO_DOCUMENT.txt	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/HOWTO_DOCUMENT.txt	2008-01-18 23:25:32 UTC (rev 4730)
@@ -17,8 +17,14 @@
 
 Use a code checker:
  * `pylint <http://www.logilab.org/857>`__
+ * `pyflakes` easy_install pyflakes
  * `pep8.py <http://svn.browsershots.org/trunk/devtools/pep8/pep8.py>`__
 
+Common import standards::
+
+   import numpy as np
+   import scipy as sp
+
 Docstring Standard
 ------------------
 
@@ -27,7 +33,8 @@
 of the object (``object.__doc__``) and, for consistency, is surrounded by
 triple double quotes.
 
-It is highly desireable that both NumPy and SciPy_ follow a common
+It is highly desireable that both NumPy and SciPy_ and scikits to 
+follow a common
 convention for docstrings that provide for consistency while also
 allowing epydoc_ to produce nicely-formatted reference guides.  This
 document describes the current community consensus for this standard.
@@ -36,30 +43,28 @@
 
 Our docstring standard uses `reST
 <http://docutils.sourceforge.net/rst.html>`__ syntax and is rendered
-using epydoc_. The markup in this proposal is as basic as possible
-and, in particular, avoids the use of epydoc consolidated fields. This
-is both because there are a limited number of such fields, inadequate
-to our current needs, and because epydoc moves the fields to the end
-of the documentation, messing up the ordering.  Standard definition
-lists are used instead.  Likewise, epydoc moves headings and have an
-unwelcome size in the default style sheet, therefore they are also
-avoided.
+using something like epydoc_ (+ a pre-processor which understands the
+particular documentation style we are using).  The markup in this
+proposal is as basic as possible which still looks reasonable when the
+text is just printed.  In particular, it avoids too much cruft in the
+reST syntax and other epydoc_-isms.    
 
+The guiding principle is that human readers of the text itself are
+given precedence over contorting the docstring so that epydoc_
+produces nice output.  In order to improve the rendered output we
+should work on making pre-processor tools to assist epydoc_ or another
+similar tool, rather than making human readers conform to a particular
+computer-imposed style.
 
 Status
 ------
 
-We are currently trying to:
+We are currently trying to convert existing docstrings to the new
+format and write them for those that currently lack docstrings.
 
-1. Agree on docstring standards.
+We are also trying to improve the rendered output either using a
+pre-processor to epydoc or another tool similar to epydoc.
 
-2. Work with Ed loper to ensure that epydoc_ provides the functionality
-   we need.
-
-3. Convert existing docstrings to the new format and write them for
-   those that currently lack docstrings.
-
-
 Sections
 --------
 
@@ -84,7 +89,11 @@
    functions with a large number of keyword argument can still be well
    documented without cluttering the main parameters' list.
 
-6. **See also:**
+6. **Raises:**
+   An optional section detailing which errors get raised under what
+   conditions. 
+
+7. **See also:**
    An optional section used to refer to related code.  This section
    can be very useful, but should be used judiciously.  The goal is to
    direct users to other functions they may not be aware of, or have
@@ -92,17 +101,17 @@
    example).  Routines whose docstrings further explain parameters
    used by this function are good candidates.
 
-7. **Notes:**
+8. **Notes:**
    An optional section that provides additional information about the
    code, possibly including a discussion of the algorithm. This
    section may include mathematical equations, possibly written in
    `LaTeX <http://www.latex-project.org/>`__.
 
-8. **Examples:**
+9. **Examples:**
    An optional section for examples, using the `doctest
    <http://www.python.org/doc/lib/module-doctest.html>`__ format.  It
    can provide an inline mini-tutorial as well as additional
-   regression testing.  While optional, this section is strongly
+   regression testing.  While optional, this section is very strongly
    encouraged. You can run the tests by doing::
 
      >>> import doctest
@@ -123,15 +132,6 @@
 Common reST concepts
 --------------------
 
-A reST-documented module should define::
-
-  __docformat__ = 'restructuredtext en'
-
-at the top level in accordance with `PEP 258
-<http://www.python.org/dev/peps/pep-0258>`__.  Note that the
-``__docformat__`` variable in a package's ``__init__.py`` file does
-not apply to objects defined in subpackages and submodules.
-
 For paragraphs, indentation is significant and indicates indentation in the
 output. New paragraphs are marked with blank line.
 
@@ -159,8 +159,9 @@
   sudo python setup.py install
 
 The appearance of some elements can be changed in the epydoc.css
-style sheet. The list headings, i.e. *Parameters*:, are emphasized text, so
-their appearance is controlled by the definition of the <em>
+style sheet. 
+
+Emphasized text appearance can be controlled by the definition of the <em>
 tag. For instance, to make them bold, insert::
 
   em     {font-weight: bold;}
@@ -201,10 +202,10 @@
 
 Then, run epydoc::
 
-  $ epydoc example.txt
+  $ epydoc example.py
 
 The output is placed in ``./html``, and may be viewed by loading the
-``index.html`` file into your browser.
+``index.html`` file into your browser.   
 
 This document itself was written in ReStructuredText, and may be converted to
 HTML using::

Modified: branches/maskedarray/numpy/doc/example.py
===================================================================
--- branches/maskedarray/numpy/doc/example.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/example.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -15,64 +15,59 @@
 import scipy as sp             # imports should be at the top of the module
 import matplotlib as mpl       # imports should usually be on separate lines
 
-
-__docformat__ = "restructuredtext en"
-
-
 def foo(var1, var2, long_var_name='hi') :
     """One-line summary or signature.
 
     Several sentences providing an extended description. You can put
     text in mono-spaced type like so: ``var``.
 
-    *Parameters*:
+    Parameters
+    ----------
+    var1 : array_like
+        Array_like means all those objects -- lists, nested lists, etc. --
+        that can be converted to an array.
+    var2 : integer
+        Write out the full type
+    long_variable_name : {'hi', 'ho'}, optional
+        Choices in brackets, default first when optional.
 
-        var1 : {array_like}
-            Array_like means all those objects -- lists, nested lists, etc. --
-            that can be converted to an array.
-        var2 : {integer}
-            Write out the full type
-        long_variable_name : {'hi', 'ho'}, optional
-            Choices in brackets, default first when optional.
+    Returns
+    -------
+    named : type
+        Explanation
+    list
+        Explanation
+    of
+        Explanation
+    outputs
+        even more explaining
 
-    *Returns*:
+    Other Parameters
+    ----------------
+    only_seldom_used_keywords : type
+        Explanation
+    common_parametrs_listed_above : type
+        Explanation
 
-        named : {type}
-            Explanation
-        list
-            Explanation
-        of
-            Explanation
-        outputs
-            even more explaining
+    See Also
+    --------    
+    otherfunc : relationship (optional)
+    newfunc : relationship (optional)
 
-    *Other Parameters*:
+    Notes
+    -----
+    Notes about the implementation algorithm (if needed).
 
-        only_seldom_used_keywords : type
-            Explanation
-        common_parametrs_listed_above : type
-            Explanation
+    This can have multiple paragraphs as can all sections.
 
-    *See Also*:
+    Examples
+    --------
+    examples in doctest format
 
-        `otherfunc` : relationship (optional)
+    >>> a=[1,2,3]
+    >>> [x + 3 for x in a]
+    [4, 5, 6]
 
-        `newfunc` : relationship (optional)
-
-    *Notes*
-
-        Notes about the implementation algorithm (if needed).
-
-        This can have multiple paragraphs as can all sections.
-
-    *Examples*
-
-        examples in doctest format
-
-        >>> a=[1,2,3]
-        >>> [x + 3 for x in a]
-        [4, 5, 6]
-
     """
 
     pass

Modified: branches/maskedarray/numpy/doc/html/epydoc.css
===================================================================
--- branches/maskedarray/numpy/doc/html/epydoc.css	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/epydoc.css	2008-01-18 23:25:32 UTC (rev 4730)
@@ -28,6 +28,8 @@
 h3                          { font-size: +110%; font-style: italic;
                               font-weight: normal; }
 code                        { font-size: 100%; }
+/* N.B.: class, not pseudoclass */
+a.link                      { font-family: monospace; }
  
 /* Page Header & Footer
  *   - The standard page header consists of a navigation bar (with
@@ -158,6 +160,11 @@
 .summary-sig-arg            { color: #006040; }
 .summary-sig-default        { color: #501800; }
 
+/* Subclass list
+ */
+ul.subclass-list { display: inline; }
+ul.subclass-list li { display: inline; }
+
 /* To render variables, classes etc. like functions */
 table.summary .summary-name { color: #006080; font-weight: bold;
                               font-family: monospace; }

Modified: branches/maskedarray/numpy/doc/html/epydoc.js
===================================================================
--- branches/maskedarray/numpy/doc/html/epydoc.js	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/epydoc.js	2008-01-18 23:25:32 UTC (rev 4730)
@@ -17,8 +17,11 @@
           if (elts[i].className == "private") {
             elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
           }
+          else if (elts[i].className == "public") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"block":"none");
+          }
         }
-        // Update all table rowss containing private objects.  Note, we
+        // Update all table rows containing private objects.  Note, we
         // use "" instead of "block" becaue IE & firefox disagree on what
         // this should be (block vs table-row), and "" just gives the
         // default for both browsers.
@@ -33,7 +36,7 @@
         for(var i=0; i<elts.length; i++) {
           if (elts[i].className == "private") {
             elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?
-                                        "none":"list-item");
+                                        "none":"");
           }
         }
         // Update all list items containing private objects.
@@ -46,6 +49,16 @@
         // Set a cookie to remember the current option.
         document.cookie = "EpydocPrivate="+cmd;
       }
+function show_private() {
+        var elts = document.getElementsByTagName("a");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "privatelink") {
+            cmd = elts[i].innerHTML;
+            if (cmd && cmd.substr(0,4)=="show")
+                toggle_private();
+          }
+        }
+      }
 function getCookie(name) {
         var dc = document.cookie;
         var prefix = name + "=";

Modified: branches/maskedarray/numpy/doc/html/example-module.html
===================================================================
--- branches/maskedarray/numpy/doc/html/example-module.html	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/example-module.html	2008-01-18 23:25:32 UTC (rev 4730)
@@ -56,12 +56,12 @@
 <!-- ==================== MODULE DESCRIPTION ==================== -->
 <h1 class="epydoc">Module example</h1><p class="nomargin-top"><span class="codelink"><a href="example-pysrc.html">source code</a></span></p>
 <p>This is the docstring for the example.py module.  Modules names should
-have short, all-lowercase names.  The module name may have underscores if
-this improves readability.</p>
-<p>Every module should have a docstring at the very top of the file.  The
-module's docstring may extend over multiple lines.  If your docstring does
-extend over multiple lines, the closing three quotation marks must be on
-a line by itself, preferably preceeded by a blank line.</p>
+  have short, all-lowercase names.  The module name may have underscores if
+  this improves readability.</p>
+  <p>Every module should have a docstring at the very top of the file.  The
+  module's docstring may extend over multiple lines.  If your docstring 
+  does extend over multiple lines, the closing three quotation marks must 
+  be on a line by itself, preferably preceeded by a blank line.</p>
 
 <!-- ==================== FUNCTIONS ==================== -->
 <a name="section-Functions"></a>
@@ -166,63 +166,63 @@
   </td><td align="right" valign="top"
     ><span class="codelink"><a href="example-pysrc.html#foo">source code</a></span> 
     </td>
-  </table>
+  </tr></table>
   
-  <p>One-line summary or signature.</p>
-<p>Several sentences providing an extended description. You can put
-text in mono-spaced type like so: <tt class="rst-docutils literal"><span class="pre">var</span></tt>.</p>
-<p><em>Parameters</em>:</p>
-<blockquote>
-<dl class="rst-docutils">
-<dt>var1 <span class="classifier-delimiter">:</span> <span class="rst-classifier">{array_like}</span></dt>
-<dd>Array_like means all those objects -- lists, nested lists, etc. --
-that can be converted to an array.</dd>
-<dt>var2 <span class="classifier-delimiter">:</span> <span class="rst-classifier">{integer}</span></dt>
-<dd>Write out the full type</dd>
-<dt>long_variable_name <span class="classifier-delimiter">:</span> <span class="rst-classifier">{'hi', 'ho'}, optional</span></dt>
-<dd>Choices in brackets, default first when optional.</dd>
-</dl>
-</blockquote>
-<p><em>Returns</em>:</p>
-<blockquote>
-<dl class="rst-docutils">
-<dt>named <span class="classifier-delimiter">:</span> <span class="rst-classifier">{type}</span></dt>
-<dd>Explanation</dd>
-<dt>list</dt>
-<dd>Explanation</dd>
-<dt>of</dt>
-<dd>Explanation</dd>
-<dt>outputs</dt>
-<dd>even more explaining</dd>
-</dl>
-</blockquote>
-<p><em>Other Parameters</em>:</p>
-<blockquote>
-<dl class="rst-docutils">
-<dt>only_seldom_used_keywords <span class="classifier-delimiter">:</span> <span class="rst-classifier">type</span></dt>
-<dd>Explanation</dd>
-<dt>common_parametrs_listed_above <span class="classifier-delimiter">:</span> <span class="rst-classifier">type</span></dt>
-<dd>Explanation</dd>
-</dl>
-</blockquote>
-<p><em>See Also</em>:</p>
-<blockquote>
-<p><a href="example-module.html#otherfunc" class="link">otherfunc</a> : relationship (optional)</p>
-<p><a href="example-module.html#newfunc" class="link">newfunc</a> : relationship (optional)</p>
-</blockquote>
-<p><em>Notes</em></p>
-<blockquote>
-<p>Notes about the implementation algorithm (if needed).</p>
-<p>This can have multiple paragraphs as can all sections.</p>
-</blockquote>
-<p><em>Examples</em></p>
-<blockquote>
-<p>examples in doctest format</p>
-<pre class="py-doctest">
-<span class="py-prompt">>>> </span>a=[1,2,3]
-<span class="py-prompt">>>> </span>[x + 3 <span class="py-keyword">for</span> x <span class="py-keyword">in</span> a]
-<span class="py-output">[4, 5, 6]</span></pre>
-</blockquote>
+  <pre class="literalblock">
+One-line summary or signature.
+
+Several sentences providing an extended description. You can put
+text in mono-spaced type like so: ``var``.
+
+Parameters
+----------
+var1 : array_like
+    Array_like means all those objects -- lists, nested lists, etc. --
+    that can be converted to an array.
+var2 : integer
+    Write out the full type
+long_variable_name : {'hi', 'ho'}, optional
+    Choices in brackets, default first when optional.
+
+Returns
+-------
+named : type
+    Explanation
+list
+    Explanation
+of
+    Explanation
+outputs
+    even more explaining
+
+Other Parameters
+----------------
+only_seldom_used_keywords : type
+    Explanation
+common_parametrs_listed_above : type
+    Explanation
+
+See Also
+--------    
+otherfunc : relationship (optional)
+newfunc : relationship (optional)
+
+Notes
+-----
+Notes about the implementation algorithm (if needed).
+
+This can have multiple paragraphs as can all sections.
+
+Examples
+--------
+
+examples in doctest format
+
+>>> a=[1,2,3]
+>>> [x + 3 for x in a]
+[4, 5, 6]
+
+</pre>
   <dl class="fields">
   </dl>
 </td></tr></table>
@@ -239,10 +239,10 @@
   </td><td align="right" valign="top"
     ><span class="codelink"><a href="example-pysrc.html#newfunc">source code</a></span> 
     </td>
-  </table>
+  </tr></table>
   
   <p>Do nothing.</p>
-<p>I never saw a purple cow.</p>
+  <p>I never saw a purple cow.</p>
   <dl class="fields">
   </dl>
 </td></tr></table>
@@ -259,10 +259,10 @@
   </td><td align="right" valign="top"
     ><span class="codelink"><a href="example-pysrc.html#otherfunc">source code</a></span> 
     </td>
-  </table>
+  </tr></table>
   
   <p>Do nothing.</p>
-<p>I never hope to see one.</p>
+  <p>I never hope to see one.</p>
   <dl class="fields">
   </dl>
 </td></tr></table>
@@ -294,10 +294,11 @@
 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
   <tr>
     <td align="left" class="footer">
-    Generated by Epydoc 3.0beta1 on Sun Sep 23 13:30:28 2007
+    Generated by Epydoc 3.0beta1 on Fri Dec 28 00:50:17 2007
     </td>
     <td align="right" class="footer">
-      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
     </td>
   </tr>
 </table>
@@ -308,9 +309,8 @@
   // javascript is turned off then we want them to be
   // visible); but by default, we want to hide them.  So hide
   // them unless we have a cookie that says to show them.
-  checkCookie()
+  checkCookie();
   // -->
 </script>
-  
 </body>
 </html>

Modified: branches/maskedarray/numpy/doc/html/example-pysrc.html
===================================================================
--- branches/maskedarray/numpy/doc/html/example-pysrc.html	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/example-pysrc.html	2008-01-18 23:25:32 UTC (rev 4730)
@@ -55,105 +55,101 @@
 </table>
 <h1 class="epydoc">Source Code for <a href="example-module.html">Module example</a></h1>
 <pre class="py-src">
-<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-docstring">"""This is the docstring for the example.py module.  Modules names should</tt> </tt>
-<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-docstring">have short, all-lowercase names.  The module name may have underscores if</tt> </tt>
-<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-docstring">this improves readability.</tt> </tt>
-<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring">Every module should have a docstring at the very top of the file.  The</tt> </tt>
-<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring">module's docstring may extend over multiple lines.  If your docstring does</tt> </tt>
-<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring">extend over multiple lines, the closing three quotation marks must be on</tt> </tt>
-<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-docstring">a line by itself, preferably preceeded by a blank line.</tt> </tt>
-<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
-<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"> </tt>
-<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt>                      <tt class="py-comment"># standard library imports first</tt> </tt>
-<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
-<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">numpy</tt> <tt class="py-keyword">as</tt> <tt class="py-name">np</tt>             <tt class="py-comment"># related third party imports next</tt> </tt>
-<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">scipy</tt> <tt class="py-keyword">as</tt> <tt class="py-name">sp</tt>             <tt class="py-comment"># imports should be at the top of the module</tt> </tt>
-<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">matplotlib</tt> <tt class="py-keyword">as</tt> <tt class="py-name">mpl</tt>       <tt class="py-comment"># imports should usually be on separate lines</tt> </tt>
-<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"> </tt>
-<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"> </tt>
-<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-name">__docformat__</tt> <tt class="py-op">=</tt> <tt class="py-string">"restructuredtext en"</tt> </tt>
-<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"> </tt>
-<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"> </tt>
-<a name="foo"></a><div id="foo-def"><a name="L22"></a><tt class="py-lineno"> 22</tt> <a class="py-toggle" href="#" id="foo-toggle" onclick="return toggle('foo');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="example-module.html#foo">foo</a><tt class="py-op">(</tt><tt class="py-param">var1</tt><tt class="py-op">,</tt> <tt class="py-param">var2</tt><tt class="py-op">,</tt> <tt class="py-param">long_var_name</tt><tt class="py-op">=</tt><tt class="py-string">'hi'</tt><tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
-</div><div id="foo-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="foo-expanded"><a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line">    <tt class="py-docstring">"""One-line summary or signature.</tt> </tt>
-<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">    Several sentences providing an extended description. You can put</tt> </tt>
-<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring">    text in mono-spaced type like so: ``var``.</tt> </tt>
-<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">    *Parameters*:</tt> </tt>
-<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">        var1 : {array_like}</tt> </tt>
-<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">            Array_like means all those objects -- lists, nested lists, etc. --</tt> </tt>
-<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring">            that can be converted to an array.</tt> </tt>
-<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring">        var2 : {integer}</tt> </tt>
-<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-docstring">            Write out the full type</tt> </tt>
-<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-docstring">        long_variable_name : {'hi', 'ho'}, optional</tt> </tt>
-<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-docstring">            Choices in brackets, default first when optional.</tt> </tt>
-<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-docstring">    *Returns*:</tt> </tt>
-<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring">        named : {type}</tt> </tt>
-<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">            Explanation</tt> </tt>
-<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">        list</tt> </tt>
-<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">            Explanation</tt> </tt>
-<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">        of</tt> </tt>
-<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring">            Explanation</tt> </tt>
-<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring">        outputs</tt> </tt>
-<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-docstring">            even more explaining</tt> </tt>
-<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt class="py-docstring">    *Other Parameters*:</tt> </tt>
-<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-docstring">        only_seldom_used_keywords : type</tt> </tt>
-<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-docstring">            Explanation</tt> </tt>
-<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"><tt class="py-docstring">        common_parametrs_listed_above : type</tt> </tt>
-<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt class="py-docstring">            Explanation</tt> </tt>
-<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"><tt class="py-docstring">    *See Also*:</tt> </tt>
-<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-docstring">        `otherfunc` : relationship (optional)</tt> </tt>
-<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-docstring">        `newfunc` : relationship (optional)</tt> </tt>
-<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-docstring">    *Notes*</tt> </tt>
-<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-docstring">        Notes about the implementation algorithm (if needed).</tt> </tt>
-<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-docstring">        This can have multiple paragraphs as can all sections.</tt> </tt>
-<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"><tt class="py-docstring">    *Examples*</tt> </tt>
-<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"><tt class="py-docstring">        examples in doctest format</tt> </tt>
-<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-docstring">        >>> a=[1,2,3]</tt> </tt>
-<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-docstring">        >>> [x + 3 for x in a]</tt> </tt>
-<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-docstring">        [4, 5, 6]</tt> </tt>
-<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
-<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"> </tt>
-<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
-</div><a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"> </tt>
-<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"> </tt>
-<a name="newfunc"></a><div id="newfunc-def"><a name="L81"></a><tt class="py-lineno"> 81</tt> <a class="py-toggle" href="#" id="newfunc-toggle" onclick="return toggle('newfunc');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="example-module.html#newfunc">newfunc</a><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
-</div><div id="newfunc-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="newfunc-expanded"><a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">    <tt class="py-docstring">"""Do nothing.</tt> </tt>
-<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line"><tt class="py-docstring">    I never saw a purple cow.</tt> </tt>
-<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
-<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"> </tt>
-<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
-</div><a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"> </tt>
-<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"> </tt>
-<a name="otherfunc"></a><div id="otherfunc-def"><a name="L91"></a><tt class="py-lineno"> 91</tt> <a class="py-toggle" href="#" id="otherfunc-toggle" onclick="return toggle('otherfunc');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="example-module.html#otherfunc">otherfunc</a><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
-</div><div id="otherfunc-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="otherfunc-expanded"><a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">    <tt class="py-docstring">"""Do nothing.</tt> </tt>
-<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-docstring">    I never hope to see one.</tt> </tt>
-<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
-<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line"> </tt>
-<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
-</div><a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line"> </tt><script type="text/javascript">
+<a name="L1"></a><tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-docstring">"""This is the docstring for the example.py module.  Modules names should</tt> </tt>
+<a name="L2"></a><tt class="py-lineno"> 2</tt>  <tt class="py-line"><tt class="py-docstring">have short, all-lowercase names.  The module name may have underscores if</tt> </tt>
+<a name="L3"></a><tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-docstring">this improves readability.</tt> </tt>
+<a name="L4"></a><tt class="py-lineno"> 4</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L5"></a><tt class="py-lineno"> 5</tt>  <tt class="py-line"><tt class="py-docstring">Every module should have a docstring at the very top of the file.  The</tt> </tt>
+<a name="L6"></a><tt class="py-lineno"> 6</tt>  <tt class="py-line"><tt class="py-docstring">module's docstring may extend over multiple lines.  If your docstring does</tt> </tt>
+<a name="L7"></a><tt class="py-lineno"> 7</tt>  <tt class="py-line"><tt class="py-docstring">extend over multiple lines, the closing three quotation marks must be on</tt> </tt>
+<a name="L8"></a><tt class="py-lineno"> 8</tt>  <tt class="py-line"><tt class="py-docstring">a line by itself, preferably preceeded by a blank line.</tt> </tt>
+<a name="L9"></a><tt class="py-lineno"> 9</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L10"></a><tt class="py-lineno">10</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
+<a name="L11"></a><tt class="py-lineno">11</tt>  <tt class="py-line"> </tt>
+<a name="L12"></a><tt class="py-lineno">12</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt>                      <tt class="py-comment"># standard library imports first</tt> </tt>
+<a name="L13"></a><tt class="py-lineno">13</tt>  <tt class="py-line"> </tt>
+<a name="L14"></a><tt class="py-lineno">14</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">numpy</tt> <tt class="py-keyword">as</tt> <tt class="py-name">np</tt>             <tt class="py-comment"># related third party imports next</tt> </tt>
+<a name="L15"></a><tt class="py-lineno">15</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">scipy</tt> <tt class="py-keyword">as</tt> <tt class="py-name">sp</tt>             <tt class="py-comment"># imports should be at the top of the module</tt> </tt>
+<a name="L16"></a><tt class="py-lineno">16</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">matplotlib</tt> <tt class="py-keyword">as</tt> <tt class="py-name">mpl</tt>       <tt class="py-comment"># imports should usually be on separate lines</tt> </tt>
+<a name="L17"></a><tt class="py-lineno">17</tt>  <tt class="py-line"> </tt>
+<a name="foo"></a><div id="foo-def"><a name="L18"></a><tt class="py-lineno">18</tt> <a class="py-toggle" href="#" id="foo-toggle" onclick="return toggle('foo');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="example-module.html#foo">foo</a><tt class="py-op">(</tt><tt class="py-param">var1</tt><tt class="py-op">,</tt> <tt class="py-param">var2</tt><tt class="py-op">,</tt> <tt class="py-param">long_var_name</tt><tt class="py-op">=</tt><tt class="py-string">'hi'</tt><tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
+</div><div id="foo-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="foo-expanded"><a name="L19"></a><tt class="py-lineno">19</tt>  <tt class="py-line">    <tt class="py-docstring">"""One-line summary or signature.</tt> </tt>
+<a name="L20"></a><tt class="py-lineno">20</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L21"></a><tt class="py-lineno">21</tt>  <tt class="py-line"><tt class="py-docstring">    Several sentences providing an extended description. You can put</tt> </tt>
+<a name="L22"></a><tt class="py-lineno">22</tt>  <tt class="py-line"><tt class="py-docstring">    text in mono-spaced type like so: ``var``.</tt> </tt>
+<a name="L23"></a><tt class="py-lineno">23</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L24"></a><tt class="py-lineno">24</tt>  <tt class="py-line"><tt class="py-docstring">    Parameters</tt> </tt>
+<a name="L25"></a><tt class="py-lineno">25</tt>  <tt class="py-line"><tt class="py-docstring">    ----------</tt> </tt>
+<a name="L26"></a><tt class="py-lineno">26</tt>  <tt class="py-line"><tt class="py-docstring">    var1 : array_like</tt> </tt>
+<a name="L27"></a><tt class="py-lineno">27</tt>  <tt class="py-line"><tt class="py-docstring">        Array_like means all those objects -- lists, nested lists, etc. --</tt> </tt>
+<a name="L28"></a><tt class="py-lineno">28</tt>  <tt class="py-line"><tt class="py-docstring">        that can be converted to an array.</tt> </tt>
+<a name="L29"></a><tt class="py-lineno">29</tt>  <tt class="py-line"><tt class="py-docstring">    var2 : integer</tt> </tt>
+<a name="L30"></a><tt class="py-lineno">30</tt>  <tt class="py-line"><tt class="py-docstring">        Write out the full type</tt> </tt>
+<a name="L31"></a><tt class="py-lineno">31</tt>  <tt class="py-line"><tt class="py-docstring">    long_variable_name : {'hi', 'ho'}, optional</tt> </tt>
+<a name="L32"></a><tt class="py-lineno">32</tt>  <tt class="py-line"><tt class="py-docstring">        Choices in brackets, default first when optional.</tt> </tt>
+<a name="L33"></a><tt class="py-lineno">33</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L34"></a><tt class="py-lineno">34</tt>  <tt class="py-line"><tt class="py-docstring">    Returns</tt> </tt>
+<a name="L35"></a><tt class="py-lineno">35</tt>  <tt class="py-line"><tt class="py-docstring">    -------</tt> </tt>
+<a name="L36"></a><tt class="py-lineno">36</tt>  <tt class="py-line"><tt class="py-docstring">    named : type</tt> </tt>
+<a name="L37"></a><tt class="py-lineno">37</tt>  <tt class="py-line"><tt class="py-docstring">        Explanation</tt> </tt>
+<a name="L38"></a><tt class="py-lineno">38</tt>  <tt class="py-line"><tt class="py-docstring">    list</tt> </tt>
+<a name="L39"></a><tt class="py-lineno">39</tt>  <tt class="py-line"><tt class="py-docstring">        Explanation</tt> </tt>
+<a name="L40"></a><tt class="py-lineno">40</tt>  <tt class="py-line"><tt class="py-docstring">    of</tt> </tt>
+<a name="L41"></a><tt class="py-lineno">41</tt>  <tt class="py-line"><tt class="py-docstring">        Explanation</tt> </tt>
+<a name="L42"></a><tt class="py-lineno">42</tt>  <tt class="py-line"><tt class="py-docstring">    outputs</tt> </tt>
+<a name="L43"></a><tt class="py-lineno">43</tt>  <tt class="py-line"><tt class="py-docstring">        even more explaining</tt> </tt>
+<a name="L44"></a><tt class="py-lineno">44</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L45"></a><tt class="py-lineno">45</tt>  <tt class="py-line"><tt class="py-docstring">    Other Parameters</tt> </tt>
+<a name="L46"></a><tt class="py-lineno">46</tt>  <tt class="py-line"><tt class="py-docstring">    ----------------</tt> </tt>
+<a name="L47"></a><tt class="py-lineno">47</tt>  <tt class="py-line"><tt class="py-docstring">    only_seldom_used_keywords : type</tt> </tt>
+<a name="L48"></a><tt class="py-lineno">48</tt>  <tt class="py-line"><tt class="py-docstring">        Explanation</tt> </tt>
+<a name="L49"></a><tt class="py-lineno">49</tt>  <tt class="py-line"><tt class="py-docstring">    common_parametrs_listed_above : type</tt> </tt>
+<a name="L50"></a><tt class="py-lineno">50</tt>  <tt class="py-line"><tt class="py-docstring">        Explanation</tt> </tt>
+<a name="L51"></a><tt class="py-lineno">51</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L52"></a><tt class="py-lineno">52</tt>  <tt class="py-line"><tt class="py-docstring">    See Also</tt> </tt>
+<a name="L53"></a><tt class="py-lineno">53</tt>  <tt class="py-line"><tt class="py-docstring">    --------    </tt> </tt>
+<a name="L54"></a><tt class="py-lineno">54</tt>  <tt class="py-line"><tt class="py-docstring">    otherfunc : relationship (optional)</tt> </tt>
+<a name="L55"></a><tt class="py-lineno">55</tt>  <tt class="py-line"><tt class="py-docstring">    newfunc : relationship (optional)</tt> </tt>
+<a name="L56"></a><tt class="py-lineno">56</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L57"></a><tt class="py-lineno">57</tt>  <tt class="py-line"><tt class="py-docstring">    Notes</tt> </tt>
+<a name="L58"></a><tt class="py-lineno">58</tt>  <tt class="py-line"><tt class="py-docstring">    -----</tt> </tt>
+<a name="L59"></a><tt class="py-lineno">59</tt>  <tt class="py-line"><tt class="py-docstring">    Notes about the implementation algorithm (if needed).</tt> </tt>
+<a name="L60"></a><tt class="py-lineno">60</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L61"></a><tt class="py-lineno">61</tt>  <tt class="py-line"><tt class="py-docstring">    This can have multiple paragraphs as can all sections.</tt> </tt>
+<a name="L62"></a><tt class="py-lineno">62</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L63"></a><tt class="py-lineno">63</tt>  <tt class="py-line"><tt class="py-docstring">    Examples</tt> </tt>
+<a name="L64"></a><tt class="py-lineno">64</tt>  <tt class="py-line"><tt class="py-docstring">    --------</tt> </tt>
+<a name="L65"></a><tt class="py-lineno">65</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L66"></a><tt class="py-lineno">66</tt>  <tt class="py-line"><tt class="py-docstring">    examples in doctest format</tt> </tt>
+<a name="L67"></a><tt class="py-lineno">67</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L68"></a><tt class="py-lineno">68</tt>  <tt class="py-line"><tt class="py-docstring">    >>> a=[1,2,3]</tt> </tt>
+<a name="L69"></a><tt class="py-lineno">69</tt>  <tt class="py-line"><tt class="py-docstring">    >>> [x + 3 for x in a]</tt> </tt>
+<a name="L70"></a><tt class="py-lineno">70</tt>  <tt class="py-line"><tt class="py-docstring">    [4, 5, 6]</tt> </tt>
+<a name="L71"></a><tt class="py-lineno">71</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L72"></a><tt class="py-lineno">72</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
+<a name="L73"></a><tt class="py-lineno">73</tt>  <tt class="py-line"> </tt>
+<a name="L74"></a><tt class="py-lineno">74</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
+</div><a name="L75"></a><tt class="py-lineno">75</tt>  <tt class="py-line"> </tt>
+<a name="L76"></a><tt class="py-lineno">76</tt>  <tt class="py-line"> </tt>
+<a name="newfunc"></a><div id="newfunc-def"><a name="L77"></a><tt class="py-lineno">77</tt> <a class="py-toggle" href="#" id="newfunc-toggle" onclick="return toggle('newfunc');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="example-module.html#newfunc">newfunc</a><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
+</div><div id="newfunc-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="newfunc-expanded"><a name="L78"></a><tt class="py-lineno">78</tt>  <tt class="py-line">    <tt class="py-docstring">"""Do nothing.</tt> </tt>
+<a name="L79"></a><tt class="py-lineno">79</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L80"></a><tt class="py-lineno">80</tt>  <tt class="py-line"><tt class="py-docstring">    I never saw a purple cow.</tt> </tt>
+<a name="L81"></a><tt class="py-lineno">81</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L82"></a><tt class="py-lineno">82</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
+<a name="L83"></a><tt class="py-lineno">83</tt>  <tt class="py-line"> </tt>
+<a name="L84"></a><tt class="py-lineno">84</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
+</div><a name="L85"></a><tt class="py-lineno">85</tt>  <tt class="py-line"> </tt>
+<a name="L86"></a><tt class="py-lineno">86</tt>  <tt class="py-line"> </tt>
+<a name="otherfunc"></a><div id="otherfunc-def"><a name="L87"></a><tt class="py-lineno">87</tt> <a class="py-toggle" href="#" id="otherfunc-toggle" onclick="return toggle('otherfunc');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="example-module.html#otherfunc">otherfunc</a><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">:</tt> </tt>
+</div><div id="otherfunc-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="otherfunc-expanded"><a name="L88"></a><tt class="py-lineno">88</tt>  <tt class="py-line">    <tt class="py-docstring">"""Do nothing.</tt> </tt>
+<a name="L89"></a><tt class="py-lineno">89</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L90"></a><tt class="py-lineno">90</tt>  <tt class="py-line"><tt class="py-docstring">    I never hope to see one.</tt> </tt>
+<a name="L91"></a><tt class="py-lineno">91</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L92"></a><tt class="py-lineno">92</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
+<a name="L93"></a><tt class="py-lineno">93</tt>  <tt class="py-line"> </tt>
+<a name="L94"></a><tt class="py-lineno">94</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
+</div><a name="L95"></a><tt class="py-lineno">95</tt>  <tt class="py-line"> </tt><script type="text/javascript">
 <!--
 expandto(location.href);
 // -->
@@ -186,10 +182,11 @@
 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
   <tr>
     <td align="left" class="footer">
-    Generated by Epydoc 3.0beta1 on Sun Sep 23 13:30:28 2007
+    Generated by Epydoc 3.0beta1 on Fri Dec 28 00:50:17 2007
     </td>
     <td align="right" class="footer">
-      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
     </td>
   </tr>
 </table>
@@ -200,9 +197,8 @@
   // javascript is turned off then we want them to be
   // visible); but by default, we want to hide them.  So hide
   // them unless we have a cookie that says to show them.
-  checkCookie()
+  checkCookie();
   // -->
 </script>
-  
 </body>
 </html>

Modified: branches/maskedarray/numpy/doc/html/help.html
===================================================================
--- branches/maskedarray/numpy/doc/html/help.html	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/help.html	2008-01-18 23:25:32 UTC (rev 4730)
@@ -246,10 +246,11 @@
 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
   <tr>
     <td align="left" class="footer">
-    Generated by Epydoc 3.0beta1 on Sun Sep 23 13:30:28 2007
+    Generated by Epydoc 3.0beta1 on Fri Dec 28 00:50:17 2007
     </td>
     <td align="right" class="footer">
-      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
     </td>
   </tr>
 </table>
@@ -260,9 +261,8 @@
   // javascript is turned off then we want them to be
   // visible); but by default, we want to hide them.  So hide
   // them unless we have a cookie that says to show them.
-  checkCookie()
+  checkCookie();
   // -->
 </script>
-  
 </body>
 </html>

Modified: branches/maskedarray/numpy/doc/html/identifier-index.html
===================================================================
--- branches/maskedarray/numpy/doc/html/identifier-index.html	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/identifier-index.html	2008-01-18 23:25:32 UTC (rev 4730)
@@ -158,10 +158,11 @@
 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
   <tr>
     <td align="left" class="footer">
-    Generated by Epydoc 3.0beta1 on Sun Sep 23 13:30:28 2007
+    Generated by Epydoc 3.0beta1 on Fri Dec 28 00:50:17 2007
     </td>
     <td align="right" class="footer">
-      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
     </td>
   </tr>
 </table>
@@ -172,9 +173,8 @@
   // javascript is turned off then we want them to be
   // visible); but by default, we want to hide them.  So hide
   // them unless we have a cookie that says to show them.
-  checkCookie()
+  checkCookie();
   // -->
 </script>
-  
 </body>
 </html>

Modified: branches/maskedarray/numpy/doc/html/module-tree.html
===================================================================
--- branches/maskedarray/numpy/doc/html/module-tree.html	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/module-tree.html	2008-01-18 23:25:32 UTC (rev 4730)
@@ -79,10 +79,11 @@
 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
   <tr>
     <td align="left" class="footer">
-    Generated by Epydoc 3.0beta1 on Sun Sep 23 13:30:28 2007
+    Generated by Epydoc 3.0beta1 on Fri Dec 28 00:50:17 2007
     </td>
     <td align="right" class="footer">
-      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
     </td>
   </tr>
 </table>
@@ -93,9 +94,8 @@
   // javascript is turned off then we want them to be
   // visible); but by default, we want to hide them.  So hide
   // them unless we have a cookie that says to show them.
-  checkCookie()
+  checkCookie();
   // -->
 </script>
-  
 </body>
 </html>

Modified: branches/maskedarray/numpy/doc/html/toc-everything.html
===================================================================
--- branches/maskedarray/numpy/doc/html/toc-everything.html	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/toc-everything.html	2008-01-18 23:25:32 UTC (rev 4730)
@@ -26,9 +26,8 @@
   // javascript is turned off then we want them to be
   // visible); but by default, we want to hide them.  So hide
   // them unless we have a cookie that says to show them.
-  checkCookie()
+  checkCookie();
   // -->
 </script>
-  
 </body>
 </html>

Modified: branches/maskedarray/numpy/doc/html/toc-example-module.html
===================================================================
--- branches/maskedarray/numpy/doc/html/toc-example-module.html	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/toc-example-module.html	2008-01-18 23:25:32 UTC (rev 4730)
@@ -26,9 +26,8 @@
   // javascript is turned off then we want them to be
   // visible); but by default, we want to hide them.  So hide
   // them unless we have a cookie that says to show them.
-  checkCookie()
+  checkCookie();
   // -->
 </script>
-  
 </body>
 </html>

Modified: branches/maskedarray/numpy/doc/html/toc.html
===================================================================
--- branches/maskedarray/numpy/doc/html/toc.html	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/html/toc.html	2008-01-18 23:25:32 UTC (rev 4730)
@@ -26,9 +26,8 @@
   // javascript is turned off then we want them to be
   // visible); but by default, we want to hide them.  So hide
   // them unless we have a cookie that says to show them.
-  checkCookie()
+  checkCookie();
   // -->
 </script>
-  
 </body>
 </html>

Modified: branches/maskedarray/numpy/doc/swig/test/testArray.py
===================================================================
--- branches/maskedarray/numpy/doc/swig/test/testArray.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/swig/test/testArray.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -7,10 +7,12 @@
 import unittest
 
 # Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
-if major == 0: BadListError = TypeError
-else:          BadListError = ValueError
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
+if major == 0:
+    BadListError = TypeError
+else:
+    BadListError = ValueError
 
 # Add the distutils-generated build directory to the python search path and then
 # import the extension module
@@ -38,7 +40,7 @@
 
     def testConstructor2(self):
         "Test Array1 array constructor"
-        na = N.arange(self.length)
+        na = np.arange(self.length)
         aa = Array.Array1(na)
         self.failUnless(isinstance(aa, Array.Array1))
 
@@ -68,7 +70,7 @@
 
     def testResize1(self):
         "Test Array1 resize method, array"
-        a = N.zeros((2*self.length,), dtype='l')
+        a = np.zeros((2*self.length,), dtype='l')
         self.array1.resize(a)
         self.failUnless(len(self.array1) == len(a))
 
@@ -114,7 +116,7 @@
         "Test Array1 view method"
         for i in range(self.array1.length()): self.array1[i] = i+1
         a = self.array1.view()
-        self.failUnless(isinstance(a, N.ndarray))
+        self.failUnless(isinstance(a, np.ndarray))
         self.failUnless(len(a) == self.length)
         self.failUnless((a == [1,2,3,4,5]).all())
 
@@ -139,7 +141,7 @@
 
     def testConstructor2(self):
         "Test Array2 array constructor"
-        na = N.zeros((3,4), dtype="l")
+        na = np.zeros((3,4), dtype="l")
         aa = Array.Array2(na)
         self.failUnless(isinstance(aa, Array.Array2))
 
@@ -180,7 +182,7 @@
 
     #def testResize1(self):
     #    "Test Array2 resize method, array"
-    #    a = N.zeros((2*self.nrows, 2*self.ncols), dtype='l')
+    #    a = np.zeros((2*self.nrows, 2*self.ncols), dtype='l')
     #    self.array2.resize(a)
     #    self.failUnless(len(self.array2) == len(a))
 
@@ -197,7 +199,7 @@
         m = self.nrows
         n = self.ncols
         array1 = [ ]
-        a = N.arange(n, dtype="l")
+        a = np.arange(n, dtype="l")
         for i in range(m):
             array1.append(Array.Array1(i*a))
         for i in range(m):
@@ -265,7 +267,7 @@
     def testView(self):
         "Test Array2 view method"
         a = self.array2.view()
-        self.failUnless(isinstance(a, N.ndarray))
+        self.failUnless(isinstance(a, np.ndarray))
         self.failUnless(len(a) == self.nrows)
 
 ######################################################################
@@ -279,7 +281,7 @@
 
     # Execute the test suite
     print "Testing Classes of Module Array"
-    print "NumPy version", N.__version__
+    print "NumPy version", np.__version__
     print
     result = unittest.TextTestRunner(verbosity=2).run(suite)
     sys.exit(len(result.errors) + len(result.failures))

Modified: branches/maskedarray/numpy/doc/swig/test/testFarray.py
===================================================================
--- branches/maskedarray/numpy/doc/swig/test/testFarray.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/swig/test/testFarray.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -7,8 +7,8 @@
 import unittest
 
 # Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
 if major == 0: BadListError = TypeError
 else:          BadListError = ValueError
 
@@ -136,7 +136,7 @@
             for j in range(self.ncols):
                 self.array[i,j] = i+j
         a = self.array.view()
-        self.failUnless(isinstance(a, N.ndarray))
+        self.failUnless(isinstance(a, np.ndarray))
         self.failUnless(a.flags.f_contiguous)
         for i in range(self.nrows):
             for j in range(self.ncols):
@@ -152,7 +152,7 @@
 
     # Execute the test suite
     print "Testing Classes of Module Farray"
-    print "NumPy version", N.__version__
+    print "NumPy version", np.__version__
     print
     result = unittest.TextTestRunner(verbosity=2).run(suite)
     sys.exit(len(result.errors) + len(result.failures))

Modified: branches/maskedarray/numpy/doc/swig/test/testMatrix.py
===================================================================
--- branches/maskedarray/numpy/doc/swig/test/testMatrix.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/swig/test/testMatrix.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -7,8 +7,8 @@
 import unittest
 
 # Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
 if major == 0: BadListError = TypeError
 else:          BadListError = ValueError
 
@@ -131,7 +131,7 @@
         "Test scale function"
         print >>sys.stderr, self.typeStr, "... ",
         scale = Matrix.__dict__[self.typeStr + "Scale"]
-        matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],self.typeCode)
+        matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],self.typeCode)
         scale(matrix,4)
         self.assertEquals((matrix == [[4,8,12],[8,4,8],[12,8,4]]).all(), True)
 
@@ -140,7 +140,7 @@
         "Test scale function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         scale = Matrix.__dict__[self.typeStr + "Scale"]
-        matrix = N.array([1,2,2,1],self.typeCode)
+        matrix = np.array([1,2,2,1],self.typeCode)
         self.assertRaises(TypeError, scale, matrix)
 
     # Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
@@ -148,7 +148,7 @@
         "Test scale function with wrong size"
         print >>sys.stderr, self.typeStr, "... ",
         scale = Matrix.__dict__[self.typeStr + "Scale"]
-        matrix = N.array([[1,2],[2,1]],self.typeCode)
+        matrix = np.array([[1,2],[2,1]],self.typeCode)
         self.assertRaises(TypeError, scale, matrix)
 
     # Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
@@ -156,7 +156,7 @@
         "Test scale function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         scale = Matrix.__dict__[self.typeStr + "Scale"]
-        matrix = N.array([[1,2,3],[2,1,2],[3,2,1]],'c')
+        matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],'c')
         self.assertRaises(TypeError, scale, matrix)
 
     # Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
@@ -172,16 +172,16 @@
         "Test floor function"
         print >>sys.stderr, self.typeStr, "... ",
         floor = Matrix.__dict__[self.typeStr + "Floor"]
-        matrix = N.array([[6,7],[8,9]],self.typeCode)
+        matrix = np.array([[6,7],[8,9]],self.typeCode)
         floor(matrix,7)
-        N.testing.assert_array_equal(matrix, N.array([[7,7],[8,9]]))
+        np.testing.assert_array_equal(matrix, np.array([[7,7],[8,9]]))
 
     # Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
     def testFloorWrongDim(self):
         "Test floor function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         floor = Matrix.__dict__[self.typeStr + "Floor"]
-        matrix = N.array([6,7,8,9],self.typeCode)
+        matrix = np.array([6,7,8,9],self.typeCode)
         self.assertRaises(TypeError, floor, matrix)
 
     # Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
@@ -189,7 +189,7 @@
         "Test floor function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         floor = Matrix.__dict__[self.typeStr + "Floor"]
-        matrix = N.array([[6,7], [8,9]],'c')
+        matrix = np.array([[6,7], [8,9]],'c')
         self.assertRaises(TypeError, floor, matrix)
 
     # Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
@@ -205,16 +205,16 @@
         "Test ceil function"
         print >>sys.stderr, self.typeStr, "... ",
         ceil = Matrix.__dict__[self.typeStr + "Ceil"]
-        matrix = N.array([[1,2],[3,4]],self.typeCode)
+        matrix = np.array([[1,2],[3,4]],self.typeCode)
         ceil(matrix,3)
-        N.testing.assert_array_equal(matrix, N.array([[1,2],[3,3]]))
+        np.testing.assert_array_equal(matrix, np.array([[1,2],[3,3]]))
 
     # Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
     def testCeilWrongDim(self):
         "Test ceil function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         ceil = Matrix.__dict__[self.typeStr + "Ceil"]
-        matrix = N.array([1,2,3,4],self.typeCode)
+        matrix = np.array([1,2,3,4],self.typeCode)
         self.assertRaises(TypeError, ceil, matrix)
 
     # Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
@@ -222,7 +222,7 @@
         "Test ceil function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         ceil = Matrix.__dict__[self.typeStr + "Ceil"]
-        matrix = N.array([[1,2], [3,4]],'c')
+        matrix = np.array([[1,2], [3,4]],'c')
         self.assertRaises(TypeError, ceil, matrix)
 
     # Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
@@ -359,7 +359,7 @@
 
     # Execute the test suite
     print "Testing 2D Functions of Module Matrix"
-    print "NumPy version", N.__version__
+    print "NumPy version", np.__version__
     print
     result = unittest.TextTestRunner(verbosity=2).run(suite)
     sys.exit(len(result.errors) + len(result.failures))

Modified: branches/maskedarray/numpy/doc/swig/test/testTensor.py
===================================================================
--- branches/maskedarray/numpy/doc/swig/test/testTensor.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/swig/test/testTensor.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -8,8 +8,8 @@
 import unittest
 
 # Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
 if major == 0: BadListError = TypeError
 else:          BadListError = ValueError
 
@@ -144,7 +144,7 @@
         "Test scale function"
         print >>sys.stderr, self.typeStr, "... ",
         scale = Tensor.__dict__[self.typeStr + "Scale"]
-        tensor = N.array([[[1,0,1], [0,1,0], [1,0,1]],
+        tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
                           [[0,1,0], [1,0,1], [0,1,0]],
                           [[1,0,1], [0,1,0], [1,0,1]]],self.typeCode)
         scale(tensor,4)
@@ -157,7 +157,7 @@
         "Test scale function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         scale = Tensor.__dict__[self.typeStr + "Scale"]
-        tensor = N.array([[[1,0,1], [0,1,0], [1,0,1]],
+        tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
                           [[0,1,0], [1,0,1], [0,1,0]],
                           [[1,0,1], [0,1,0], [1,0,1]]],'c')
         self.assertRaises(TypeError, scale, tensor)
@@ -167,7 +167,7 @@
         "Test scale function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         scale = Tensor.__dict__[self.typeStr + "Scale"]
-        tensor = N.array([[1,0,1], [0,1,0], [1,0,1],
+        tensor = np.array([[1,0,1], [0,1,0], [1,0,1],
                           [0,1,0], [1,0,1], [0,1,0]],self.typeCode)
         self.assertRaises(TypeError, scale, tensor)
 
@@ -176,7 +176,7 @@
         "Test scale function with wrong size"
         print >>sys.stderr, self.typeStr, "... ",
         scale = Tensor.__dict__[self.typeStr + "Scale"]
-        tensor = N.array([[[1,0], [0,1], [1,0]],
+        tensor = np.array([[[1,0], [0,1], [1,0]],
                           [[0,1], [1,0], [0,1]],
                           [[1,0], [0,1], [1,0]]],self.typeCode)
         self.assertRaises(TypeError, scale, tensor)
@@ -193,10 +193,10 @@
         "Test floor function"
         print >>sys.stderr, self.typeStr, "... ",
         floor = Tensor.__dict__[self.typeStr + "Floor"]
-        tensor = N.array([[[1,2], [3,4]],
+        tensor = np.array([[[1,2], [3,4]],
                           [[5,6], [7,8]]],self.typeCode)
         floor(tensor,4)
-        N.testing.assert_array_equal(tensor, N.array([[[4,4], [4,4]],
+        np.testing.assert_array_equal(tensor, np.array([[[4,4], [4,4]],
                                                       [[5,6], [7,8]]]))
 
     # Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
@@ -204,7 +204,7 @@
         "Test floor function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         floor = Tensor.__dict__[self.typeStr + "Floor"]
-        tensor = N.array([[[1,2], [3,4]],
+        tensor = np.array([[[1,2], [3,4]],
                           [[5,6], [7,8]]],'c')
         self.assertRaises(TypeError, floor, tensor)
 
@@ -213,7 +213,7 @@
         "Test floor function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         floor = Tensor.__dict__[self.typeStr + "Floor"]
-        tensor = N.array([[1,2], [3,4], [5,6], [7,8]],self.typeCode)
+        tensor = np.array([[1,2], [3,4], [5,6], [7,8]],self.typeCode)
         self.assertRaises(TypeError, floor, tensor)
 
     # Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
@@ -228,10 +228,10 @@
         "Test ceil function"
         print >>sys.stderr, self.typeStr, "... ",
         ceil = Tensor.__dict__[self.typeStr + "Ceil"]
-        tensor = N.array([[[9,8], [7,6]],
+        tensor = np.array([[[9,8], [7,6]],
                           [[5,4], [3,2]]],self.typeCode)
         ceil(tensor,5)
-        N.testing.assert_array_equal(tensor, N.array([[[5,5], [5,5]],
+        np.testing.assert_array_equal(tensor, np.array([[[5,5], [5,5]],
                                                       [[5,4], [3,2]]]))
 
     # Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
@@ -239,7 +239,7 @@
         "Test ceil function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         ceil = Tensor.__dict__[self.typeStr + "Ceil"]
-        tensor = N.array([[[9,8], [7,6]],
+        tensor = np.array([[[9,8], [7,6]],
                           [[5,4], [3,2]]],'c')
         self.assertRaises(TypeError, ceil, tensor)
 
@@ -248,7 +248,7 @@
         "Test ceil function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         ceil = Tensor.__dict__[self.typeStr + "Ceil"]
-        tensor = N.array([[9,8], [7,6], [5,4], [3,2]], self.typeCode)
+        tensor = np.array([[9,8], [7,6], [5,4], [3,2]], self.typeCode)
         self.assertRaises(TypeError, ceil, tensor)
 
     # Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
@@ -399,7 +399,7 @@
 
     # Execute the test suite
     print "Testing 3D Functions of Module Tensor"
-    print "NumPy version", N.__version__
+    print "NumPy version", np.__version__
     print
     result = unittest.TextTestRunner(verbosity=2).run(suite)
     sys.exit(len(result.errors) + len(result.failures))

Modified: branches/maskedarray/numpy/doc/swig/test/testVector.py
===================================================================
--- branches/maskedarray/numpy/doc/swig/test/testVector.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/doc/swig/test/testVector.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -7,8 +7,8 @@
 import unittest
 
 # Import NumPy
-import numpy as N
-major, minor = [ int(d) for d in N.__version__.split(".")[:2] ]
+import numpy as np
+major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
 if major == 0: BadListError = TypeError
 else:          BadListError = ValueError
 
@@ -123,7 +123,7 @@
         "Test reverse function"
         print >>sys.stderr, self.typeStr, "... ",
         reverse = Vector.__dict__[self.typeStr + "Reverse"]
-        vector = N.array([1,2,4],self.typeCode)
+        vector = np.array([1,2,4],self.typeCode)
         reverse(vector)
         self.assertEquals((vector == [4,2,1]).all(), True)
 
@@ -132,7 +132,7 @@
         "Test reverse function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         reverse = Vector.__dict__[self.typeStr + "Reverse"]
-        vector = N.array([[1,2], [3,4]],self.typeCode)
+        vector = np.array([[1,2], [3,4]],self.typeCode)
         self.assertRaises(TypeError, reverse, vector)
 
     # Test the (type INPLACE_ARRAY1[ANY]) typemap
@@ -140,7 +140,7 @@
         "Test reverse function with wrong size"
         print >>sys.stderr, self.typeStr, "... ",
         reverse = Vector.__dict__[self.typeStr + "Reverse"]
-        vector = N.array([9,8,7,6,5,4],self.typeCode)
+        vector = np.array([9,8,7,6,5,4],self.typeCode)
         self.assertRaises(TypeError, reverse, vector)
 
     # Test the (type INPLACE_ARRAY1[ANY]) typemap
@@ -148,7 +148,7 @@
         "Test reverse function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         reverse = Vector.__dict__[self.typeStr + "Reverse"]
-        vector = N.array([1,2,4],'c')
+        vector = np.array([1,2,4],'c')
         self.assertRaises(TypeError, reverse, vector)
 
     # Test the (type INPLACE_ARRAY1[ANY]) typemap
@@ -163,16 +163,16 @@
         "Test ones function"
         print >>sys.stderr, self.typeStr, "... ",
         ones = Vector.__dict__[self.typeStr + "Ones"]
-        vector = N.zeros(5,self.typeCode)
+        vector = np.zeros(5,self.typeCode)
         ones(vector)
-        N.testing.assert_array_equal(vector, N.array([1,1,1,1,1]))
+        np.testing.assert_array_equal(vector, np.array([1,1,1,1,1]))
 
     # Test the (type* INPLACE_ARRAY1, int DIM1) typemap
     def testOnesWrongDim(self):
         "Test ones function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         ones = Vector.__dict__[self.typeStr + "Ones"]
-        vector = N.zeros((5,5),self.typeCode)
+        vector = np.zeros((5,5),self.typeCode)
         self.assertRaises(TypeError, ones, vector)
 
     # Test the (type* INPLACE_ARRAY1, int DIM1) typemap
@@ -180,7 +180,7 @@
         "Test ones function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         ones = Vector.__dict__[self.typeStr + "Ones"]
-        vector = N.zeros((5,5),'c')
+        vector = np.zeros((5,5),'c')
         self.assertRaises(TypeError, ones, vector)
 
     # Test the (type* INPLACE_ARRAY1, int DIM1) typemap
@@ -195,16 +195,16 @@
         "Test zeros function"
         print >>sys.stderr, self.typeStr, "... ",
         zeros = Vector.__dict__[self.typeStr + "Zeros"]
-        vector = N.ones(5,self.typeCode)
+        vector = np.ones(5,self.typeCode)
         zeros(vector)
-        N.testing.assert_array_equal(vector, N.array([0,0,0,0,0]))
+        np.testing.assert_array_equal(vector, np.array([0,0,0,0,0]))
 
     # Test the (int DIM1, type* INPLACE_ARRAY1) typemap
     def testZerosWrongDim(self):
         "Test zeros function with wrong dimensions"
         print >>sys.stderr, self.typeStr, "... ",
         zeros = Vector.__dict__[self.typeStr + "Zeros"]
-        vector = N.ones((5,5),self.typeCode)
+        vector = np.ones((5,5),self.typeCode)
         self.assertRaises(TypeError, zeros, vector)
 
     # Test the (int DIM1, type* INPLACE_ARRAY1) typemap
@@ -212,7 +212,7 @@
         "Test zeros function with wrong type"
         print >>sys.stderr, self.typeStr, "... ",
         zeros = Vector.__dict__[self.typeStr + "Zeros"]
-        vector = N.ones(6,'c')
+        vector = np.ones(6,'c')
         self.assertRaises(TypeError, zeros, vector)
 
     # Test the (int DIM1, type* INPLACE_ARRAY1) typemap
@@ -378,7 +378,7 @@
 
     # Execute the test suite
     print "Testing 1D Functions of Module Vector"
-    print "NumPy version", N.__version__
+    print "NumPy version", np.__version__
     print
     result = unittest.TextTestRunner(verbosity=2).run(suite)
     sys.exit(len(result.errors) + len(result.failures))

Modified: branches/maskedarray/numpy/f2py/f90mod_rules.py
===================================================================
--- branches/maskedarray/numpy/f2py/f90mod_rules.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/f2py/f90mod_rules.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -17,17 +17,17 @@
 
 f2py_version='See `f2py -v`'
 
+import copy
 import pprint
 import sys
 import time
 import types
-import copy
 errmess=sys.stderr.write
 outmess=sys.stdout.write
 show=pprint.pprint
 
 from auxfuncs import *
-import numpy as N
+import numpy as np
 import capi_maps
 import cfuncs
 import rules
@@ -61,7 +61,7 @@
             deallocate(d)
          end if
       end if
-      if ((.not.allocated(d)).and.(s(1).ge.1)) then""" % N.intp().itemsize
+      if ((.not.allocated(d)).and.(s(1).ge.1)) then""" % np.intp().itemsize
 
 fgetdims2="""\
       end if

Modified: branches/maskedarray/numpy/f2py/lib/parser/block_statements.py
===================================================================
--- branches/maskedarray/numpy/f2py/lib/parser/block_statements.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/f2py/lib/parser/block_statements.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -417,7 +417,7 @@
     match = re.compile(r'end\s*interface\s*\w*\Z', re.I).match
     blocktype = 'interface'
 
-class Interface(BeginStatement, HasImplicitStmt, HasUseStmt,
+class Interface(BeginStatement, HasAttributes, HasImplicitStmt, HasUseStmt,
                 HasModuleProcedures, AccessSpecs
                 ):
     """

Modified: branches/maskedarray/numpy/fft/tests/test_fftpack.py
===================================================================
--- branches/maskedarray/numpy/fft/tests/test_fftpack.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/fft/tests/test_fftpack.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,24 +1,24 @@
 import sys
 from numpy.testing import *
 set_package_path()
-import numpy as N
+import numpy as np
 restore_path()
 
 def fft1(x):
     L = len(x)
-    phase = -2j*N.pi*(N.arange(L)/float(L))
-    phase = N.arange(L).reshape(-1,1) * phase
-    return N.sum(x*N.exp(phase),axis=1)
+    phase = -2j*np.pi*(np.arange(L)/float(L))
+    phase = np.arange(L).reshape(-1,1) * phase
+    return np.sum(x*np.exp(phase),axis=1)
 
 class TestFFTShift(NumpyTestCase):
     def check_fft_n(self):
-        self.failUnlessRaises(ValueError,N.fft.fft,[1,2,3],0)
+        self.failUnlessRaises(ValueError,np.fft.fft,[1,2,3],0)
 
 class TestFFT1D(NumpyTestCase):
     def check_basic(self):
-        rand = N.random.random
+        rand = np.random.random
         x = rand(30) + 1j*rand(30)
-        assert_array_almost_equal(fft1(x), N.fft.fft(x))
+        assert_array_almost_equal(fft1(x), np.fft.fft(x))
 
 if __name__ == "__main__":
     NumpyTest().run()

Modified: branches/maskedarray/numpy/lib/__init__.py
===================================================================
--- branches/maskedarray/numpy/lib/__init__.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/__init__.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -15,6 +15,7 @@
 #import convertcode
 from utils import *
 from arraysetops import *
+from io import *
 import math
 
 __all__ = ['emath','math']
@@ -29,6 +30,7 @@
 __all__ += getlimits.__all__
 __all__ += utils.__all__
 __all__ += arraysetops.__all__
+__all__ += io.__all__
 
 def test(level=1, verbosity=1):
     from numpy.testing import NumpyTest

Copied: branches/maskedarray/numpy/lib/_datasource.py (from rev 4729, trunk/numpy/lib/_datasource.py)

Modified: branches/maskedarray/numpy/lib/arraysetops.py
===================================================================
--- branches/maskedarray/numpy/lib/arraysetops.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/arraysetops.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -201,9 +201,13 @@
       numpy.lib.arraysetops has a number of other functions for performing set
       operations on arrays.
     """
-    zlike = nm.zeros_like
+    ar1 = nm.asarray( ar1 )
+    ar2 = nm.asarray( ar2 )
     ar = nm.concatenate( (ar1, ar2 ) )
-    tt = nm.concatenate( (zlike( ar1 ), zlike( ar2 ) + 1) )
+    b1 = nm.zeros( ar1.shape, dtype = nm.int8 )
+    b2 = nm.ones( ar2.shape, dtype = nm.int8 )
+    tt = nm.concatenate( (b1, b2) )
+        
     # We need this to be a stable sort, so always use 'mergesort' here. The
     # values from the first array should always come before the values from the
     # second array.
@@ -212,7 +216,6 @@
     aux2 = tt[perm]
 #    flag = ediff1d( aux, 1 ) == 0
     flag = nm.concatenate( (aux[1:] == aux[:-1], [False] ) )
-
     ii = nm.where( flag * aux2 )[0]
     aux = perm[ii+1]
     perm[ii+1] = perm[ii]

Copied: branches/maskedarray/numpy/lib/format.py (from rev 4729, trunk/numpy/lib/format.py)

Modified: branches/maskedarray/numpy/lib/getlimits.py
===================================================================
--- branches/maskedarray/numpy/lib/getlimits.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/getlimits.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -7,7 +7,7 @@
 import numpy.core.numeric as numeric
 import numpy.core.numerictypes as ntypes
 from numpy.core.numeric import array
-import numpy as N
+import numpy as np
 
 def _frz(a):
     """fix rank-0 --> rank-1"""
@@ -128,7 +128,7 @@
     _max_vals = {}
 
     def __init__(self, type):
-        self.dtype = N.dtype(type)
+        self.dtype = np.dtype(type)
         self.kind = self.dtype.kind
         self.bits = self.dtype.itemsize * 8
         self.key = "%s%d" % (self.kind, self.bits)

Modified: branches/maskedarray/numpy/lib/index_tricks.py
===================================================================
--- branches/maskedarray/numpy/lib/index_tricks.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/index_tricks.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,5 +1,3 @@
-## Automatically adapted for numpy Sep 19, 2005 by convertcode.py
-
 __all__ = ['unravel_index',
            'mgrid',
            'ogrid',
@@ -48,7 +46,7 @@
     # Reverse
     # [dcb,dc,d,1]
     dim_prod = _nx.cumprod([1] + list(dims)[:0:-1])[::-1]
-    # Indeces become [x/dcb % a, x/dc % b, x/d % c, x/1 % d]
+    # Indices become [x/dcb % a, x/dc % b, x/d % c, x/1 % d]
     return tuple(x/dim_prod % dims)
 
 def ix_(*args):
@@ -193,7 +191,7 @@
 mgrid = nd_grid(sparse=False)
 ogrid = nd_grid(sparse=True)
 
-class concatenator(object):
+class AxisConcatenator(object):
     """Translates slice objects to concatenation along an axis.
     """
     def _retval(self, res):
@@ -313,26 +311,30 @@
 # etc. because otherwise we couldn't get the doc string to come out right
 # in help(r_)
 
-class r_class(concatenator):
+class RClass(AxisConcatenator):
     """Translates slice objects to concatenation along the first axis.
 
-        For example:
-        >>> r_[array([1,2,3]), 0, 0, array([4,5,6])]
-        array([1, 2, 3, 0, 0, 4, 5, 6])
+    For example:
+    >>> r_[array([1,2,3]), 0, 0, array([4,5,6])]
+    array([1, 2, 3, 0, 0, 4, 5, 6])
 
     """
     def __init__(self):
-        concatenator.__init__(self, 0)
+        AxisConcatenator.__init__(self, 0)
 
-r_ = r_class()
+r_ = RClass()
 
-class c_class(concatenator):
+class CClass(AxisConcatenator):
     """Translates slice objects to concatenation along the second axis.
+
+    For example:
+    >>> c_[array([[1,2,3]]), 0, 0, array([[4,5,6]])]
+    array([1, 2, 3, 0, 0, 4, 5, 6])
     """
     def __init__(self):
-        concatenator.__init__(self, -1, ndmin=2, trans1d=0)
+        AxisConcatenator.__init__(self, -1, ndmin=2, trans1d=0)
 
-c_ = c_class()
+c_ = CClass()
 
 class ndenumerate(object):
     """
@@ -423,7 +425,7 @@
 #
 #
 
-class _index_expression_class(object):
+class IndexExpression(object):
     """
     A nicer way to build up index tuples for arrays.
 
@@ -451,7 +453,7 @@
             stop = None
         return self[start:stop:None]
 
-index_exp = _index_expression_class(1)
-s_ = _index_expression_class(0)
+index_exp = IndexExpression(maketuple=True)
+s_ = IndexExpression(maketuple=False)
 
 # End contribution from Konrad.

Copied: branches/maskedarray/numpy/lib/io.py (from rev 4729, trunk/numpy/lib/io.py)

Modified: branches/maskedarray/numpy/lib/scimath.py
===================================================================
--- branches/maskedarray/numpy/lib/scimath.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/scimath.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -2,6 +2,17 @@
 Wrapper functions to more user-friendly calling of certain math functions
 whose output data-type is different than the input data-type in certain
 domains of the input.
+
+For example, for functions like log() with branch cuts, the versions in this
+module provide the mathematically valid answers in the complex plane:
+
+>>> import math
+>>> from numpy.lib import scimath
+>>> scimath.log(-math.exp(1)) == (1+1j*math.pi)
+True
+
+Similarly, sqrt(), other base logarithms, power() and trig functions are
+correctly handled.  See their respective docstrings for specific examples.
 """
 
 __all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos',
@@ -12,51 +23,266 @@
 from numpy.core.numeric import asarray, any
 from numpy.lib.type_check import isreal
 
+_ln2 = nx.log(2.0)
 
-#__all__.extend([key for key in dir(nx.umath)
-#                if key[0] != '_' and key not in __all__])
+def _tocomplex(arr):
+    """Convert its input `arr` to a complex array.
 
-_ln2 = nx.log(2.0)
+    The input is returned as a complex array of the smallest type that will fit
+    the original data: types like single, byte, short, etc. become csingle,
+    while others become cdouble.
 
-def _tocomplex(arr):
-    if isinstance(arr.dtype, (nt.single, nt.byte, nt.short, nt.ubyte,
-                              nt.ushort)):
+    A copy of the input is always made.
+
+    Parameters
+    ----------
+    arr : array
+
+    Returns
+    -------
+    array
+        An array with the same input data as the input but in complex form.
+
+    Examples
+    --------
+
+    >>> import numpy as np
+
+    First, consider an input of type short:
+
+    >>> a = np.array([1,2,3],np.short)
+
+    >>> ac = _tocomplex(a); ac
+    array([ 1.+0.j,  2.+0.j,  3.+0.j], dtype=complex64)
+
+    >>> ac.dtype
+    dtype('complex64')
+
+    If the input is of type double, the output is correspondingly of the
+    complex double type as well:
+
+    >>> b = np.array([1,2,3],np.double)
+
+    >>> bc = _tocomplex(b); bc
+    array([ 1.+0.j,  2.+0.j,  3.+0.j])
+
+    >>> bc.dtype
+    dtype('complex128')
+
+    Note that even if the input was complex to begin with, a copy is still
+    made, since the astype() method always copies:
+
+    >>> c = np.array([1,2,3],np.csingle)
+
+    >>> cc = _tocomplex(c); cc
+    array([ 1.+0.j,  2.+0.j,  3.+0.j], dtype=complex64)
+
+    >>> c *= 2; c
+    array([ 2.+0.j,  4.+0.j,  6.+0.j], dtype=complex64)
+
+    >>> cc
+    array([ 1.+0.j,  2.+0.j,  3.+0.j], dtype=complex64)
+    """
+    if issubclass(arr.dtype.type, (nt.single, nt.byte, nt.short, nt.ubyte,
+                                   nt.ushort,nt.csingle)):
         return arr.astype(nt.csingle)
     else:
         return arr.astype(nt.cdouble)
 
 def _fix_real_lt_zero(x):
+    """Convert `x` to complex if it has real, negative components.
+
+    Otherwise, output is just the array version of the input (via asarray).
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array
+
+    Examples
+    --------
+    >>> _fix_real_lt_zero([1,2])
+    array([1, 2])
+
+    >>> _fix_real_lt_zero([-1,2])
+    array([-1.+0.j,  2.+0.j])
+    """
     x = asarray(x)
     if any(isreal(x) & (x<0)):
         x = _tocomplex(x)
     return x
 
 def _fix_int_lt_zero(x):
+    """Convert `x` to double if it has real, negative components.
+
+    Otherwise, output is just the array version of the input (via asarray).
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array
+
+    Examples
+    --------
+    >>> _fix_int_lt_zero([1,2])
+    array([1, 2])
+
+    >>> _fix_int_lt_zero([-1,2])
+    array([-1.,  2.])
+    """
     x = asarray(x)
     if any(isreal(x) & (x < 0)):
         x = x * 1.0
     return x
 
 def _fix_real_abs_gt_1(x):
+    """Convert `x` to complex if it has real components x_i with abs(x_i)>1.
+
+    Otherwise, output is just the array version of the input (via asarray).
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array
+
+    Examples
+    --------
+    >>> _fix_real_abs_gt_1([0,1])
+    array([0, 1])
+
+    >>> _fix_real_abs_gt_1([0,2])
+    array([ 0.+0.j,  2.+0.j])
+    """
     x = asarray(x)
     if any(isreal(x) & (abs(x)>1)):
         x = _tocomplex(x)
     return x
 
 def sqrt(x):
+    """Return the square root of x.
+
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array_like output.
+
+    Examples
+    --------
+
+    For real, non-negative inputs this works just like numpy.sqrt():
+    >>> sqrt(1)
+    1.0
+
+    >>> sqrt([1,4])
+    array([ 1.,  2.])
+
+    But it automatically handles negative inputs:
+    >>> sqrt(-1)
+    (0.0+1.0j)
+
+    >>> sqrt([-1,4])
+    array([ 0.+1.j,  2.+0.j])
+    """
     x = _fix_real_lt_zero(x)
     return nx.sqrt(x)
 
 def log(x):
+    """Return the natural logarithm of x.
+
+    If x contains negative inputs, the answer is computed and returned in the
+    complex domain.
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array_like
+
+    Examples
+    --------
+    >>> import math
+
+    >>> log(math.exp(1))
+    1.0
+
+    Negative arguments are correctly handled (recall that for negative
+    arguments, the identity exp(log(z))==z does not hold anymore):
+    
+    >>> log(-math.exp(1)) == (1+1j*math.pi)
+    True
+    """
     x = _fix_real_lt_zero(x)
     return nx.log(x)
 
 def log10(x):
+    """Return the base 10 logarithm of x.
+
+    If x contains negative inputs, the answer is computed and returned in the
+    complex domain.
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array_like
+
+    Examples
+    --------
+
+    (We set the printing precision so the example can be auto-tested)
+    >>> import numpy as np; np.set_printoptions(precision=4)
+
+    >>> log10([10**1,10**2])
+    array([ 1.,  2.])
+
+
+    >>> log10([-10**1,-10**2,10**2])
+    array([ 1.+1.3644j,  2.+1.3644j,  2.+0.j    ])
+    """
     x = _fix_real_lt_zero(x)
     return nx.log10(x)
 
 def logn(n, x):
-    """ Take log base n of x.
+    """Take log base n of x.
+
+    If x contains negative inputs, the answer is computed and returned in the
+    complex domain.
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array_like
+
+    Examples
+    --------
+
+    (We set the printing precision so the example can be auto-tested)
+    >>> import numpy as np; np.set_printoptions(precision=4)
+
+    >>> logn(2,[4,8])
+    array([ 2.,  3.])
+
+    >>> logn(2,[-4,-8,8])
+    array([ 2.+4.5324j,  3.+4.5324j,  3.+0.j    ])
     """
     x = _fix_real_lt_zero(x)
     n = _fix_real_lt_zero(n)
@@ -64,23 +290,149 @@
 
 def log2(x):
     """ Take log base 2 of x.
+
+    If x contains negative inputs, the answer is computed and returned in the
+    complex domain.
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array_like
+
+    Examples
+    --------
+
+    (We set the printing precision so the example can be auto-tested)
+    >>> import numpy as np; np.set_printoptions(precision=4)
+    
+    >>> log2([4,8])
+    array([ 2.,  3.])
+
+    >>> log2([-4,-8,8])
+    array([ 2.+4.5324j,  3.+4.5324j,  3.+0.j    ])
     """
     x = _fix_real_lt_zero(x)
     return nx.log(x)/_ln2
 
 def power(x, p):
+    """Return x**p.
+
+    If x contains negative values, it is converted to the complex domain.
+
+    If p contains negative values, it is converted to floating point.
+    
+    Parameters
+    ----------
+    x : array_like
+    p : array_like of integers
+
+    Returns
+    -------
+    array_like
+    
+    Examples
+    --------
+    (We set the printing precision so the example can be auto-tested)
+    >>> import numpy as np; np.set_printoptions(precision=4)
+
+    >>> power([2,4],2)
+    array([ 4, 16])
+
+    >>> power([2,4],-2)
+    array([ 0.25  ,  0.0625])
+
+    >>> power([-2,4],2)
+    array([  4.+0.j,  16.+0.j])
+    """
     x = _fix_real_lt_zero(x)
     p = _fix_int_lt_zero(p)
     return nx.power(x, p)
 
 def arccos(x):
+    """Compute the inverse cosine of x.
+
+    For real x with abs(x)<=1, this returns the principal value.
+
+    If abs(x)>1, the complex arccos() is computed.
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array_like
+
+    Examples
+    --------
+    >>> import numpy as np; np.set_printoptions(precision=4)
+
+    >>> arccos(1)
+    0.0
+
+    >>> arccos([1,2])
+    array([ 0.-0.j   ,  0.+1.317j])
+    """
     x = _fix_real_abs_gt_1(x)
     return nx.arccos(x)
 
 def arcsin(x):
+    """Compute the inverse sine of x.
+
+    For real x with abs(x)<=1, this returns the principal value.
+
+    If abs(x)>1, the complex arcsin() is computed.
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array_like
+
+    Examples
+    --------
+    (We set the printing precision so the example can be auto-tested)
+    >>> import numpy as np; np.set_printoptions(precision=4)
+
+    >>> arcsin(0)
+    0.0
+
+    >>> arcsin([0,1])
+    array([ 0.    ,  1.5708])
+    """
     x = _fix_real_abs_gt_1(x)
     return nx.arcsin(x)
 
 def arctanh(x):
+    """Compute the inverse hyperbolic tangent of x.
+
+    For real x with abs(x)<=1, this returns the principal value.
+
+    If abs(x)>1, the complex arctanh() is computed.
+    
+    Parameters
+    ----------
+    x : array_like
+
+    Returns
+    -------
+    array_like
+
+    Examples
+    --------
+    (We set the printing precision so the example can be auto-tested)
+    >>> import numpy as np; np.set_printoptions(precision=4)
+
+    >>> arctanh(0)
+    0.0
+
+    >>> arctanh([0,2])
+    array([ 0.0000+0.j    ,  0.5493-1.5708j])
+    """
     x = _fix_real_abs_gt_1(x)
     return nx.arctanh(x)

Modified: branches/maskedarray/numpy/lib/src/_compiled_base.c
===================================================================
--- branches/maskedarray/numpy/lib/src/_compiled_base.c	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/src/_compiled_base.c	2008-01-18 23:25:32 UTC (rev 4730)
@@ -9,6 +9,9 @@
             goto fail;}                                 \
     }
 
+#define PYSETERROR(message) \
+{ PyErr_SetString(ErrorObject, message); goto fail; }
+
 static intp
 incr_slot_ (double x, double *bins, intp lbins)
 {
@@ -526,6 +529,269 @@
     return Py_None;
 }
 
+
+static char packbits_doc[] = 
+  "out = numpy.packbits(myarray, axis=None)\n\n"
+  "  myarray : an integer type array whose elements should be packed to bits\n\n"
+  "   This routine packs the elements of a binary-valued dataset into a\n"
+  "   NumPy array of type uint8 ('B') whose bits correspond to\n"
+  "   the logical (0 or nonzero) value of the input elements.\n" 
+  "   The dimension over-which bit-packing is done is given by axis.\n"
+  "   The shape of the output has the same number of dimensions as the input\n"
+  "   (unless axis is None, in which case the output is 1-d).\n"
+  "\n"
+  "     Example:\n"
+  "     >>> a = array([[[1,0,1],\n"
+  "     ...             [0,1,0]],\n"
+  "     ...            [[1,1,0],\n"
+  "     ...             [0,0,1]]])\n"
+  "     >>> b = numpy.packbits(a,axis=-1)\n"
+  "     >>> b\n"
+  "     array([[[160],[64]],[[192],[32]]], dtype=uint8)\n\n"
+  "     Note that 160 = 128 + 32\n"
+  "               192 = 128 + 64\n";
+
+static char unpackbits_doc[] = 
+  "out = numpy.unpackbits(myarray, axis=None)\n\n"
+  "     myarray - array of uint8 type where each element represents a bit-field\n"
+  "        that should be unpacked into a boolean output array\n\n"
+  "        The shape of the output array is either 1-d (if axis is None) or\n"
+  "        the same shape as the input array with unpacking done along the\n"
+  "        axis specified.";
+
+/*  PACKBITS
+
+    This function packs binary (0 or 1) 1-bit per pixel arrays
+    into contiguous bytes.
+
+*/
+
+static void 
+_packbits(
+	      void 	*In,
+              int       element_size,  /* in bytes */
+	      npy_intp  in_N,
+	      npy_intp  in_stride,
+	      void	*Out,
+              npy_intp  out_N,
+	      npy_intp  out_stride
+	     )
+{
+  char          build;
+  int           i, index;
+  npy_intp      out_Nm1;
+  int           maxi, remain, nonzero, j;
+  char          *outptr,*inptr;
+
+  outptr = Out;                          /* pointer to output buffer */
+  inptr  = In;                           /* pointer to input buffer */
+
+  /* Loop through the elements of In */
+  /* Determine whether or not it is nonzero.
+     Yes: set correspdoning bit (and adjust build value)
+     No:  move on     
+  /* Every 8th value, set the value of build and increment the outptr */
+
+  remain = in_N % 8;                      /* uneven bits */
+  if (remain == 0) remain = 8;
+  out_Nm1 = out_N - 1;
+  for (index = 0; index < out_N; index++) {
+    build = 0;
+    maxi = (index != out_Nm1 ? 8 : remain);
+    for (i = 0; i < maxi ; i++) {
+      build <<= 1;                        /* shift bits left one bit */
+      nonzero = 0;
+      for (j = 0; j < element_size; j++)  /* determine if this number is non-zero */
+	nonzero += (*(inptr++) != 0);
+      inptr += (in_stride - element_size); /* advance to next input */
+      build += (nonzero != 0);             /* add to this bit if the input value is non-zero */
+    }
+    if (index == out_Nm1) build <<= (8-remain);
+    /*      printf("Here: %d %d %d %d\n",build,slice,index,maxi); 
+     */
+    *outptr = build;
+    outptr += out_stride;
+  }
+  return;
+}
+
+
+static void 
+_unpackbits(
+		void      *In,
+		int       el_size,  /* unused */
+		npy_intp  in_N,
+		npy_intp  in_stride,
+	        void      *Out,
+	        npy_intp  out_N,
+		npy_intp  out_stride
+               )
+{
+  unsigned char mask;
+  int           i,index;
+  char          *inptr, *outptr;
+
+  /* Loop through the elements of out
+   */
+  outptr = Out;
+  inptr  = In;
+  for (index = 0; index < in_N; index++) {
+    mask = 128;
+    for (i = 0; i < 8 ; i++) {
+      *outptr = ((mask & (unsigned char)(*inptr)) != 0);
+      outptr += out_stride;
+      mask >>= 1;
+    }
+    inptr += in_stride;
+  }
+  return;
+}
+
+static PyObject *
+pack_or_unpack_bits(PyObject *input, int axis, int unpack)
+{
+  PyArrayObject *inp;
+  PyObject *new=NULL;
+  PyObject *out=NULL;
+  npy_intp outdims[MAX_DIMS];
+  int i;
+  void (*thefunc)(void *, int, npy_intp, npy_intp, void *, npy_intp, npy_intp);
+  PyArrayIterObject *it, *ot;
+
+  inp = (PyArrayObject *)PyArray_FROM_O(input);
+
+  if (inp == NULL) return NULL;
+
+  if (unpack) {
+    if (PyArray_TYPE(inp) != NPY_UBYTE)
+      PYSETERROR("Expecting an input array of unsigned byte data type");
+  }
+  else {
+    if (!PyArray_ISINTEGER(inp))
+      PYSETERROR("Expecting an input array of integer data type");
+  }
+ 
+  new = PyArray_CheckAxis(inp, &axis, 0);
+  Py_DECREF(inp);
+  if (new == NULL) return NULL;
+
+  /* Handle zero-dim array separately */
+  if (PyArray_SIZE(new) == 0) {
+    return PyArray_Copy((PyArrayObject *)new);
+  }
+
+  if (PyArray_NDIM(new) == 0) {    
+    if (unpack) {
+      /* Handle 0-d array by converting it to a 1-d array */
+      PyObject *temp;
+      PyArray_Dims newdim = {NULL, 1};
+      npy_intp shape=1;
+      newdim.ptr = &shape;
+      temp = PyArray_Newshape((PyArrayObject *)new, &newdim, NPY_CORDER);
+      if (temp == NULL) goto fail;
+      Py_DECREF(new);
+      new = temp;
+    }
+    else {
+      ubyte *optr, *iptr;
+      out = PyArray_New(new->ob_type, 0, NULL, NPY_UBYTE,
+			NULL, NULL, 0, 0, NULL);
+      if (out == NULL) goto fail;
+      optr = PyArray_DATA(out);
+      iptr = PyArray_DATA(new);
+      *optr = 0;
+      for (i=0; i<PyArray_ITEMSIZE(new); i++) {
+	if (*iptr != 0) {
+	  *optr = 1;
+	  break;
+	}
+	iptr++;
+      }
+      goto finish;
+    }
+  }
+
+
+  /* Setup output shape */
+  for (i=0; i<PyArray_NDIM(new); i++) {
+    outdims[i] = PyArray_DIM(new, i);
+  }
+
+  if (unpack) {
+    /* Multiply axis dimension by 8 */
+    outdims[axis] <<= 3;
+    thefunc = _unpackbits;
+  }
+  else {
+    /* Divide axis dimension by 8 */
+    /* 8 -> 1, 9 -> 2, 16 -> 2, 17 -> 3 etc.. */
+    outdims[axis] = ((outdims[axis] - 1) >> 3) + 1;
+    thefunc = _packbits;
+  }
+
+  /* Create output array */
+  out = PyArray_New(new->ob_type, PyArray_NDIM(new), outdims, PyArray_UBYTE,
+		    NULL, NULL, 0, PyArray_ISFORTRAN(new), NULL);
+  if (out == NULL) goto fail;
+  
+  /* Setup iterators to iterate over all but given axis */
+  it = (PyArrayIterObject *)PyArray_IterAllButAxis((PyObject *)new, &axis);
+  ot = (PyArrayIterObject *)PyArray_IterAllButAxis((PyObject *)out, &axis);
+  if (it == NULL || ot == NULL) {
+    Py_XDECREF(it);
+    Py_XDECREF(ot);
+    goto fail;
+  }
+
+  while(PyArray_ITER_NOTDONE(it)) {
+    thefunc(PyArray_ITER_DATA(it), PyArray_ITEMSIZE(new), 
+	    PyArray_DIM(new, axis), PyArray_STRIDE(new, axis),
+	    PyArray_ITER_DATA(ot), PyArray_DIM(out, axis), 
+	    PyArray_STRIDE(out, axis));
+    PyArray_ITER_NEXT(it);
+    PyArray_ITER_NEXT(ot);	      
+  }
+  Py_DECREF(it);
+  Py_DECREF(ot);
+
+ finish:
+  Py_DECREF(new);
+  return out;
+
+ fail:
+  Py_XDECREF(new);
+  Py_XDECREF(out);
+  return NULL;  
+}
+
+
+
+static PyObject *
+io_pack(PyObject *self, PyObject *args, PyObject *kwds)  
+{
+  PyObject *obj;
+  int axis=NPY_MAXDIMS;
+  static char *kwlist[] = {"in", "axis", NULL};
+
+  if (!PyArg_ParseTupleAndKeywords( args, kwds, "O|O&" , kwlist, 
+				    &obj, PyArray_AxisConverter, &axis))
+    return NULL;
+  return pack_or_unpack_bits(obj, axis, 0);  
+}
+
+static PyObject *
+io_unpack(PyObject *self, PyObject *args, PyObject *kwds)  
+{
+  PyObject *obj;
+  int axis=NPY_MAXDIMS;
+  static char *kwlist[] = {"in", "axis", NULL};
+
+  if (!PyArg_ParseTupleAndKeywords( args, kwds, "O|O&" , kwlist,
+				    &obj, PyArray_AxisConverter, &axis))
+    return NULL;
+  return pack_or_unpack_bits(obj, axis, 1);  
+}
+
 static struct PyMethodDef methods[] = {
     {"_insert",  (PyCFunction)arr_insert, METH_VARARGS | METH_KEYWORDS,
      arr_insert__doc__},
@@ -537,6 +803,10 @@
      NULL},
     {"add_docstring", (PyCFunction)arr_add_docstring, METH_VARARGS,
      NULL},
+    {"packbits",  (PyCFunction)io_pack,       METH_VARARGS | METH_KEYWORDS, 
+     packbits_doc},
+    {"unpackbits", (PyCFunction)io_unpack,     METH_VARARGS | METH_KEYWORDS, 
+     unpackbits_doc},
     {NULL, NULL}    /* sentinel */
 };
 
@@ -578,7 +848,7 @@
     PyDict_SetItemString(d, "__version__", s);
     Py_DECREF(s);
 
-    ErrorObject = PyString_FromString("numpy.lib._compiled_base.error");
+    ErrorObject = PyString_FromString("numpy.lib.error");
     PyDict_SetItemString(d, "error", ErrorObject);
     Py_DECREF(ErrorObject);
 

Modified: branches/maskedarray/numpy/lib/tests/test_arraysetops.py
===================================================================
--- branches/maskedarray/numpy/lib/tests/test_arraysetops.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/tests/test_arraysetops.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -145,6 +145,10 @@
 
         assert_array_equal([], setdiff1d([],[]))
 
+    def check_setdiff1d_char_array(self):
+        a = numpy.array(['a','b','c'])
+        b = numpy.array(['a','b','s'])
+        assert_array_equal(setdiff1d(a,b),numpy.array(['c']))
 
     ##
     # 03.11.2005, c

Copied: branches/maskedarray/numpy/lib/tests/test_format.py (from rev 4729, trunk/numpy/lib/tests/test_format.py)

Modified: branches/maskedarray/numpy/lib/tests/test_getlimits.py
===================================================================
--- branches/maskedarray/numpy/lib/tests/test_getlimits.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/tests/test_getlimits.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -2,12 +2,10 @@
 """
 
 from numpy.testing import *
-set_package_path()
 import numpy.lib;reload(numpy.lib)
 from numpy.lib.getlimits import finfo, iinfo
 from numpy import single,double,longdouble
-import numpy as N
-restore_path()
+import numpy as np
 
 ##################################################
 
@@ -39,15 +37,15 @@
     def check_basic(self):
         dts = zip(['i1', 'i2', 'i4', 'i8',
                    'u1', 'u2', 'u4', 'u8'],
-                  [N.int8, N.int16, N.int32, N.int64,
-                   N.uint8, N.uint16, N.uint32, N.uint64])
+                  [np.int8, np.int16, np.int32, np.int64,
+                   np.uint8, np.uint16, np.uint32, np.uint64])
         for dt1, dt2 in dts:
             assert_equal(iinfo(dt1).min, iinfo(dt2).min)
             assert_equal(iinfo(dt1).max, iinfo(dt2).max)
         self.assertRaises(ValueError, iinfo, 'f4')
 
     def check_unsigned_max(self):
-        types = N.sctypes['uint']
+        types = np.sctypes['uint']
         for T in types:
             assert_equal(iinfo(T).max, T(-1))
 

Modified: branches/maskedarray/numpy/lib/tests/test_polynomial.py
===================================================================
--- branches/maskedarray/numpy/lib/tests/test_polynomial.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/tests/test_polynomial.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -74,22 +74,22 @@
 """
 
 from numpy.testing import *
-import numpy as N
+import numpy as np
 
 class TestDocs(NumpyTestCase):
     def check_doctests(self): return self.rundocs()
 
     def check_roots(self):
-        assert_array_equal(N.roots([1,0,0]), [0,0])
+        assert_array_equal(np.roots([1,0,0]), [0,0])
 
     def check_str_leading_zeros(self):
-        p = N.poly1d([4,3,2,1])
+        p = np.poly1d([4,3,2,1])
         p[3] = 0
         assert_equal(str(p),
                      "   2\n"
                      "3 x + 2 x + 1")
 
-        p = N.poly1d([1,2])
+        p = np.poly1d([1,2])
         p[0] = 0
         p[1] = 0
         assert_equal(str(p), " \n0")

Modified: branches/maskedarray/numpy/lib/utils.py
===================================================================
--- branches/maskedarray/numpy/lib/utils.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/lib/utils.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,3 +1,4 @@
+import compiler
 import os
 import sys
 import inspect
@@ -7,9 +8,10 @@
 from numpy.core import product, ndarray
 
 __all__ = ['issubclass_', 'get_numpy_include', 'issubsctype',
-           'issubdtype', 'deprecate', 'get_numarray_include',
+           'issubdtype', 'deprecate', 'deprecate_with_doc',
+           'get_numarray_include',
            'get_include', 'info', 'source', 'who',
-           'byte_bounds', 'may_share_memory']
+           'byte_bounds', 'may_share_memory', 'safe_eval']
 
 def issubclass_(arg1, arg2):
     try:
@@ -82,19 +84,39 @@
         func.__name__ = name
         return func
 
-def deprecate(func, oldname, newname):
+def deprecate(func, oldname=None, newname=None):
+    """Deprecate old functions.
+    Issues a DeprecationWarning, adds warning to oldname's docstring,
+    rebinds oldname.__name__ and returns new function object.
+
+    Example:
+    oldfunc = deprecate(newfunc, 'oldfunc', 'newfunc')
+
+    """
+
     import warnings
+    if oldname is None:
+        try:
+            oldname = func.func_name
+        except AttributeError:
+            oldname = func.__name__
+    if newname is None:
+        str1 = "%s is deprecated" % (oldname,)
+        depdoc = "%s is DEPRECATED!!" % (oldname,)
+    else:
+        str1 = "%s is deprecated, use %s" % (oldname, newname),
+        depdoc = '%s is DEPRECATED!! -- use %s instead' % (oldname, newname,)
+        
     def newfunc(*args,**kwds):
-        warnings.warn("%s is deprecated, use %s" % (oldname, newname),
-                      DeprecationWarning)
+        warnings.warn(str1, DeprecationWarning)
         return func(*args, **kwds)
+
     newfunc = _set_function_name(newfunc, oldname)
     doc = func.__doc__
-    depdoc = '%s is DEPRECATED in numpy: use %s instead' % (oldname, newname,)
     if doc is None:
         doc = depdoc
     else:
-        doc = '\n'.join([depdoc, doc])
+        doc = '\n\n'.join([depdoc, doc])
     newfunc.__doc__ = doc
     try:
         d = func.__dict__
@@ -104,6 +126,24 @@
         newfunc.__dict__.update(d)
     return newfunc
 
+def deprecate_with_doc(somestr):
+    """Decorator to deprecate functions and provide detailed documentation
+    with 'somestr' that is added to the functions docstring.
+
+    Example:
+    depmsg = 'function scipy.foo has been merged into numpy.foobar'
+    @deprecate_with_doc(depmsg)
+    def foo():
+        pass
+
+    """
+
+    def _decorator(func):
+        newfunc = deprecate(func)
+        newfunc.__doc__ += "\n" + somestr
+        return newfunc
+    return _decorator
+
 get_numpy_include = deprecate(get_include, 'get_numpy_include', 'get_include')
 
 
@@ -430,3 +470,113 @@
         print >> output,  inspect.getsource(object)
     except:
         print >> output,  "Not available for this object."
+
+#-----------------------------------------------------------------------------
+
+# The following SafeEval class and company are adapted from Michael Spencer's
+# ASPN Python Cookbook recipe:
+#   http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469
+# Accordingly it is mostly Copyright 2006 by Michael Spencer.
+# The recipe, like most of the other ASPN Python Cookbook recipes was made
+# available under the Python license.
+#   http://www.python.org/license
+
+# It has been modified to:
+#   * handle unary -/+
+#   * support True/False/None
+#   * raise SyntaxError instead of a custom exception.
+
+class SafeEval(object):
+    
+    def visit(self, node, **kw):
+        cls = node.__class__
+        meth = getattr(self,'visit'+cls.__name__,self.default)
+        return meth(node, **kw)
+            
+    def default(self, node, **kw):
+        raise SyntaxError("Unsupported source construct: %s" % node.__class__)
+            
+    def visitExpression(self, node, **kw):
+        for child in node.getChildNodes():
+            return self.visit(child, **kw)
+    
+    def visitConst(self, node, **kw):
+        return node.value
+
+    def visitDict(self, node,**kw):
+        return dict([(self.visit(k),self.visit(v)) for k,v in node.items])
+        
+    def visitTuple(self, node, **kw):
+        return tuple([self.visit(i) for i in node.nodes])
+        
+    def visitList(self, node, **kw):
+        return [self.visit(i) for i in node.nodes]
+
+    def visitUnaryAdd(self, node, **kw):
+        return +self.visit(node.getChildNodes()[0])
+
+    def visitUnarySub(self, node, **kw):
+        return -self.visit(node.getChildNodes()[0])
+
+    def visitName(self, node, **kw):
+        if node.name == 'False':
+            return False
+        elif node.name == 'True':
+            return True
+        elif node.name == 'None':
+            return None
+        else:
+            raise SyntaxError("Unknown name: %s" % node.name)
+
+def safe_eval(source):
+    """ Evaluate a string containing a Python literal expression without
+    allowing the execution of arbitrary non-literal code.
+
+    Parameters
+    ----------
+    source : str
+
+    Returns
+    -------
+    obj : object
+
+    Raises
+    ------
+    SyntaxError if the code is invalid Python expression syntax or if it
+    contains non-literal code.
+
+    Examples
+    --------
+    >>> from numpy.lib.utils import safe_eval
+    >>> safe_eval('1')
+    1
+    >>> safe_eval('[1, 2, 3]')
+    [1, 2, 3]
+    >>> safe_eval('{"foo": ("bar", 10.0)}')
+    {'foo': ('bar', 10.0)}
+    >>> safe_eval('import os')
+    Traceback (most recent call last):
+      ...
+    SyntaxError: invalid syntax
+    >>> safe_eval('open("/home/user/.ssh/id_dsa").read()')
+    Traceback (most recent call last):
+      ...
+    SyntaxError: Unsupported source construct: compiler.ast.CallFunc
+    >>> safe_eval('dict')
+    Traceback (most recent call last):
+      ...
+    SyntaxError: Unknown name: dict
+    """
+    walker = SafeEval()
+    try:
+        ast = compiler.parse(source, "eval")
+    except SyntaxError, err:
+        raise
+    try:
+        return walker.visit(ast)
+    except SyntaxError, err:
+        raise
+
+#-----------------------------------------------------------------------------
+
+

Modified: branches/maskedarray/numpy/linalg/info.py
===================================================================
--- branches/maskedarray/numpy/linalg/info.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/linalg/info.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,25 +1,34 @@
 """\
 Core Linear Algebra Tools
-===========
+-------------------------
+Linear algebra basics:
 
- Linear Algebra Basics:
+- norm            Vector or matrix norm
+- inv             Inverse of a square matrix
+- solve           Solve a linear system of equations
+- det             Determinant of a square matrix
+- lstsq           Solve linear least-squares problem
+- pinv            Pseudo-inverse (Moore-Penrose) using lstsq
 
-   norm       --- Vector or matrix norm
-   inv        --- Inverse of a square matrix
-   solve      --- Solve a linear system of equations
-   det        --- Determinant of a square matrix
-   lstsq      --- Solve linear least-squares problem
-   pinv       --- Pseudo-inverse (Moore-Penrose) using lstsq
+Eigenvalues and decompositions:
 
- Eigenvalues and Decompositions:
+- eig             Eigenvalues and vectors of a square matrix
+- eigh            Eigenvalues and eigenvectors of a Hermitian matrix
+- eigvals         Eigenvalues of a square matrix
+- eigvalsh        Eigenvalues of a Hermitian matrix
+- qr              QR decomposition of a matrix
+- svd             Singular value decomposition of a matrix
+- cholesky        Cholesky decomposition of a matrix
 
-   eig        --- Eigenvalues and vectors of a square matrix
-   eigh       --- Eigenvalues and eigenvectors of a Hermitian matrix
-   eigvals    --- Eigenvalues of a square matrix
-   eigvalsh   --- Eigenvalues of a Hermitian matrix.
-   svd        --- Singular value decomposition of a matrix
-   cholesky   --- Cholesky decomposition of a matrix
+Tensor operations:
 
+- tensorsolve     Solve a linear tensor equation
+- tensorinv       Calculate an inverse of a tensor
+
+Exceptions:
+
+- LinAlgError     Indicates a failed linear algebra operation
+
 """
 
 depends = ['core']

Modified: branches/maskedarray/numpy/linalg/linalg.py
===================================================================
--- branches/maskedarray/numpy/linalg/linalg.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/linalg/linalg.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,9 +1,12 @@
 """Lite version of scipy.linalg.
 
-This module is a lite version of the linalg.py module in SciPy which contains
-high-level Python interface to the LAPACK library.  The lite version
-only accesses the following LAPACK functions: dgesv, zgesv, dgeev,
-zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetrf, dpotrf.
+Notes
+-----
+This module is a lite version of the linalg.py module in SciPy which
+contains high-level Python interface to the LAPACK library.  The lite
+version only accesses the following LAPACK functions: dgesv, zgesv,
+dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetrf,
+zgetrf, dpotrf, zpotrf, dgeqrf, zgeqrf, zungqr, dorgqr.
 """
 
 __all__ = ['solve', 'tensorsolve', 'tensorinv',
@@ -134,13 +137,39 @@
 # Linear equations
 
 def tensorsolve(a, b, axes=None):
-    """Solves the tensor equation a x = b for x
-
-    where it is assumed that all the indices of x are summed over in
-    the product.
-
-    a can be N-dimensional.  x will have the dimensions of A subtracted from
-    the dimensions of b.
+    """Solve the tensor equation a x = b for x
+    
+    It is assumed that all indices of x are summed over in the product,
+    together with the rightmost indices of a, similarly as in
+    tensordot(a, x, axes=len(b.shape)).
+    
+    Parameters
+    ----------
+    a : array, shape b.shape+Q
+        Coefficient tensor. Shape Q of the rightmost indices of a must
+        be such that a is 'square', ie., prod(Q) == prod(b.shape).
+    b : array, any shape
+        Right-hand tensor.
+    axes : tuple of integers
+        Axes in a to reorder to the right, before inversion.
+        If None (default), no reordering is done.
+    
+    Returns
+    -------
+    x : array, shape Q
+    
+    Examples
+    --------
+    >>> from numpy import *
+    >>> a = eye(2*3*4)
+    >>> a.shape = (2*3,4,  2,3,4)
+    >>> b = random.randn(2*3,4)
+    >>> x = linalg.tensorsolve(a, b)
+    >>> x.shape
+    (2, 3, 4)
+    >>> allclose(tensordot(a, x, axes=3), b)
+    True
+    
     """
     a = asarray(a)
     b = asarray(b)
@@ -165,7 +194,19 @@
     return res
 
 def solve(a, b):
-    """Return the solution of a*x = b
+    """Solve the equation a x = b
+
+    Parameters
+    ----------
+    a : array, shape (M, M)
+    b : array, shape (M,)
+
+    Returns
+    -------
+    x : array, shape (M,)
+
+    Raises LinAlgError if a is singular or not square
+    
     """
     one_eq = len(b.shape) == 1
     if one_eq:
@@ -196,34 +237,48 @@
 def tensorinv(a, ind=2):
     """Find the 'inverse' of a N-d array
 
-    ind must be a positive integer specifying
-    how many indices at the front of the array are involved
-    in the inverse sum.
+    The result is an inverse corresponding to the operation
+    tensordot(a, b, ind), ie.,
+    
+        x == tensordot(tensordot(tensorinv(a), a, ind), x, ind)
+          == tensordot(tensordot(a, tensorinv(a), ind), x, ind)
+    
+    for all x (up to floating-point accuracy).
 
-    the result is ainv with shape a.shape[ind:] + a.shape[:ind]
+    Parameters
+    ----------
+    a : array
+        Tensor to 'invert'. Its shape must 'square', ie.,
+        prod(a.shape[:ind]) == prod(a.shape[ind:])
+    ind : integer > 0
+        How many of the first indices are involved in the inverse sum.
 
-    tensordot(ainv, a, ind) is an identity operator
+    Returns
+    -------
+    b : array, shape a.shape[:ind]+a.shape[ind:]
 
-    and so is
+    Raises LinAlgError if a is singular or not square
 
-    tensordot(a, ainv, a.shape-newind)
+    Examples
+    --------
+    >>> from numpy import *
+    >>> a = eye(4*6)
+    >>> a.shape = (4,6,8,3)
+    >>> ainv = linalg.tensorinv(a, ind=2)
+    >>> ainv.shape
+    (8, 3, 4, 6)
+    >>> b = random.randn(4,6)
+    >>> allclose(tensordot(ainv, b), linalg.tensorsolve(a, b))
+    True
 
-    Example:
-
-       a = rand(4,6,8,3)
-       ainv = tensorinv(a)
-       # ainv.shape is (8,3,4,6)
-       # suppose b has shape (4,6)
-       tensordot(ainv, b) # produces same (8,3)-shaped output as
-       tensorsolve(a, b)
-
-       a = rand(24,8,3)
-       ainv = tensorinv(a,1)
-       # ainv.shape is (8,3,24)
-       # suppose b has shape (24,)
-       tensordot(ainv, b, 1)  # produces the same (8,3)-shaped output as
-       tensorsolve(a, b)
-
+    >>> a = eye(4*6)
+    >>> a.shape = (24,8,3)
+    >>> ainv = linalg.tensorinv(a, ind=1)
+    >>> ainv.shape
+    (8, 3, 24)
+    >>> b = random.randn(24)
+    >>> allclose(tensordot(ainv, b, 1), linalg.tensorsolve(a, b))
+    True
     """
     a = asarray(a)
     oldshape = a.shape
@@ -242,12 +297,68 @@
 # Matrix inversion
 
 def inv(a):
+    """Compute the inverse of a matrix.
+    
+    Parameters
+    ----------
+    a : array-like, shape (M, M)
+        Matrix to be inverted
+    
+    Returns
+    -------
+    ainv : array-like, shape (M, M)
+        Inverse of the matrix a
+
+    Raises LinAlgError if a is singular or not square
+
+    Examples
+    --------
+    >>> from numpy import array, inv, dot
+    >>> a = array([[1., 2.], [3., 4.]])
+    >>> inv(a)
+    array([[-2. ,  1. ],
+           [ 1.5, -0.5]])
+    >>> dot(a, inv(a))
+    array([[ 1.,  0.],
+           [ 0.,  1.]])
+
+    """
     a, wrap = _makearray(a)
     return wrap(solve(a, identity(a.shape[0], dtype=a.dtype)))
 
 # Cholesky decomposition
 
 def cholesky(a):
+    """Compute the Cholesky decomposition of a matrix.
+    
+    Returns the Cholesky decomposition, :lm:`A = L L^*` of a Hermitian
+    positive-definite matrix :lm:`A`.
+    
+    Parameters
+    ----------
+    a : array, shape (M, M)
+        Matrix to be decomposed
+    
+    Returns
+    -------
+    L : array, shape (M, M)
+        Lower-triangular Cholesky factor of A
+    
+    Raises LinAlgError if decomposition fails
+
+    Examples
+    --------
+    >>> from numpy import array, linalg
+    >>> a = array([[1,-2j],[2j,5]])
+    >>> L = linalg.cholesky(a)
+    >>> L
+    array([[ 1.+0.j,  0.+0.j],
+           [ 0.+2.j,  1.+0.j]])
+    >>> dot(L, L.T.conj())
+    array([[ 1.+0.j,  0.-2.j],
+           [ 0.+2.j,  5.+0.j]])
+    
+    """
     _assertRank2(a)
     _assertSquareness(a)
     t, result_t = _commonType(a)
@@ -270,12 +381,55 @@
 # QR decompostion
 
 def qr(a, mode='full'):
-    """cacluates A=QR, Q orthonormal, R upper triangular
+    """Compute QR decomposition of a matrix.
 
-    mode:  'full' --> (Q,R)
-           'r'    --> R
-           'economic' --> A2 where the diagonal + upper triangle
-                   part of A2 is R. This is faster if you only need R
+    Calculate the decomposition :lm:`A = Q R` where Q is orthonormal
+    and R upper triangular.
+
+    Parameters
+    ----------
+    a : array, shape (M, N)
+        Matrix to be decomposed
+    mode : {'full', 'r', 'economic'}
+        Determines what information is to be returned. 'full' is the default.
+        Economic mode is slightly faster if only R is needed.
+
+    Returns
+    -------
+    mode = 'full'
+    Q : double or complex array, shape (M, K)
+    R : double or complex array, shape (K, N)
+        Size K = min(M, N)
+    
+    mode = 'r'
+    R : double or complex array, shape (K, N)
+
+    mode = 'economic'
+    A2 : double or complex array, shape (M, N)
+        The diagonal and the upper triangle of A2 contains R,
+        while the rest of the matrix is undefined.
+
+    Raises LinAlgError if decomposition fails
+
+    Notes
+    -----
+    This is an interface to the LAPACK routines dgeqrf, zgeqrf,
+    dorgqr, and zungqr.
+
+    Examples
+    --------
+    >>> from numpy import *
+    >>> a = random.randn(9, 6)
+    >>> q, r = linalg.qr(a)
+    >>> allclose(a, dot(q, r))
+    True
+    >>> r2 = linalg.qr(a, mode='r')
+    >>> r3 = linalg.qr(a, mode='economic')
+    >>> allclose(r, r2)
+    True
+    >>> allclose(r, triu(r3[:6,:6], k=0))
+    True
+    
     """
     _assertRank2(a)
     m, n = a.shape
@@ -352,38 +506,40 @@
 
 
 def eigvals(a):
-    """Compute the eigenvalues of the general 2-d array a.
+    """Compute the eigenvalues of a general matrix.
+    
+    Parameters
+    ----------
+    a : array, shape (M, M)
+        A complex or real matrix whose eigenvalues and eigenvectors
+        will be computed.
 
-    A simple interface to the LAPACK routines dgeev and zgeev that sets the
-    flags to return only the eigenvalues of general real and complex arrays
-    respectively.
+    Returns
+    -------
+    w : double or complex array, shape (M,)
+        The eigenvalues, each repeated according to its multiplicity.
+        They are not necessarily ordered, nor are they necessarily
+        real for real matrices.
+    
+    Raises LinAlgError if eigenvalue computation does not converge
 
-    :Parameters:
+    See Also
+    --------
+    eig : eigenvalues and right eigenvectors of general arrays
+    eigvalsh : eigenvalues of symmetric or Hemitiean arrays.
+    eigh : eigenvalues and eigenvectors of symmetric/Hermitean arrays.
 
-        a : 2-d array
-            A complex or real 2-d array whose eigenvalues and eigenvectors
-            will be computed.
+    Notes
+    -----
+    This is a simple interface to the LAPACK routines dgeev and zgeev
+    that sets the flags to return only the eigenvalues of general real
+    and complex arrays respectively.
+    
+    The number w is an eigenvalue of a if there exists a vector v
+    satisfying the equation dot(a,v) = w*v. Alternately, if w is a root of
+    the characteristic equation det(a - w[i]*I) = 0, where det is the
+    determinant and I is the identity matrix.
 
-    :Returns:
-
-        w : 1-d double or complex array
-            The eigenvalues. The eigenvalues are not necessarily ordered, nor
-            are they necessarily real for real matrices.
-
-    :SeeAlso:
-
-        - eig : eigenvalues and right eigenvectors of general arrays
-        - eigvalsh : eigenvalues of symmetric or Hemitiean arrays.
-        - eigh : eigenvalues and eigenvectors of symmetric/Hermitean arrays.
-
-    :Notes:
-    -------
-
-        The number w is an eigenvalue of a if there exists a vector v
-        satisfying the equation dot(a,v) = w*v. Alternately, if w is a root of
-        the characteristic equation det(a - w[i]*I) = 0, where det is the
-        determinant and I is the identity matrix.
-
     """
     _assertRank2(a)
     _assertSquareness(a)
@@ -429,43 +585,43 @@
 
 
 def eigvalsh(a, UPLO='L'):
-    """Compute the eigenvalues of the symmetric or Hermitean 2-d array a.
+    """Compute the eigenvalues of a Hermitean or real symmetric matrix.
+    
+    Parameters
+    ----------
+    a : array, shape (M, M)
+        A complex or real matrix whose eigenvalues and eigenvectors
+        will be computed.
+    UPLO : {'L', 'U'}
+        Specifies whether the pertinent array data is taken from the upper
+        or lower triangular part of a. Possible values are 'L', and 'U' for
+        upper and lower respectively. Default is 'L'.
+    
+    Returns
+    -------
+    w : double array, shape (M,)
+        The eigenvalues, each repeated according to its multiplicity.
+        They are not necessarily ordered.
 
-    A simple interface to the LAPACK routines dsyevd and zheevd that sets the
-    flags to return only the eigenvalues of real symmetric and complex
-    Hermetian arrays respectively.
+    Raises LinAlgError if eigenvalue computation does not converge
 
-    :Parameters:
+    See Also
+    --------
+    eigh : eigenvalues and eigenvectors of symmetric/Hermitean arrays.
+    eigvals : eigenvalues of general real or complex arrays.
+    eig : eigenvalues and eigenvectors of general real or complex arrays.
 
-        a : 2-d array
-            A complex or real 2-d array whose eigenvalues and eigenvectors
-            will be computed.
+    Notes
+    -----
+    This is a simple interface to the LAPACK routines dsyevd and
+    zheevd that sets the flags to return only the eigenvalues of real
+    symmetric and complex Hermetian arrays respectively.
+    
+    The number w is an eigenvalue of a if there exists a vector v
+    satisfying the equation dot(a,v) = w*v. Alternately, if w is a root of
+    the characteristic equation det(a - w[i]*I) = 0, where det is the
+    determinant and I is the identity matrix.
 
-        UPLO : string
-            Specifies whether the pertinent array date is taken from the upper
-            or lower triangular part of a. Possible values are 'L', and 'U' for
-            upper and lower respectively. Default is 'L'.
-
-    :Returns:
-
-        w : 1-d double array
-            The eigenvalues. The eigenvalues are not necessarily ordered.
-
-    :SeeAlso:
-
-        - eigh : eigenvalues and eigenvectors of symmetric/Hermitean arrays.
-        - eigvals : eigenvalues of general real or complex arrays.
-        - eig : eigenvalues and eigenvectors of general real or complex arrays.
-
-    :Notes:
-    -------
-
-        The number w is an eigenvalue of a if there exists a vector v
-        satisfying the equation dot(a,v) = w*v. Alternately, if w is a root of
-        the characteristic equation det(a - w[i]*I) = 0, where det is the
-        determinant and I is the identity matrix. The eigenvalues of real
-        symmetric or complex Hermitean matrices are always real.
-
     """
     _assertRank2(a)
     _assertSquareness(a)
@@ -515,52 +671,53 @@
 
 
 def eig(a):
-    """Eigenvalues and right eigenvectors of a general matrix.
+    """Compute eigenvalues and right eigenvectors of a general matrix.
 
-    A simple interface to the LAPACK routines dgeev and zgeev that compute the
-    eigenvalues and eigenvectors of general real and complex arrays
-    respectively.
+    Parameters
+    ----------
+    a : array, shape (M, M)
+        A complex or real 2-d array whose eigenvalues and eigenvectors
+        will be computed.
 
-    :Parameters:
+    Returns
+    -------
+    w : double or complex array, shape (M,)
+        The eigenvalues, each repeated according to its multiplicity.
+        The eigenvalues are not necessarily ordered, nor are they
+        necessarily real for real matrices.
+    v : double or complex array, shape (M, M)
+        The normalized eigenvector corresponding to the eigenvalue w[i] is
+        the column v[:,i].
 
-        a : 2-d array
-            A complex or real 2-d array whose eigenvalues and eigenvectors
-            will be computed.
+    Raises LinAlgError if eigenvalue computation does not converge
 
-    :Returns:
+    See Also
+    --------
+    eigvalsh : eigenvalues of symmetric or Hemitiean arrays.
+    eig : eigenvalues and right eigenvectors for non-symmetric arrays
+    eigvals : eigenvalues of non-symmetric array.
 
-        w : 1-d double or complex array
-            The eigenvalues. The eigenvalues are not necessarily ordered, nor
-            are they necessarily real for real matrices.
+    Notes
+    -----
+    This is a simple interface to the LAPACK routines dgeev and zgeev
+    that compute the eigenvalues and eigenvectors of general real and
+    complex arrays respectively.
 
-        v : 2-d double or complex double array.
-            The normalized eigenvector corresponding to the eigenvalue w[i] is
-            the column v[:,i].
+    The number w is an eigenvalue of a if there exists a vector v
+    satisfying the equation dot(a,v) = w*v. Alternately, if w is a root of
+    the characteristic equation det(a - w[i]*I) = 0, where det is the
+    determinant and I is the identity matrix. The arrays a, w, and v
+    satisfy the equation dot(a,v[i]) = w[i]*v[:,i].
 
-    :SeeAlso:
-
-        - eigvalsh : eigenvalues of symmetric or Hemitiean arrays.
-        - eig : eigenvalues and right eigenvectors for non-symmetric arrays
-        - eigvals : eigenvalues of non-symmetric array.
-
-    :Notes:
-    -------
-
-        The number w is an eigenvalue of a if there exists a vector v
-        satisfying the equation dot(a,v) = w*v. Alternately, if w is a root of
-        the characteristic equation det(a - w[i]*I) = 0, where det is the
-        determinant and I is the identity matrix. The arrays a, w, and v
-        satisfy the equation dot(a,v[i]) = w[i]*v[:,i].
-
-        The array v of eigenvectors may not be of maximum rank, that is, some
-        of the columns may be dependent, although roundoff error may obscure
-        that fact. If the eigenvalues are all different, then theoretically the
-        eigenvectors are independent. Likewise, the matrix of eigenvectors is
-        unitary if the matrix a is normal, i.e., if dot(a, a.H) = dot(a.H, a).
-
-        The left and right eigenvectors are not necessarily the (Hemitian)
-        transposes of each other.
-
+    The array v of eigenvectors may not be of maximum rank, that is, some
+    of the columns may be dependent, although roundoff error may obscure
+    that fact. If the eigenvalues are all different, then theoretically the
+    eigenvectors are independent. Likewise, the matrix of eigenvectors is
+    unitary if the matrix a is normal, i.e., if dot(a, a.H) = dot(a.H, a).
+    
+    The left and right eigenvectors are not necessarily the (Hermitian)
+    transposes of each other.
+    
     """
     a, wrap = _makearray(a)
     _assertRank2(a)
@@ -617,49 +774,47 @@
 
 
 def eigh(a, UPLO='L'):
-    """Compute eigenvalues for a Hermitian-symmetric matrix.
+    """Compute eigenvalues for a Hermitian or real symmetric matrix.
+    
+    Parameters
+    ----------
+    a : array, shape (M, M)
+        A complex Hermitian or symmetric real matrix whose eigenvalues
+        and eigenvectors will be computed.
+    UPLO : {'L', 'U'}
+        Specifies whether the pertinent array date is taken from the upper
+        or lower triangular part of a. Possible values are 'L', and 'U'.
+        Default is 'L'.
+    
+    Returns
+    -------
+    w : double array, shape (M,)
+        The eigenvalues. The eigenvalues are not necessarily ordered.
+    v : double or complex double array, shape (M, M)
+        The normalized eigenvector corresponding to the eigenvalue w[i] is
+        the column v[:,i].
+    
+    Raises LinAlgError if eigenvalue computation does not converge
 
+    See Also
+    --------
+    eigvalsh : eigenvalues of symmetric or Hemitiean arrays.
+    eig : eigenvalues and right eigenvectors for non-symmetric arrays
+    eigvals : eigenvalues of non-symmetric array.
+    
+    Notes
+    -----
     A simple interface to the LAPACK routines dsyevd and zheevd that compute
     the eigenvalues and eigenvectors of real symmetric and complex Hermitian
     arrays respectively.
-
-    :Parameters:
-
-        a : 2-d array
-            A complex Hermitian or symmetric real 2-d array whose eigenvalues
-            and eigenvectors will be computed.
-
-        UPLO : string
-            Specifies whether the pertinent array date is taken from the upper
-            or lower triangular part of a. Possible values are 'L', and 'U'.
-            Default is 'L'.
-
-    :Returns:
-
-        w : 1-d double array
-            The eigenvalues. The eigenvalues are not necessarily ordered.
-
-        v : 2-d double or complex double array, depending on input array type
-            The normalized eigenvector corresponding to the eigenvalue w[i] is
-            the column v[:,i].
-
-    :SeeAlso:
-
-        - eigvalsh : eigenvalues of symmetric or Hemitiean arrays.
-        - eig : eigenvalues and right eigenvectors for non-symmetric arrays
-        - eigvals : eigenvalues of non-symmetric array.
-
-    :Notes:
-    -------
-
-        The number w is an eigenvalue of a if there exists a vector v
-        satisfying the equation dot(a,v) = w*v. Alternately, if w is a root of
-        the characteristic equation det(a - w[i]*I) = 0, where det is the
-        determinant and I is the identity matrix. The eigenvalues of real
-        symmetric or complex Hermitean matrices are always real. The array v
-        of eigenvectors is unitary and a, w, and v satisfy the equation
-        dot(a,v[i]) = w[i]*v[:,i].
-
+    
+    The number w is an eigenvalue of a if there exists a vector v
+    satisfying the equation dot(a,v) = w*v. Alternately, if w is a root of
+    the characteristic equation det(a - w[i]*I) = 0, where det is the
+    determinant and I is the identity matrix. The eigenvalues of real
+    symmetric or complex Hermitean matrices are always real. The array v
+    of eigenvectors is unitary and a, w, and v satisfy the equation
+    dot(a,v[i]) = w[i]*v[:,i].
     """
     a, wrap = _makearray(a)
     _assertRank2(a)
@@ -707,19 +862,50 @@
 def svd(a, full_matrices=1, compute_uv=1):
     """Singular Value Decomposition.
 
-    u,s,vh = svd(a)
+    Factorizes the matrix a into two unitary matrices U and Vh and
+    an 1d-array s of singular values (real, non-negative) such that
+    a == U S Vh  if S is an suitably shaped matrix of zeros whose
+    main diagonal is s.
+    
+    Parameters
+    ----------
+    a : array, shape (M, N)
+        Matrix to decompose
+    full_matrices : boolean
+        If true,  U, Vh are shaped  (M,M), (N,N)
+        If false, the shapes are    (M,K), (K,N) where K = min(M,N)
+    compute_uv : boolean
+        Whether to compute also U, Vh in addition to s
+    
+    Returns
+    -------
+    U:  array, shape (M,M) or (M,K) depending on full_matrices
+    s:  array, shape (K,)
+        The singular values, sorted so that s[i] >= s[i+1]
+        K = min(M, N)
+    Vh: array, shape (N,N) or (K,N) depending on full_matrices
+    
+    For compute_uv = False, only s is returned.
 
-    If a is an M x N array, then the svd produces a factoring of the array
-    into two unitary (orthogonal) 2-d arrays u (MxM) and vh (NxN) and a
-    min(M,N)-length array of singular values such that
+    Raises LinAlgError if SVD computation does not converge
 
-                     a == dot(u,dot(S,vh))
-
-    where S is an MxN array of zeros whose main diagonal is s.
-
-    if compute_uv == 0, then return only the singular values
-    if full_matrices == 0, then only part of either u or vh is
-                           returned so that it is MxN
+    Examples
+    --------
+    >>> a = random.randn(9, 6) + 1j*random.randn(9, 6)
+    >>> U, s, Vh = linalg.svd(a)
+    >>> U.shape, Vh.shape, s.shape
+    ((9, 9), (6, 6), (6,))
+    
+    >>> U, s, Vh = linalg.svd(a, full_matrices=False)
+    >>> U.shape, Vh.shape, s.shape
+    ((9, 6), (6, 6), (6,))
+    >>> S = diag(s)
+    >>> allclose(a, dot(U, dot(S, Vh)))
+    True
+    
+    >>> s2 = linalg.svd(a, compute_uv=False)
+    >>> allclose(s, s2)
+    True
     """
     a, wrap = _makearray(a)
     _assertRank2(a)
@@ -782,11 +968,37 @@
 # Generalized inverse
 
 def pinv(a, rcond=1e-15 ):
-    """Return the (Moore-Penrose) pseudo-inverse of a 2-d array
+    """Compute the (Moore-Penrose) pseudo-inverse of a matrix.
+    
+    Calculate a generalized inverse of a matrix using its
+    singular-value decomposition and including all 'large' singular
+    values.
+    
+    Parameters
+    ----------
+    a : array, shape (M, N)
+        Matrix to be pseudo-inverted
+    rcond : float
+        Cutoff for 'small' singular values.
+        Singular values smaller than rcond*largest_singular_value are
+        considered zero.
+    
+    Returns
+    -------
+    B : array, shape (N, M)
+    
+    Raises LinAlgError if SVD computation does not converge
 
-    This method computes the generalized inverse using the
-    singular-value decomposition and all singular values larger than
-    rcond of the largest.
+    Examples
+    --------
+    >>> from numpy import *
+    >>> a = random.randn(9, 6)
+    >>> B = linalg.pinv(a)
+    >>> allclose(a, dot(a, dot(B, a)))
+    True
+    >>> allclose(B, dot(B, dot(a, B)))
+    True
+    
     """
     a, wrap = _makearray(a)
     _assertNonEmpty(a)
@@ -806,7 +1018,21 @@
 # Determinant
 
 def det(a):
-    "The determinant of the 2-d array a"
+    """Compute the determinant of a matrix
+
+    Parameters
+    ----------
+    a : array, shape (M, M)
+
+    Returns
+    -------
+    det : float or complex
+        Determinant of a
+    
+    Notes
+    -----
+    The determinant is computed via LU factorization, LAPACK routine z/dgetrf.
+    """
     a = asarray(a)
     _assertRank2(a)
     _assertSquareness(a)
@@ -830,18 +1056,34 @@
 # Linear Least Squares
 
 def lstsq(a, b, rcond=-1):
-    """returns x,resids,rank,s
-    where x minimizes 2-norm(|b - Ax|)
-    resids is the sum square residuals
-    rank is the rank of A
-    s is the rank of the singular values of A in descending order
-
-    If b is a matrix then x is also a matrix with corresponding columns.
-    If the rank of A is less than the number of columns of A or greater than
-    the number of rows, then residuals will be returned as an empty array
-    otherwise resids = sum((b-dot(A,x)**2).
-    Singular values less than s[0]*rcond are treated as zero.
-"""
+    """Compute least-squares solution to equation :m:`a x = b`
+    
+    Compute a vector x such that the 2-norm :m:`|b - a x|` is minimised.
+    
+    Parameters
+    ----------
+    a : array, shape (M, N)
+    b : array, shape (M,) or (M, K)
+    rcond : float
+        Cutoff for 'small' singular values.
+        Singular values smaller than rcond*largest_singular_value are
+        considered zero.
+    
+    Raises LinAlgError if computation does not converge
+    
+    Returns
+    -------
+    x : array, shape (N,) or (N, K) depending on shape of b
+        Least-squares solution
+    residues : array, shape () or (1,) or (K,)
+        Sums of residues, squared 2-norm for each column in :m:`b - a x`
+        If rank of matrix a is < N or > M this is an empty array.
+        If b was 1-d, this is an (1,) shape array, otherwise the shape is (K,)
+    rank : integer
+        Rank of matrix a
+    s : array, shape (min(M,N),)
+        Singular values of a
+    """
     import math
     a = asarray(a)
     b, wrap = _makearray(b)
@@ -907,36 +1149,38 @@
     return wrap(x), resids, results['rank'], st
 
 def norm(x, ord=None):
-    """ norm(x, ord=None) -> n
+    """Matrix or vector norm.
 
-    Matrix or vector norm.
+    Parameters
+    ----------
+    x : array, shape (M,) or (M, N)
+    ord : number, or {None, 1, -1, 2, -2, inf, -inf, 'fro'}
+        Order of the norm:
 
-    Inputs:
+        ord    norm for matrices             norm for vectors
+        =====  ============================  ==========================
+        None   Frobenius norm                2-norm
+        'fro'  Frobenius norm                -
+        inf    max(sum(abs(x), axis=1))      max(abs(x))
+        -inf   min(sum(abs(x), axis=1))      min(abs(x))
+        1      max(sum(abs(x), axis=0))      as below
+        -1     min(sum(abs(x), axis=0))      as below
+        2      2-norm (largest sing. value)  as below
+        -2     smallest singular value       as below
+        other  -                             sum(abs(x)**ord)**(1./ord)
+        =====  ============================  ==========================
+    
+    Returns
+    -------
+    n : float
+        Norm of the matrix or vector
 
-      x -- a rank-1 (vector) or rank-2 (matrix) array
-      ord -- the order of the norm.
-
-     Comments:
-       For arrays of any rank, if ord is None:
-         calculate the square norm (Euclidean norm for vectors,
-         Frobenius norm for matrices)
-
-       For vectors ord can be any real number including Inf or -Inf.
-         ord = Inf, computes the maximum of the magnitudes
-         ord = -Inf, computes minimum of the magnitudes
-         ord is finite, computes sum(abs(x)**ord,axis=0)**(1.0/ord)
-
-       For matrices ord can only be one of the following values:
-         ord = 2 computes the largest singular value
-         ord = -2 computes the smallest singular value
-         ord = 1 computes the largest column sum of absolute values
-         ord = -1 computes the smallest column sum of absolute values
-         ord = Inf computes the largest row sum of absolute values
-         ord = -Inf computes the smallest row sum of absolute values
-         ord = 'fro' computes the frobenius norm sqrt(sum(diag(X.H * X),axis=0))
-
-       For values ord < 0, the result is, strictly speaking, not a
-       mathematical 'norm', but it may still be useful for numerical purposes.
+    Notes
+    -----
+    For values ord < 0, the result is, strictly speaking, not a
+    mathematical 'norm', but it may still be useful for numerical
+    purposes.
+    
     """
     x = asarray(x)
     nd = len(x.shape)

Modified: branches/maskedarray/numpy/matlib.py
===================================================================
--- branches/maskedarray/numpy/matlib.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/matlib.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,11 +1,11 @@
+import numpy as np
 from numpy.core.defmatrix import matrix, asmatrix
-from numpy import ndarray, array
-import numpy as N
+# need * as we're copying the numpy namespace
 from numpy import *
 
-__version__ = N.__version__
+__version__ = np.__version__
 
-__all__ = N.__all__[:] # copy numpy namespace
+__all__ = np.__all__[:] # copy numpy namespace
 __all__ += ['rand', 'randn', 'repmat']
 
 def empty(shape, dtype=None, order='C'):
@@ -36,17 +36,17 @@
     return b
 
 def eye(n,M=None, k=0, dtype=float):
-    return asmatrix(N.eye(n,M,k,dtype))
+    return asmatrix(np.eye(n,M,k,dtype))
 
 def rand(*args):
     if isinstance(args[0], tuple):
         args = args[0]
-    return asmatrix(N.random.rand(*args))
+    return asmatrix(np.random.rand(*args))
 
 def randn(*args):
     if isinstance(args[0], tuple):
         args = args[0]
-    return asmatrix(N.random.randn(*args))
+    return asmatrix(np.random.randn(*args))
 
 def repmat(a, m, n):
     """Repeat a 0-d to 2-d array mxn times

Modified: branches/maskedarray/numpy/numarray/functions.py
===================================================================
--- branches/maskedarray/numpy/numarray/functions.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/numarray/functions.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -36,8 +36,13 @@
             'togglebyteorder'
             ]
 
-import copy, copy_reg, types
-import os, sys, math, operator
+import copy
+import copy_reg
+import types
+import os
+import sys
+import math
+import operator
 
 from numpy import dot as matrixmultiply, dot, vdot, ravel, concatenate, all,\
      allclose, any, around, argsort, array_equal, array_equiv,\
@@ -45,7 +50,7 @@
      diagonal, e, pi, indices, inner as innerproduct, nonzero, \
      outer as outerproduct, kron as kroneckerproduct, lexsort, putmask, rank, \
      resize, searchsorted, shape, size, sort, swapaxes, trace, transpose
-import numpy as N
+import numpy as np
 
 from numerictypes import typefrom
 
@@ -62,46 +67,46 @@
     if dtype is None:
         if type is None:
             if use_default or typecode is not None:
-                dtype = N.dtype(typecode)
+                dtype = np.dtype(typecode)
         else:
-            dtype = N.dtype(type)
+            dtype = np.dtype(type)
     if use_default and dtype is None:
-        dtype = N.dtype('int')
+        dtype = np.dtype('int')
     return dtype
 
 def fromfunction(shape, dimensions, type=None, typecode=None, dtype=None):
     dtype = type2dtype(typecode, type, dtype, 1)
-    return N.fromfunction(shape, dimensions, dtype=dtype)
+    return np.fromfunction(shape, dimensions, dtype=dtype)
 def ones(shape, type=None, typecode=None, dtype=None):
     dtype = type2dtype(typecode, type, dtype, 1)
-    return N.ones(shape, dtype)
+    return np.ones(shape, dtype)
 
 def zeros(shape, type=None, typecode=None, dtype=None):
     dtype = type2dtype(typecode, type, dtype, 1)
-    return N.zeros(shape, dtype)
+    return np.zeros(shape, dtype)
 
 def where(condition, x=None, y=None, out=None):
     if x is None and y is None:
-        arr = N.where(condition)
+        arr = np.where(condition)
     else:
-        arr = N.where(condition, x, y)
+        arr = np.where(condition, x, y)
     if out is not None:
         out[...] = arr
         return out
     return arr
 
 def indices(shape, type=None):
-    return N.indices(shape, type)
+    return np.indices(shape, type)
 
 def arange(a1, a2=None, stride=1, type=None, shape=None,
            typecode=None, dtype=None):
     dtype = type2dtype(typecode, type, dtype, 0)
-    return N.arange(a1, a2, stride, dtype)
+    return np.arange(a1, a2, stride, dtype)
 
 arrayrange = arange
 
 def alltrue(x, axis=0):
-    return N.alltrue(x, axis)
+    return np.alltrue(x, axis)
 
 def and_(a, b):
     """Same as a & b
@@ -113,7 +118,7 @@
     return (a/b,a%b)
 
 def around(array, digits=0, output=None):
-    ret = N.around(array, digits, output)
+    ret = np.around(array, digits, output)
     if output is None:
         return ret
     return
@@ -123,14 +128,14 @@
 
 
 def choose(selector, population, outarr=None, clipmode=RAISE):
-    a = N.asarray(selector)
+    a = np.asarray(selector)
     ret = a.choose(population, out=outarr, mode=clipmode)
     if outarr is None:
         return ret
     return
 
 def compress(condition, a, axis=0):
-    return N.compress(condition, a, axis)
+    return np.compress(condition, a, axis)
 
 # only returns a view
 def explicit_type(a):
@@ -180,7 +185,7 @@
     if -1 not in shape:
         if sizing != STRICT:
             raise ValueError("sizing must be STRICT if size complete")
-        arr = N.empty(shape, dtype)
+        arr = np.empty(shape, dtype)
         bytesleft=arr.nbytes
         bytesread=0
         while(bytesleft > _BLOCKSIZE):
@@ -208,7 +213,7 @@
     ##file whose size may be determined before allocation, should be
     ##quick -- only one allocation will be needed.
 
-    recsize = dtype.itemsize * N.product([i for i in shape if i != -1])
+    recsize = dtype.itemsize * np.product([i for i in shape if i != -1])
     blocksize = max(_BLOCKSIZE/recsize, 1)*recsize
 
     ##try to estimate file size
@@ -222,7 +227,7 @@
     else:
         initsize=max(1,(endpos-curpos)/recsize)*recsize
 
-    buf = N.newbuffer(initsize)
+    buf = np.newbuffer(initsize)
 
     bytesread=0
     while 1:
@@ -260,9 +265,9 @@
     uidx = shape.index(-1)
     shape[uidx]=len(buf) / recsize
 
-    a = N.ndarray(shape=shape, dtype=type, buffer=buf)
+    a = np.ndarray(shape=shape, dtype=type, buffer=buf)
     if a.dtype.char == '?':
-        N.not_equal(a, 0, a)
+        np.not_equal(a, 0, a)
     return a
 
 def fromstring(datastring, type=None, shape=None, typecode=None, dtype=None):
@@ -270,8 +275,8 @@
     if shape is None:
         count = -1
     else:
-        count = N.product(shape)
-    res = N.fromstring(datastring, dtype=dtype, count=count)
+        count = np.product(shape)
+    res = np.fromstring(datastring, dtype=dtype, count=count)
     if shape is not None:
         res.shape = shape
     return res
@@ -280,7 +285,7 @@
 # check_overflow is ignored
 def fromlist(seq, type=None, shape=None, check_overflow=0, typecode=None, dtype=None):
     dtype = type2dtype(typecode, type, dtype, False)
-    return N.array(seq, dtype)
+    return np.array(seq, dtype)
 
 def array(sequence=None, typecode=None, copy=1, savespace=0,
           type=None, shape=None, dtype=None):
@@ -290,21 +295,21 @@
             return None
         if dtype is None:
             dtype = 'l'
-        return N.empty(shape, dtype)
+        return np.empty(shape, dtype)
     if isinstance(sequence, file):
         return fromfile(sequence, dtype=dtype, shape=shape)
     if isinstance(sequence, str):
         return fromstring(sequence, dtype=dtype, shape=shape)
     if isinstance(sequence, buffer):
-        arr = N.frombuffer(sequence, dtype=dtype)
+        arr = np.frombuffer(sequence, dtype=dtype)
     else:
-        arr = N.array(sequence, dtype, copy=copy)
+        arr = np.array(sequence, dtype, copy=copy)
     if shape is not None:
         arr.shape = shape
     return arr
 
 def asarray(seq, type=None, typecode=None, dtype=None):
-    if isinstance(seq, N.ndarray) and type is None and \
+    if isinstance(seq, np.ndarray) and type is None and \
            typecode is None and dtype is None:
         return seq
     return array(seq, type=type, typecode=typecode, copy=0, dtype=dtype)
@@ -328,10 +333,10 @@
             shape = (shape, ) + args
         else:
             shape = tuple(shape)
-        dummy = N.array(shape)
-        if not issubclass(dummy.dtype.type, N.integer):
+        dummy = np.array(shape)
+        if not issubclass(dummy.dtype.type, np.integer):
             raise TypeError
-        if len(dummy) > N.MAXDIMS:
+        if len(dummy) > np.MAXDIMS:
             raise TypeError
     except:
         raise TypeError("Shape must be a sequence of integers")
@@ -340,7 +345,7 @@
 
 def identity(n, type=None, typecode=None, dtype=None):
     dtype = type2dtype(typecode, type, dtype, True)
-    return N.identity(n, dtype)
+    return np.identity(n, dtype)
 
 def info(obj, output=sys.stdout, numpy=0):
     if numpy:
@@ -396,7 +401,7 @@
 
 #clipmode is ignored if axis is not 0 and array is not 1d
 def put(array, indices, values, axis=0, clipmode=RAISE):
-    if not isinstance(array, N.ndarray):
+    if not isinstance(array, np.ndarray):
         raise TypeError("put only works on subclass of ndarray")
     work = asarray(array)
     if axis == 0:
@@ -404,7 +409,7 @@
             work.put(indices, values, clipmode)
         else:
             work[indices] = values
-    elif isinstance(axis, (int, long, N.integer)):
+    elif isinstance(axis, (int, long, np.integer)):
         work = work.swapaxes(0, axis)
         work[indices] = values
         work = work.swapaxes(0, axis)
@@ -418,13 +423,13 @@
         work = work.transpose(axis)
 
 def repeat(array, repeats, axis=0):
-    return N.repeat(array, repeats, axis)
+    return np.repeat(array, repeats, axis)
 
 
 def reshape(array, shape, *args):
     if len(args) > 0:
         shape = (shape,) + args
-    return N.reshape(array, shape)
+    return np.reshape(array, shape)
 
 
 import warnings as _warnings
@@ -434,12 +439,12 @@
     return around(*args, **keys)
 
 def sometrue(array, axis=0):
-    return N.sometrue(array, axis)
+    return np.sometrue(array, axis)
 
 #clipmode is ignored if axis is not an integer
 def take(array, indices, axis=0, outarr=None, clipmode=RAISE):
-    array = N.asarray(array)
-    if isinstance(axis, (int, long, N.integer)):
+    array = np.asarray(array)
+    if isinstance(axis, (int, long, np.integer)):
         res = array.take(indices, axis, outarr, clipmode)
         if outarr is None:
             return res
@@ -457,34 +462,34 @@
         return
 
 def tensormultiply(a1, a2):
-    a1, a2 = N.asarray(a1), N.asarray(a2)
+    a1, a2 = np.asarray(a1), np.asarray(a2)
     if (a1.shape[-1] != a2.shape[0]):
         raise ValueError("Unmatched dimensions")
     shape = a1.shape[:-1] + a2.shape[1:]
-    return N.reshape(dot(N.reshape(a1, (-1, a1.shape[-1])),
-                         N.reshape(a2, (a2.shape[0],-1))),
+    return np.reshape(dot(N.reshape(a1, (-1, a1.shape[-1])),
+                         np.reshape(a2, (a2.shape[0],-1))),
                      shape)
 
 def cumsum(a1, axis=0, out=None, type=None, dim=0):
-    return N.asarray(a1).cumsum(axis,dtype=type,out=out)
+    return np.asarray(a1).cumsum(axis,dtype=type,out=out)
 
 def cumproduct(a1, axis=0, out=None, type=None, dim=0):
-    return N.asarray(a1).cumprod(axis,dtype=type,out=out)
+    return np.asarray(a1).cumprod(axis,dtype=type,out=out)
 
 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 newobj(self, type):
     if type is None:
-        return N.empty_like(self)
+        return np.empty_like(self)
     else:
-        return N.empty(self.shape, type)
+        return np.empty(self.shape, type)
 
 def togglebyteorder(self):
     self.dtype=self.dtype.newbyteorder()
 
 def average(a, axis=0, weights=None, returned=0):
-    return N.average(a, axis, weights, returned)
+    return np.average(a, axis, weights, returned)

Modified: branches/maskedarray/numpy/oldnumeric/functions.py
===================================================================
--- branches/maskedarray/numpy/oldnumeric/functions.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/oldnumeric/functions.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -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 @@
            '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 @@
     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 @@
     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)

Modified: branches/maskedarray/numpy/oldnumeric/typeconv.py
===================================================================
--- branches/maskedarray/numpy/oldnumeric/typeconv.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/oldnumeric/typeconv.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,21 +1,21 @@
 __all__ = ['oldtype2dtype', 'convtypecode', 'convtypecode2', 'oldtypecodes']
 
-import numpy as N
+import numpy as np
 
-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)
+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 @@
         try:
             return oldtype2dtype[typecode]
         except:
-            return N.dtype(typecode)
+            return np.dtype(typecode)
     else:
         return dtype
 
@@ -38,7 +38,7 @@
             try:
                 return oldtype2dtype[typecode]
             except:
-                return N.dtype(typecode)
+                return np.dtype(typecode)
     else:
         return dtype
 
@@ -50,7 +50,7 @@
 
 class _oldtypecodes(dict):
     def __getitem__(self, obj):
-        char = N.dtype(obj).char
+        char = np.dtype(obj).char
         try:
             return _changedtypes[char]
         except KeyError:

Modified: branches/maskedarray/numpy/random/tests/test_random.py
===================================================================
--- branches/maskedarray/numpy/random/tests/test_random.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/random/tests/test_random.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,6 +1,6 @@
 from numpy.testing import *
 from numpy import random
-import numpy as N
+import numpy as np
 
 class TestMultinomial(NumpyTestCase):
     def test_basic(self):
@@ -12,8 +12,8 @@
     def test_int_negative_interval(self):
         assert -5 <= random.randint(-5,-1) < -1
         x = random.randint(-5,-1,5)
-        assert N.all(-5 <= x)
-        assert N.all(x < -1)
+        assert np.all(-5 <= x)
+        assert np.all(x < -1)
 
 if __name__ == "__main__":
     NumpyTest().run()

Modified: branches/maskedarray/numpy/testing/numpytest.py
===================================================================
--- branches/maskedarray/numpy/testing/numpytest.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/testing/numpytest.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -4,6 +4,7 @@
 import imp
 import glob
 import types
+import shlex
 import unittest
 import traceback
 import warnings
@@ -16,7 +17,6 @@
 
 DEBUG=0
 from numpy.testing.utils import jiffies
-from numpy.distutils.exec_command import splitcmdline
 get_frame = sys._getframe
 
 class IgnoreException(Exception):
@@ -131,7 +131,8 @@
         return 0.01*elapsed
 
     def __call__(self, result=None):
-        if result is None:
+        if result is None or not hasattr(result, 'errors') \
+                or not hasattr(result, 'stream'):
             return unittest.TestCase.__call__(self, result)
 
         nof_errors = len(result.errors)
@@ -648,7 +649,7 @@
                           type='string')
         (options, args) = parser.parse_args()
         return self.test(options.level,options.verbosity,
-                         sys_argv=splitcmdline(options.sys_argv or ''),
+                         sys_argv=shlex.split(options.sys_argv or ''),
                          testcase_pattern=options.testcase_pattern)
 
     def warn(self, message):

Modified: branches/maskedarray/numpy/testing/utils.py
===================================================================
--- branches/maskedarray/numpy/testing/utils.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/testing/utils.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -11,7 +11,7 @@
 __all__ = ['assert_equal', 'assert_almost_equal','assert_approx_equal',
            'assert_array_equal', 'assert_array_less', 'assert_string_equal',
            'assert_array_almost_equal', 'jiffies', 'memusage', 'rand',
-           'runstring']
+           'runstring', 'raises']
 
 def rand(*args):
     """Returns an array of random numbers with the given shape.
@@ -270,3 +270,37 @@
     if not diff_list: return
     msg = 'Differences in strings:\n%s' % (''.join(diff_list)).rstrip()
     assert actual==desired, msg
+
+# Ripped from nose.tools
+def raises(*exceptions):
+    """Test must raise one of expected exceptions to pass.
+
+    Example use::
+
+      @raises(TypeError, ValueError)
+      def test_raises_type_error():
+          raise TypeError("This test passes")
+
+      @raises(Exception):
+      def test_that_fails_by_passing():
+          pass
+
+    If you want to test many assertions about exceptions in a single test,
+    you may want to use `assert_raises` instead.
+    """
+    valid = ' or '.join([e.__name__ for e in exceptions])
+    def decorate(func):
+        name = func.__name__
+        def newfunc(*arg, **kw):
+            try:
+                func(*arg, **kw)
+            except exceptions:
+                pass
+            except:
+                raise
+            else:
+                message = "%s() did not raise %s" % (name, valid)
+                raise AssertionError(message)
+        newfunc = make_decorator(func)(newfunc)
+        return newfunc
+    return decorate

Modified: branches/maskedarray/numpy/tests/test_ctypeslib.py
===================================================================
--- branches/maskedarray/numpy/tests/test_ctypeslib.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/numpy/tests/test_ctypeslib.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -1,63 +1,61 @@
-from numpy.testing import *
-set_package_path()
-import numpy as N
+import numpy as np
 from numpy.ctypeslib import ndpointer
-restore_path()
+from numpy.testing import *
 
 class TestNdpointer(NumpyTestCase):
     def check_dtype(self):
-        dt = N.intc
+        dt = np.intc
         p = ndpointer(dtype=dt)
-        self.assert_(p.from_param(N.array([1], dt)))
+        self.assert_(p.from_param(np.array([1], dt)))
         dt = '<i4'
         p = ndpointer(dtype=dt)
-        self.assert_(p.from_param(N.array([1], dt)))
-        dt = N.dtype('>i4')
+        self.assert_(p.from_param(np.array([1], dt)))
+        dt = np.dtype('>i4')
         p = ndpointer(dtype=dt)
-        p.from_param(N.array([1], dt))
+        p.from_param(np.array([1], dt))
         self.assertRaises(TypeError, p.from_param,
-                          N.array([1], dt.newbyteorder('swap')))
+                          np.array([1], dt.newbyteorder('swap')))
         dtnames = ['x', 'y']
-        dtformats = [N.intc, N.float64]
+        dtformats = [np.intc, np.float64]
         dtdescr = {'names' : dtnames, 'formats' : dtformats}
-        dt = N.dtype(dtdescr)
+        dt = np.dtype(dtdescr)
         p = ndpointer(dtype=dt)
-        self.assert_(p.from_param(N.zeros((10,), dt)))
-        samedt = N.dtype(dtdescr)
+        self.assert_(p.from_param(np.zeros((10,), dt)))
+        samedt = np.dtype(dtdescr)
         p = ndpointer(dtype=samedt)
-        self.assert_(p.from_param(N.zeros((10,), dt)))
-        dt2 = N.dtype(dtdescr, align=True)
+        self.assert_(p.from_param(np.zeros((10,), dt)))
+        dt2 = np.dtype(dtdescr, align=True)
         if dt.itemsize != dt2.itemsize:
-            self.assertRaises(TypeError, p.from_param, N.zeros((10,), dt2))
+            self.assertRaises(TypeError, p.from_param, np.zeros((10,), dt2))
         else:
-            self.assert_(p.from_param(N.zeros((10,), dt2)))
+            self.assert_(p.from_param(np.zeros((10,), dt2)))
 
     def check_ndim(self):
         p = ndpointer(ndim=0)
-        self.assert_(p.from_param(N.array(1)))
-        self.assertRaises(TypeError, p.from_param, N.array([1]))
+        self.assert_(p.from_param(np.array(1)))
+        self.assertRaises(TypeError, p.from_param, np.array([1]))
         p = ndpointer(ndim=1)
-        self.assertRaises(TypeError, p.from_param, N.array(1))
-        self.assert_(p.from_param(N.array([1])))
+        self.assertRaises(TypeError, p.from_param, np.array(1))
+        self.assert_(p.from_param(np.array([1])))
         p = ndpointer(ndim=2)
-        self.assert_(p.from_param(N.array([[1]])))
+        self.assert_(p.from_param(np.array([[1]])))
 
     def check_shape(self):
         p = ndpointer(shape=(1,2))
-        self.assert_(p.from_param(N.array([[1,2]])))
-        self.assertRaises(TypeError, p.from_param, N.array([[1],[2]]))
+        self.assert_(p.from_param(np.array([[1,2]])))
+        self.assertRaises(TypeError, p.from_param, np.array([[1],[2]]))
         p = ndpointer(shape=())
-        self.assert_(p.from_param(N.array(1)))
+        self.assert_(p.from_param(np.array(1)))
 
     def check_flags(self):
-        x = N.array([[1,2,3]], order='F')
+        x = np.array([[1,2,3]], order='F')
         p = ndpointer(flags='FORTRAN')
         self.assert_(p.from_param(x))
         p = ndpointer(flags='CONTIGUOUS')
         self.assertRaises(TypeError, p.from_param, x)
         p = ndpointer(flags=x.flags.num)
         self.assert_(p.from_param(x))
-        self.assertRaises(TypeError, p.from_param, N.array([[1,2,3]]))
+        self.assertRaises(TypeError, p.from_param, np.array([[1,2,3]]))
 
 if __name__ == "__main__":
     NumpyTest().run()

Modified: branches/maskedarray/setup.py
===================================================================
--- branches/maskedarray/setup.py	2008-01-18 10:04:48 UTC (rev 4729)
+++ branches/maskedarray/setup.py	2008-01-18 23:25:32 UTC (rev 4730)
@@ -15,6 +15,7 @@
 
 DOCLINES = __doc__.split("\n")
 
+import __builtin__
 import os
 import sys
 
@@ -37,6 +38,12 @@
 # update it when the contents of directories change.
 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
 
+# This is a bit hackish: we are setting a global variable so that the main
+# numpy __init__ can detect if it is being loaded by the setup routine, to
+# avoid attempting to load components that aren't built yet.  While ugly, it's
+# a lot more robust than what was previously being used.
+__builtin__.__NUMPY_SETUP__ = True
+
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
 




More information about the Numpy-svn mailing list