subroutine jtty_peakup(c0,c1,csync,nchunk,nss,xdt0,f0,xdt,f1,snr) implicit none complex, intent(in) :: c0(0:nchunk-1) !Complex data at 6000 S/s complex :: c1(0:nchunk-1) !Work array complex, intent(in) :: csync(0:13*nss-1) complex :: c(0:13*nss-1) !Lengh of Barker sequence complex :: z complex :: zcur(0:12), zbest(0:12), ztot complex :: qstep(0:12) real :: a(3) real :: fsample, dt, pmax, fpk, xdtpk, xnorm, p real :: phase(0:12), uw(0:12) real :: dphi, xm, ym, sxy, sxx, slope, intercept real :: resid, resid_rms, dfhz, tsym integer, intent(in) :: nchunk, nss integer :: i, i0, ia, ib, idf, istart, iend, npsync, r integer, parameter :: hop=4 real, intent(in) :: xdt0, f0 real, intent(out) :: xdt, f1, snr real, parameter :: TWOPI = 6.283185307179586 real, parameter :: PI = 3.141592653589793 npsync=13*nss ! size of the sync waveform array do i=0,12 istart=i*nss qstep(i)=csync(istart+hop)*conjg(csync(istart)) enddo fsample=6000.0 dt=1.0/fsample ia=max(0,nint((xdt0-0.004)/dt)) ! ib must bound the i0 loop against c1's actual size (nchunk), not ! npsync (an unrelated length) -- else ib