| |
- lindgen(shape)
- Create an Int array of shape filled with 1-D indices.
Output is a long integer Numeric array with shape given by
argument shape, where the elements of the array are filled with
the values of the 1-D indices that would be given in a Numeric.
ravel()ed version of the array. This function is similar in
purpose to the IDL LINDGEN function.
Positional Input Argument:
* shape: If is 1-D tuple of integers, argument specifies the
shape of the output array. If argument shape is a scalar, the
output array is a 1-D vector with argument shape number of
elements.
Examples:
>>> from lindgen import lindgen
>>> array = lindgen(5)
>>> ['%.2g' % array[i] for i in range(len(array))]
['0', '1', '2', '3', '4']
>>> array.shape
(5,)
>>> array.typecode()
'l'
>>> array = lindgen((3,4))
>>> ['%.2g' % array[0,i] for i in range(4)]
['0', '1', '2', '3']
>>> ['%.2g' % array[1,i] for i in range(4)]
['4', '5', '6', '7']
>>> ['%.2g' % array[2,i] for i in range(4)]
['8', '9', '10', '11']
>>> array.shape
(3, 4)
|