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

Transform the image.

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


ccd : CCDData

Data to be transformed.

transform_func : callable

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

kwargs :

Additional keyword arguments to be used by the transform_func.

add_keyword : str, 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.


ccd : CCDData

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.interpolation import shift
>>> from ccdproc import transform_image
>>> transformed = transform_image(arr1, shift, shift=(5.5, 8.1))