iter_ima¶
-
mpdaf.obj.
iter_ima
(cube, index=False)[source]¶ An iterator over the images of successive spectral pixels in a Cube
Each call to the iterator returns the image of the next spectral pixel of the cube. The first image to be returned, is the image of spectral pixel 0, followed, on the next call, by the image of spectral pixel 1 etc.
The return value of iter_ima() is a python generator that can be used in loops, such as in the following example:
from mpdaf.obj import iter_ima for im,channel in iter_ima(mycube, index=True): print("Total flux in channel %d = %g" % (channel, im.data.sum()))
Parameters: cube :
Cube
The cube that contains the images to be returned.
index : bool
If False, return just an image at each iteration. If True, return both an image and the index of that image along the wavelength axis of the cube.
Returns: out : generator
A python generator object, suitable for using in a loop.