rotate

sofia_redux.toolkit.image.adjust.rotate(data, angle, order=1, missing=nan, nan_interpolation=0.0, missing_limit=0.001, mode='constant', pivot=None)[source]

Rotate an image.

Rotates an image angle degrees clockwise around center. I cannot find any interpolation algorithms in Python that handle NaNs (quickly), so do it myself.

Parameters:
datanumpy.ndarray

2 dimensional data array to rotate

anglefloat

angle in degrees to rotate the image clockwise around center

orderint, optional

interpolation order. 0 rotates by integer pixels; 1 shifts using bilinear interpolation; 2-5 shift_image using cubic-spline interpolation of the same order.

missingfloat or int, optional

value to fill past edges of input if edge is ‘constant’. Default is numpy.nan.

nan_interpolationfloat, optional

NaN values must be replaced by a real value before rotating. Setting this value to None will result in NaN values being replaced by an interpolated value using the Clough-Tocher scheme.

missing_limitfloat, optional

use as a threshold 0 to 1 to detect missing values

modestr, optional

Points outside the boundaries of the nearest input are filled according to the given mode (‘constant’, ‘nearest’, ‘reflect’, or ‘wrap’). Default is ‘constant’.

pivotarray_like

(y, x) coordinate of the center of rotation

Returns:
numpy.ndarray or None

The rotated image or None on failure