Last modified: December 2022

AHELP for CIAO 4.16


Context: Tools::Image


Cross-correlate two N-dimensional images or autocorrelate an image


acrosscorr  infile1 infile2 outfile [crop] [pad] [center] [clobber]


Compute the correlation of two N-dimensional images or compute the autocorrelation of a single N-D image (when infile2 is set to "NONE").

`acrosscorr' uses the FFT method of computing the cross-correlation, which assumes that the edges wrap around. The cross-correlation of two arrays is computed as:

C = inverseFFT( FFT(A) * FFT(B)' )

which differs from FFT convolution only in the complex conjugation of the FFT of the 2nd array.


Example 1

acrosscorr infile1=sig1.fits infile2=sig2.fits outfile=my_out.fits

Correlate the arrays (stored as images) in files sig1.fits and sig2.fits and store the results in my_out.fits

Example 2

acrosscorr infile1=my_evts.fits[STDEVT][bin time=0:10000:1]
infile2=none outfile=/tmp/time.fits center=yes

Creates a 1-D "image" from the STDEVT table in the file my_evts.fits, binned on the time column from 0 to 10000 in 1 [unit] bins, then calculates the autocorrelation of this image. The output is centered such that 0 offset is in the center of the array.

Example 3

acrosscorr infile1=sig1.fits infile2=bigger_sig2.fits
outfile=/tmp/my_out.fits crop=yes

The output is cropped to the size of sig1.fits


name type ftype def min max reqd autoname
infile1 file input       yes  
infile2 file input       yes  
outfile file output       yes yes
crop boolean   no        
pad boolean   no        
center boolean   no        
clobber boolean   no        
verbose integer   0 0 5    

Detailed Parameter Descriptions

Parameter=infile1 (file required filetype=input)

First input image file.

The input image can have the following data types: "short" (BITPIX=16), "long" (BITPIX=32), "float" (BITPIX=-32), and "double" (BITPIX=-64). Complex inputs are not currently supported. Alternatively a FITS binary table can be binned using the datamodel syntax to specify the image (see example).

Parameter=infile2 (file required filetype=input)

Second input image file. If infile2 is "NONE" (or 'none'), then the autocorrelation of infile1 is computed. Otherwise, the syntax is the same as for infile1.

Parameter=outfile (file required filetype=output autoname=yes)

Output image file.

The output image is an image of type FLOAT (32bit IEEE floating point number). The pad and crop parameters determine the output size. By default, the output image is the maximum size in each direction from both input files. Thus if infile1 is 5x2 and infile2 is 3x3, the output will be 5x3. The autoname filename suffix is "_corr".

Parameter=crop (boolean default=no)

If crop = yes, the output is cropped to the size of infile1.

If crop = yes, the output is cropped to the size of infile1. Cropping is done after the correlation is performed, so if both crop and pad are set to "yes", the final output will be cropped.

Parameter=pad (boolean default=no)

If pad = yes, the data are padded to the size of infile1 + infile2.

If pad = yes, the data are padded to the size of infile1 + infile2. Padding is done before the correlation is performed.

Parameter=center (boolean default=no)

If center=yes, the zero-offset point will be in the center of the output data array. Otherwise, it will be at the 1 pixel location.

Parameter=clobber (boolean default=no)

Clobber existing output files?

Parameter=verbose (integer default=0 min=0 max=5)

Processing verbosity; 0 is no output, 5 is high verbosity.


There are no known bugs for this tool.

See Also

aconvolve, apowerspectrum, arestore, csmooth, dmfilth, dmregrid
arfcorr, make_psf_asymmetry_region, psf_project_ray, simulate_psf, src_psffrac