webbpsf_ext.image_manip.rotate_offset

webbpsf_ext.image_manip.rotate_offset(data, angle, cen=None, cval=0.0, order=1, reshape=True, recenter=True, shift_func=<function fshift>, **kwargs)[source]

Rotate and offset an array.

Same as rotate in scipy.ndimage.interpolation except that it rotates around a center point given by cen keyword. The array is rotated in the plane defined by the two axes given by the axes parameter using spline interpolation of the requested order. Default rotation is clockwise direction.

Parameters
  • data (ndarray) – The input array.

  • angle (float) – The rotation angle in degrees (rotates in clockwise direction).

  • cen (tuple) – Center location around which to rotate image. Values are expected to be (xcen, ycen).

  • recenter (bool) – Do we want to reposition so that cen is the image center?

  • shift_func (function) – Function to use for shifting. Usually either fshift or fourier_imshift.

Keyword Arguments
  • axes (tuple of 2 ints, optional) – The two axes that define the plane of rotation. Default is the first two axes.

  • reshape (bool, optional) – If reshape is True, the output shape is adapted so that the input array is contained completely in the output. Default is True.

  • order (int, optional) – The order of the spline interpolation, default is 1. The order has to be in the range 0-5.

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

  • cval (scalar, optional) – Value used for points outside the boundaries of the input if mode='constant'. Default is 0.0

  • prefilter (bool, optional) – The parameter prefilter determines if the input is pre-filtered with spline_filter before interpolation (necessary for spline interpolation of order > 1). If False, it is assumed that the input is already filtered. Default is True.

Returns

rotate (ndarray or None) – The rotated data.