summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2009-02-14 22:10:24 +0000
committerPauli Virtanen <pav@iki.fi>2009-02-14 22:10:24 +0000
commit11943ab29867441fc0b8662f77eb788afc5f4f46 (patch)
tree6c01b7b37d5064afaae77a2f4139d1c8bf8636a7 /numpy
parent9902bd1969a738ddec9e01d019d98142dda59f3f (diff)
downloadnumpy-11943ab29867441fc0b8662f77eb788afc5f4f46.tar.gz
Move (un)packbits docstrings to add_newdocs.py. Fix typos.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/add_newdocs.py46
-rw-r--r--numpy/lib/src/_compiled_base.c33
2 files changed, 44 insertions, 35 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index e283c8a62..68224485c 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -2502,11 +2502,11 @@ add_newdoc('numpy.core.umath', 'seterrobj',
##############################################################################
#
-# 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 @@ add_newdoc('numpy.lib._compile_base', 'digitize',
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 @@ add_newdoc('numpy.lib._compile_base', 'bincount',
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,6 +2543,44 @@ add_newdoc('numpy.lib._compile_base', 'add_docstring',
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.
+ """)
+
##############################################################################
#
diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c
index d6982bc9c..54955e60a 100644
--- a/numpy/lib/src/_compiled_base.c
+++ b/numpy/lib/src/_compiled_base.c
@@ -544,35 +544,6 @@ arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args)
}
-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 @@ static struct PyMethodDef methods[] = {
{"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 */
};