NRAO Home > CASA > CASA Toolkit Reference Manual
image.rebin - Function

1.1.1 Rebin an image by the specified integer factors


Description

This application rebins the current image by the specified integer binning factors for each axis. It supports both float valued and complex valued images. The corresponding output pixel value is the average of the input pixel values. The output pixel will be masked bad if there were no good input pixels. A polarization axis cannot be rebinned.

The binning factors array must contain at least one element and no more elements than the number of input image axes. If the number of elements specified is less than the number of image axes, then the remaining axes not specified are not rebinned. All specified values must be positive. A value of one indicates that no rebinning of the associated axis will occur.

Binning starts from the origin pixel of the bounding box of the selected region or the origin pixel of the input image if no region is specified. The value of crop is used to determine how to handle cases where there are pixels at the end of the axis that do not form a complete bin. If crop=True, extra pixels at the end of the axis are discarded. If crop=False, the remaining pixels are averaged into the final bin along that axis. Should the length of the axis to be rebinned be an integral multiple of the associated binning factor, the value of crop is irrelevant.

A value of dropdeg=True will result in the output image not containing axes that are degenerate in the specified region or in the input image if no region is specified. Note that, however, the binning factors array must still account for degenerate axes, and the binning factor associated with a degenerate axis must always be 1.

If outfile is given, the image is written to the specified disk file. If outfile is unset, the Image tool is associated with a temporary image. This temporary image may be in memory or on disk, depending on its size. When you destroy the on-the-fly Image tool returned by this function (with the done function) this temporary image is deleted.

Arguments





Inputs

outfile

Output image file name. Default is unset.

allowed:

string

Default:

bin

Binning factors for each axis

allowed:

intArray

Default:

region

Region selection. Default is to use the full image.

allowed:

any

Default:

variant

mask

Mask to use. Default is none.

allowed:

any

Default:

variant

dropdeg

Drop degenerate axes

allowed:

bool

Default:

false

overwrite

Overwrite (unprompted) pre-existing output file?

allowed:

bool

Default:

false

async

Run asynchronously?

allowed:

bool

Default:

false

stretch

Stretch the mask if necessary and possible? Default False

allowed:

bool

Default:

false

crop

Remove pixels from the end of an axis to be rebinned if there are not enough to form an integral bin?

allowed:

bool

Default:

false

Returns
image

Example

 
 
"""  
#  
print "\t----\t rebin Ex 1 \t----"  
ia.maketestimage();  
im2 = ia.rebin(bin=[2,3]);  
im2.done()  
ia.close()  
#  
"""  
 

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright © 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search