+
Determination of the maximum of the cross-correlation function
of two equal-length vectors by fitting a polynomial or a Gaussian
IN: y1 - fltarr 1st vector
y2 - fltarr 2nd vector
s1 - fltarr error 1st vector
s2 - fltarr error 2nd vector
OUT: delta float shift to be applied to y2 to match y1
(max. of cross-correlation function)
(units are pixels)
e_delta float error in delta (pixels)
KEYWORDS: nrange integer half range of the shifts in the
cross-correlation integral
npoints- number of pixels around the minimum to enter the fit.
(default: 7)
order - order of the polynomial: 2 or 3 (default: 2 = 2nd order)
A gaussian can also specified with order<0 (or by
using the keyword 'gauss'.
gauss - use a Gaussian instead of a polynomial to model the
peak of the cross-correlation function
fourier - compute the cross-correlation in Fourier space
(nrange is n_elements(y1)/2-1 regardles of input nrange)
ycutoff - use this keyword to set a lower limit to the fluxes
included in the cross-correlation (this is
incompatible with the 'fourier' keyword)
extras - extra plotting keywords can be used and will be passed
along to plot
NOTES: By default, the cross-correlation runs through almost the full
length of the vectors by using the shift function on the 2nd vector:
The integration of the cross-correlation is therefore going from
-nrange to nrange, where nrange=n_elements(y)/2-1, but nrange can be
reduced when the cross-correlation is performed in pixel space.
When working on pixel space, the part of the second vector shifted
which exceeds the vector's length on one side is pasted on the other
side by calling the 'shift' function (i.e. the vectors are assumed
periodic).
C. Allende Prieto, UT@Austin, Nov 2004
, Oct 2006 -- improved error calculation
, Dec 2006 -- added Gaussian model
, July 2009 -- added ycutoff keyword