jax.scipy.ndimage.map_coordinatesÂ¶

jax.scipy.ndimage.
map_coordinates
(input, coordinates, order, mode='constant', cval=0.0)[source]Â¶ Map the input array to new coordinates by interpolation.
LAXbackend implementation of
map_coordinates()
.Only nearest neighbor (
order=0
), linear interpolation (order=1
) and modes'constant'
,'nearest'
and'wrap'
are currently supported. Note that interpolation near boundaries differs from the scipy function, because we fixed an outstanding bug (https://github.com/scipy/scipy/issues/2640); this function interprets themode
argument as documented by SciPy, but not as implemented by SciPy.Original docstring below.
The array of coordinates is used to find, for each point in the output, the corresponding coordinates in the input. The value of the input at those coordinates is determined by spline interpolation of the requested order.
The shape of the output is derived from that of the coordinate array by dropping the first axis. The values of the array along the first axis are the coordinates in the input array at which the output value is found.
 Parameters
input (array_like) â€“ The input array.
coordinates (array_like) â€“ The coordinates at which input is evaluated.
order (int, optional) â€“ The order of the spline interpolation, default is 3. The order has to be in the range 05.
mode ({'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional) â€“
The mode parameter determines how the input array is extended beyond its boundaries. Default is â€˜constantâ€™. Behavior for each valid value is as follows (see additional plots and details on boundary modes):
 â€™reflectâ€™ (d c b a  a b c d  d c b a)
The input is extended by reflecting about the edge of the last pixel. This mode is also sometimes referred to as halfsample symmetric.
 â€™gridmirrorâ€™
This is a synonym for â€˜reflectâ€™.
 â€™constantâ€™ (k k k k  a b c d  k k k k)
The input is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter. No interpolation is performed beyond the edges of the input.
 â€™gridconstantâ€™ (k k k k  a b c d  k k k k)
The input is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter. Interpolation occurs for samples outside the inputâ€™s extent as well.
 â€™nearestâ€™ (a a a a  a b c d  d d d d)
The input is extended by replicating the last pixel.
 â€™mirrorâ€™ (d c b  a b c d  c b a)
The input is extended by reflecting about the center of the last pixel. This mode is also sometimes referred to as wholesample symmetric.
 â€™gridwrapâ€™ (a b c d  a b c d  a b c d)
The input is extended by wrapping around to the opposite edge.
 â€™wrapâ€™ (d b c d  a b c d  b c a b)
The input is extended by wrapping around to the opposite edge, but in a way such that the last point and initial point exactly overlap. In this case it is not well defined which sample will be chosen at the point of overlap.
cval (scalar, optional) â€“ Value to fill past edges of input if mode is â€˜constantâ€™. Default is 0.0.
 Returns
map_coordinates â€“ The result of transforming the input. The shape of the output is derived from that of coordinates by dropping the first axis.
 Return type