numpy.ogrid

numpy.ogrid()

Construct a multi-dimensional open “meshgrid”.

Returns an ‘open’ 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.

The returned mesh-grid is open (or not fleshed out), so that only one-dimension of each returned argument is greater than 1

If the step length is a complex number (e.g. 5j), then the integer part of its magnitude is interpreted as specifying the number of points to create between the start and stop values, where the stop value is inclusive.

See also

mgrid

Examples

>>> np.ogrid[0:5,0:5]
[array([[0],
        [1],
        [2],
        [3],
        [4]]), array([[0, 1, 2, 3, 4]])]

Previous topic

numpy.ix

Next topic

numpy.unravel_index

This Page

Quick search