djs_laxisnum

pydl.pydlutils.misc.djs_laxisnum(dims, iaxis=0)[source]

Returns an integer array where each element of the array is set equal to its index number in the specified axis.

Parameters:
dimslist

Dimensions of the array to return.

iaxisint, optional

Index along this dimension.

Returns:
numpy.ndarray

An array of indexes with dtype=int32.

Raises:
ValueError

If iaxis is greater than or equal to the number of dimensions, or if number of dimensions is greater than three.

Notes

For two or more dimensions, there is no difference between this routine and djs_laxisgen().

Examples

>>> from pydl.pydlutils.misc import djs_laxisnum
>>> print(djs_laxisnum([4,4]))
[[0 0 0 0]
 [1 1 1 1]
 [2 2 2 2]
 [3 3 3 3]]