warp_image

sofia_redux.toolkit.image.warp.warp_image(data, xin, yin, xout, yout, order=3, interpolation_order=3, mode='constant', cval=nan, output_shape=None, missing_frac=0.5, extrapolate=True, get_transform=False)[source]

Warp data using transformation defined by two sets of coordinates

Parameters:
datanp.ndarray

input data (nrow, ncol)

xinarray-like

source x coordinate

yinarray-like

source y coordinate

xoutarray-like

destination x coordinate

youtarray-like

destination y coordinate

orderint, optional

polynomial order if transform=’polynomial’

interpolation_orderint, optional

order of interpolation for reconstruction. must be in the range 0-5.

cvalfloat, optional

values outside input boundaries to be replaced with cval if mode=’constant’.

modestr, optional

Points outside input boundaries are filled according to the given mode. cval

output_shapetuple of int

(rows, cols) If None, the input shape is preserved

missing_fracfloat, optional

value between 0 and 1. 1 = fully weighted by real values. 0 = fully weighted by NaNs. Any pixel weighted by less than this fraction will be replaced with cval.

extrapolatebool, optional

If False, values outside of the rectangular range of xout and yout will be set to cval.

get_transformbool, optional

If True, return the polynomial transform in addition to the results.

Returns:
warped, [transform]numpy.ndarray, [PolynomialTransform]

The warped data of shape (nrow, ncol) and the polynomial transform if get_transform is True.