ccdproc.transform_image(ccd, transform_func, **kwargs)[source]

Transform the image.

Using the function specified by transform_func, the transform will be applied to data, uncertainty, and mask in ccd.


Data to be transformed.


Function to be used to transform the data, mask and uncertainty.


Additional keyword arguments to be used by the transform_func.

add_keywordstr, Keyword or dict-like, optional

Item(s) to add to metadata of result. Set to False or None to completely disable logging. Default is to add a dictionary with a single item: The key is the name of this function and the value is a string containing the arguments the function was called with, except the value of this argument.


A transformed CCDData object.


At this time, transform will be applied to the uncertainty data but it will only transform the data. This will not properly handle uncertainties that arise due to correlation between the pixels.

These should only be geometric transformations of the images. Other methods should be used if the units of ccd need to be changed.


Given an array that is 100x100:

>>> import numpy as np
>>> from astropy import units as u
>>> arr1 = CCDData(np.ones([100, 100]), unit=u.adu)

The syntax for transforming the array using scipy.ndimage.shift:

>>> from scipy.ndimage import shift
>>> from ccdproc import transform_image
>>> transformed = transform_image(arr1, shift, shift=(5.5, 8.1))