summaryrefslogtreecommitdiff
path: root/numpy/lib/index_tricks.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2008-05-19 10:45:14 +0000
committerStefan van der Walt <stefan@sun.ac.za>2008-05-19 10:45:14 +0000
commit40505ed9548af6a49f052abad9cd8ed36ba102dd (patch)
treeb77d58b68bdaf3e1314d6c4da161577144246685 /numpy/lib/index_tricks.py
parent10d7e0872f6ede40f55b47f415a93046523cc904 (diff)
downloadnumpy-40505ed9548af6a49f052abad9cd8ed36ba102dd.tar.gz
Merge documentation changes from wiki.
Diffstat (limited to 'numpy/lib/index_tricks.py')
-rw-r--r--numpy/lib/index_tricks.py82
1 files changed, 41 insertions, 41 deletions
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
index 2039d5b5e..4d82161bd 100644
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -83,47 +83,47 @@ def ix_(*args):
return tuple(out)
class nd_grid(object):
- """ Construct a "meshgrid" in N-dimensions.
-
- grid = nd_grid() creates an instance which will return a mesh-grid
- when indexed. The dimension and number of the output arrays are equal
- to the number of indexing dimensions. If the step length is not a
- complex number, then the stop is not inclusive.
-
- However, if the step length is a COMPLEX NUMBER (e.g. 5j), then the
- integer part of it's magnitude is interpreted as specifying the
- number of points to create between the start and stop values, where
- the stop value IS INCLUSIVE.
-
- If instantiated with an argument of sparse=True, the mesh-grid is
- open (or not fleshed out) so that only one-dimension of each returned
- argument is greater than 1
-
- Example:
-
- >>> mgrid = nd_grid()
- >>> mgrid[0:5,0:5]
- array([[[0, 0, 0, 0, 0],
- [1, 1, 1, 1, 1],
- [2, 2, 2, 2, 2],
- [3, 3, 3, 3, 3],
- [4, 4, 4, 4, 4]],
- <BLANKLINE>
- [[0, 1, 2, 3, 4],
- [0, 1, 2, 3, 4],
- [0, 1, 2, 3, 4],
- [0, 1, 2, 3, 4],
- [0, 1, 2, 3, 4]]])
- >>> mgrid[-1:1:5j]
- array([-1. , -0.5, 0. , 0.5, 1. ])
-
- >>> ogrid = nd_grid(sparse=True)
- >>> ogrid[0:5,0:5]
- [array([[0],
- [1],
- [2],
- [3],
- [4]]), array([[0, 1, 2, 3, 4]])]
+ """
+ Construct a multi-dimensional "meshgrid".
+
+ grid = nd_grid() creates an instance which will return a mesh-grid
+ when indexed. The dimension and number of the output arrays are equal
+ to the number of indexing dimensions. If the step length is not a
+ complex number, then the stop is not inclusive.
+
+ However, if the step length is a **complex number** (e.g. 5j), then the
+ integer part of it's magnitude is interpreted as specifying the
+ number of points to create between the start and stop values, where
+ the stop value **is inclusive**.
+
+ If instantiated with an argument of sparse=True, the mesh-grid is
+ open (or not fleshed out) so that only one-dimension of each returned
+ argument is greater than 1
+
+ Examples
+ --------
+ >>> mgrid = nd_grid()
+ >>> mgrid[0:5,0:5]
+ array([[[0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1],
+ [2, 2, 2, 2, 2],
+ [3, 3, 3, 3, 3],
+ [4, 4, 4, 4, 4]],
+ <BLANKLINE>
+ [[0, 1, 2, 3, 4],
+ [0, 1, 2, 3, 4],
+ [0, 1, 2, 3, 4],
+ [0, 1, 2, 3, 4],
+ [0, 1, 2, 3, 4]]])
+ >>> mgrid[-1:1:5j]
+ array([-1. , -0.5, 0. , 0.5, 1. ])
+ >>> ogrid = nd_grid(sparse=True)
+ >>> ogrid[0:5,0:5]
+ [array([[0],
+ [1],
+ [2],
+ [3],
+ [4]]), array([[0, 1, 2, 3, 4]])]
"""
def __init__(self, sparse=False):