rotate

sofia_redux.instruments.forcast.rotate.rotate(data, angle, header=None, variance=None, order=1, center=None, missing=nan, missing_limit=0.001, threshold=0.5, strip_border=True)[source]

Rotate an image by the specified amount

Rotates an image angle degrees clockwise around center. A secondary image (variance) array may be supplied to rotate in parallel.

If center is provided, it will be used as the center of rotation. Otherwise, the center is defined as array_shape / 2 with indexing starting at zero. Note that WCS header uses indexing starting at 1.

Parameters:
datanumpy.ndarray

The image array to shift (nrow, ncol)

anglefloat

angle in degrees to rotate the image clockwise around center

headerastropy.io.fits.header.Header

If a header is provided, valid WCS will be updated

variancenumpy.ndarray, optional

Variance array (nrow, ncol) to update in parallel with data

orderint, optional
Interpolation order.

0 - nearest-neighbor 1 - bilinear >=2 - spline of the same order

centerarray_like, optional

If provided, will be used as the center of the rotation.

missingfloat, optional

missing data fill value

missing_limitfloat, optional

data weighted less than this fraction will be replaced with missing

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.

strip_borderbool, optional

If True, strip any NaN only rows or columns from the edges of the rotated image. WCS will be upated accordingly. If False, the image will not be resized; data falling outside the image borders will be lost.

Returns:
numpy.ndarray, numpy.ndarray

The rotated image (nrow, ncol) The rotated variance (nrow, ncol) or None if not supplied