func offset1dc(x1, x2, nc)
 ;returns the offset bewteen x1 and x2
 ;differs from offset1d in that only the central nc of the cross-correlation
 ;is examined for a peak, this is useful when spurious peaks not near center
 ;are possible
 if !narg ne 3 then { ty,'OFFSET1DC requires 3 arguments'  retall }
 cc = cross(x1, x2)
 ;get subpixel shift
 n = num_elem(cc)
 j1=(n-nc)/2  j2=j1+nc-1
 
 i2 = maxloc(cc(j1:j2))+j1
 i2 = i2 > 1	i2 = i2 < (n-2)
 c2 = cc(i2)
 c1 = cc(i2-1)
 c3 = cc(i2+1)
 dx = (c1-c3)*.5/(c3+c1-2.*c2)
 ;ty, 'maxloc =', i2
 ;ty,'c1,c2,c3 =', c1,c2,c3
 ;ty,'derived dx =', dx
 ;add the offset from n/2
 dx = dx +(i2-n/2)
 ;ty,'complete dx =', dx
 return, dx
 endfunc
;=================================================================
