rotate_image_with_mask

sofia_redux.instruments.forcast.rotate.rotate_image_with_mask(image, angle, center=None, order=1, shift=None, output_shape=None, inverse=False, threshold=0.5, cval=nan, missing_limit=0.001)[source]

Rotate an image, using a mask for interpolation and edge corrections.

Parameters:
imagenumpy.ndarray or None

The image to rotate. If None is supplied, it is also returned.

angleint or float

The angle by which to rotate the image in degrees.

centernumpy.ndarray, optional

The point about which to rotate the image of shape (n_dimensions,) using the Numpy (y, x) dimensional ordering convention. By default this is (image.shape-1)/2.

orderint, optional

The spline interpolation order. Must be in the range 0-5.

shiftnumpy.ndarray, optional

An optional shift to apply prior to the forward transform rotation of shape (n_dimensions,) using the Numpy (y, x) convention. Please see rotate_coordinates_about() for further details.

output_shapetuple (int)

The output shape for the rotated image of length n_dimensions using the Numpy (y, x) ordering convention.

inversebool, optional

If True, perform the inverse rotation (rotate by -angle). Please see rotate_coordinates_about() for further details.

thresholdfloat, optional

Used in conjunction with cval`=NaN and `mode`='constant'.  Should generally take values in the range -1 to 1 with a default of 0.5. This is used to better apply NaN `cval boundaries as expected. Points inside the boundaries are mapped to 1, and values outside are mapped to -1. Points which map to values >= threshold are considered valid, while others will be set to NaN in the output. Please see map_coordinates() for further details.

cvalint or float, optional

Used in conjunction with mode`='constant' to fill in values outside the boundaries of `image, and also to replace rotated NaN values or values that fall below missing_limit in the rotated mask.

missing_limitfloat, optional

data weighted less than this fraction will be replaced with cval.

Returns:
rotatednumpy.ndarray

The rotated image with the same shape as image or output_shape.