2012-10-03 14:39:37 -04:00
|
|
|
subroutine peakdt9(c0,npts8,nsps8,istart,foffset,idtpk)
|
2012-10-03 13:47:55 -04:00
|
|
|
|
|
|
|
complex c0(0:npts8-1)
|
|
|
|
complex zsum
|
2012-10-22 15:18:24 -04:00
|
|
|
include 'jt9sync.f90'
|
2012-10-03 13:47:55 -04:00
|
|
|
|
|
|
|
twopi=8.0*atan(1.0)
|
|
|
|
smax=0.
|
2012-11-13 15:23:03 -05:00
|
|
|
tstep=0.0625*nsps8/1500.0
|
|
|
|
idtmax=2.5/tstep
|
2012-10-03 13:47:55 -04:00
|
|
|
|
|
|
|
f0=foffset
|
|
|
|
dphi=twopi*f0/1500.0
|
2012-11-15 11:34:14 -05:00
|
|
|
|
|
|
|
idtstep=4
|
|
|
|
if(idtmax.lt.30) idtstep=2
|
|
|
|
if(idtmax.lt.15) idtstep=1
|
|
|
|
idt1=-idtmax
|
|
|
|
idt2=idtmax
|
|
|
|
|
|
|
|
10 do idt=idt1,idt2,idtstep
|
2012-10-03 14:39:37 -04:00
|
|
|
i0=istart + 0.0625*nsps8*idt
|
2012-10-03 13:47:55 -04:00
|
|
|
sum=0.
|
|
|
|
do j=1,16
|
2012-11-14 10:30:21 -05:00
|
|
|
i1=max(0,(ii(j)-1)*nsps8 + i0)
|
|
|
|
i2=min(npts8-1,i1+nsps8-1)
|
2012-10-03 13:47:55 -04:00
|
|
|
phi=0.
|
|
|
|
zsum=0.
|
2012-11-14 10:30:21 -05:00
|
|
|
do i=i1,i2
|
2012-10-03 14:39:37 -04:00
|
|
|
if(i.lt.0 .or. i.gt.npts8-1) cycle
|
2012-10-03 13:47:55 -04:00
|
|
|
phi=phi + dphi
|
2012-11-14 10:30:21 -05:00
|
|
|
zsum=zsum + c0(i)*cmplx(cos(phi),-sin(phi))
|
2012-10-03 13:47:55 -04:00
|
|
|
enddo
|
|
|
|
sum=sum + real(zsum)**2 + aimag(zsum)**2
|
|
|
|
enddo
|
|
|
|
if(sum.gt.smax) then
|
|
|
|
idtpk=idt
|
|
|
|
smax=sum
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
2012-11-15 11:34:14 -05:00
|
|
|
if(idtstep.gt.1) then
|
|
|
|
idtstep=1
|
|
|
|
idt1=idtpk-1
|
|
|
|
idt2=idtpk+1
|
|
|
|
go to 10
|
|
|
|
endif
|
|
|
|
|
2012-10-03 13:47:55 -04:00
|
|
|
return
|
|
|
|
end subroutine peakdt9
|