- sunpy.image.transform.add_rotation_function(name, *, allowed_orders, handles_clipping, handles_image_nans, handles_nan_missing)¶
Decorator to add a rotation function to the registry of selectable implementations.
Each registered rotation function becomes a selectable option for
sunpy.map.GenericMap.rotate(). Those two routines are required to handle clipping the output image, NaNs in the input image, and NaN as the value to use for pixels in the output image that are beyond the extent of the input image. If the supplied rotation function cannot provide one or more of these capabilities, the decorator is able to provide them instead.
The decorator requires the parameters listed under
Parameters. The decorated rotation function must accept the parameters listed under
Other Parametersin that order and return the rotated image.
str) – The name that will be used to select the rotation function
set) – The allowed values for the
bool) – Specifies whether the rotation function will internally perform clipping. If
False, the rotation function will always receive
bool) – Specifies whether the rotation function will internally handle NaNs in the input image. If
False, the rotation function is guaranteed to be provided an image without any NaNs.
bool) – Specifies whether the rotation function will internally handle NaN as the
False, the rotation function will never receive NaN, but instead receive a value in the input range of the image.
- Other Parameters
numpy.ndarray) – The image, which could be integers or floats
numpy.ndarraythat is 2x2) – The linear transformation matrix (e.g., rotation+scale+skew)
numpy.ndarray) – The translational shift to apply to the image in each axis
int) – The numerical parameter that controls the degree of interpolation
float) – The value to use for outside the bounds of the original image
bool) – Whether to clip the output image to the range of the input image
The docstring of the rotation function should be a bulleted list of notes specific to the rotation function. It will be appended to
Notessection of the docstring for
The rotation function is supplied the input image directly, so the function should not modify the image in place.
Setting any of the
Falsemeans that computation will be performed to modify the image returned by the rotation function before it is returned to
If the decorator is handling image NaNs on behalf of the rotation function (i.e.,
handles_image_nans=False), pixels in the output image will be set to NaN if they are within a certain neighborhood size that depends on the
orderparameter. This step requires an additional image convolution, which might be avoidable if the rotation function were able to internally handle image NaNs. This convolution normally uses
scipy.signal.convolve2d(), but if OpenCV is installed, the faster cv2.filter2D() is used instead.