ccdproc.rebin(*args, **kwargs)[source]

Deprecated since version 1.1: The rebin function is deprecated and may be removed in a future version.

Rebin an array to have a new shape.


ccd : CCDData or numpy.ndarray

Data to rebin.

newshape : tuple

Tuple containing the new shape for the array.


output : CCDData or numpy.ndarray

An array with the new shape. It will have the same type as the input object.



A type error is raised if data is not an numpy.ndarray or CCDData.


A value error is raised if the dimension of the new shape is not equal to the data’s.


This is based on the scipy cookbook for rebinning:

If rebinning a CCDData object to a smaller shape, the masking and uncertainty are not handled correctly.


Given an array that is 100x100:

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

The syntax for rebinning an array to a shape of (20,20) is:

rebin(arr1, (20,20))