iter_spaxel

threadcount.fit.iter_spaxel(image, index=False)[source]

Create an iterator over the spaxels of successive image pixels in a 2d numpy array.

Each call to the iterator returns the value of the array image at a spaxel. The first spaxel to be addressed of image is pixel 0,0. Thereafter the X-axis pixel index is incremented by one at each call (modulus the length of the X-axis), and the Y-axis pixel index is incremented by one each time that the X-axis index wraps back to zero.

The return value of iter_spaxel() is a python generator that can be used in loops

Parameters:
  • image (2d numpy.ndarray) – The image to be iterated over.

  • index (bool) – If False, return just a value at each iteration. If True, return both a value and the pixel index of that spaxel in the image (a tuple of image-array indexes along the axes (y,x)).

Yields:

dtype of image