[Numpy-svn] r6365 - in trunk/numpy: . lib/src

numpy-svn@scip... numpy-svn@scip...
Sat Feb 14 16:11:00 CST 2009


Author: ptvirtan
Date: 2009-02-14 16:10:24 -0600 (Sat, 14 Feb 2009)
New Revision: 6365

Modified:
   trunk/numpy/add_newdocs.py
   trunk/numpy/lib/src/_compiled_base.c
Log:
Move (un)packbits docstrings to add_newdocs.py. Fix typos.

Modified: trunk/numpy/add_newdocs.py
===================================================================
--- trunk/numpy/add_newdocs.py	2009-02-14 22:09:26 UTC (rev 6364)
+++ trunk/numpy/add_newdocs.py	2009-02-14 22:10:24 UTC (rev 6365)
@@ -2502,11 +2502,11 @@
 
 ##############################################################################
 #
-# lib._compile_base functions
+# lib._compiled_base functions
 #
 ##############################################################################
 
-add_newdoc('numpy.lib._compile_base', 'digitize',
+add_newdoc('numpy.lib._compiled_base', 'digitize',
     """
     digitize(x,bins)
 
@@ -2519,7 +2519,7 @@
     Beyond the bounds of the bins 0 or len(bins) is returned as appropriate.
     """)
 
-add_newdoc('numpy.lib._compile_base', 'bincount',
+add_newdoc('numpy.lib._compiled_base', 'bincount',
     """
     bincount(x,weights=None)
 
@@ -2533,7 +2533,7 @@
     See also: histogram, digitize, unique.
     """)
 
-add_newdoc('numpy.lib._compile_base', 'add_docstring',
+add_newdoc('numpy.lib._compiled_base', 'add_docstring',
     """
     docstring(obj, docstring)
 
@@ -2543,7 +2543,45 @@
     raise a TypeError
     """)
 
+add_newdoc('numpy.lib._compiled_base', 'packbits',
+    """
+    out = numpy.packbits(myarray, axis=None)
 
+    myarray : an integer type array whose elements should be packed to bits
+
+    This routine packs the elements of a binary-valued dataset into a
+    NumPy array of type uint8 ('B') whose bits correspond to
+    the logical (0 or nonzero) value of the input elements.
+    The dimension over-which bit-packing is done is given by axis.
+    The shape of the output has the same number of dimensions as the input
+    (unless axis is None, in which case the output is 1-d).
+
+    Example:
+    >>> a = array([[[1,0,1],
+    ...             [0,1,0]],
+    ...            [[1,1,0],
+    ...             [0,0,1]]])
+    >>> b = numpy.packbits(a,axis=-1)
+    >>> b
+    array([[[160],[64]],[[192],[32]]], dtype=uint8)
+
+    Note that 160 = 128 + 32
+              192 = 128 + 64
+    """)
+
+add_newdoc('numpy.lib._compiled_base', 'unpackbits',
+    """
+    out = numpy.unpackbits(myarray, axis=None)
+
+    myarray - array of uint8 type where each element represents a bit-field
+        that should be unpacked into a boolean output array
+
+        The shape of the output array is either 1-d (if axis is None) or
+        the same shape as the input array with unpacking done along the
+        axis specified.
+    """)
+
+
 ##############################################################################
 #
 # Documentation for ufunc attributes and methods

Modified: trunk/numpy/lib/src/_compiled_base.c
===================================================================
--- trunk/numpy/lib/src/_compiled_base.c	2009-02-14 22:09:26 UTC (rev 6364)
+++ trunk/numpy/lib/src/_compiled_base.c	2009-02-14 22:10:24 UTC (rev 6365)
@@ -544,35 +544,6 @@
 }
 
 
-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
@@ -820,9 +791,9 @@
     {"add_docstring", (PyCFunction)arr_add_docstring, METH_VARARGS,
      NULL},
     {"packbits",  (PyCFunction)io_pack,       METH_VARARGS | METH_KEYWORDS,
-     packbits_doc},
+     NULL},
     {"unpackbits", (PyCFunction)io_unpack,     METH_VARARGS | METH_KEYWORDS,
-     unpackbits_doc},
+     NULL},
     {NULL, NULL}    /* sentinel */
 };
 



More information about the Numpy-svn mailing list