decode_context¶
- drizzle.utils.decode_context(context, x, y)[source]¶
Get 0-based indices of input images that contributed to (resampled) output pixel with coordinates
xandy.- Parameters:
context (numpy.ndarray) – A 3D ~numpy.ndarray of integral data type.
x (int, list of integers, numpy.ndarray of integers) – X-coordinate of pixels to decode (3rd index into the
contextarray)y (int, list of integers, numpy.ndarray of integers) – Y-coordinate of pixels to decode (2nd index into the
contextarray)
- Returns:
A list of numpy.ndarray objects each containing indices of input images
that have contributed to an output pixel with coordinates
xandy.The length of returned list is equal to the number of input coordinate
arrays
xandy.
Examples
An example context array for an output image of array shape
(5, 6)obtained by resampling 80 input images.>>> import numpy as np >>> from drizzle.utils import decode_context >>> ctx = np.array( ... [[[0, 0, 0, 0, 0, 0], ... [0, 0, 0, 36196864, 0, 0], ... [0, 0, 0, 0, 0, 0], ... [0, 0, 0, 0, 0, 0], ... [0, 0, 537920000, 0, 0, 0]], ... [[0, 0, 0, 0, 0, 0,], ... [0, 0, 0, 67125536, 0, 0], ... [0, 0, 0, 0, 0, 0], ... [0, 0, 0, 0, 0, 0], ... [0, 0, 163856, 0, 0, 0]], ... [[0, 0, 0, 0, 0, 0], ... [0, 0, 0, 8203, 0, 0], ... [0, 0, 0, 0, 0, 0], ... [0, 0, 0, 0, 0, 0], ... [0, 0, 32865, 0, 0, 0]]], ... dtype=np.int32 ... ) >>> decode_context(ctx, [3, 2], [1, 4]) [array([ 9, 12, 14, 19, 21, 25, 37, 40, 46, 58, 64, 65, 67, 77]), array([ 9, 20, 29, 36, 47, 49, 64, 69, 70, 79])]