djs_laxisgen

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

Returns an integer array where each element of the array is set equal to its index number along 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.

Notes

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

Examples

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