2017-10-21 20:09:01 -04:00
|
|
|
!subroutine symspec65(dd,npts,ss,nqsym,savg)
|
|
|
|
subroutine symspec65(dd,npts,nqsym,savg)
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2017-10-21 20:09:01 -04:00
|
|
|
! Compute JT65 symbol spectra at quarter-symbol steps
|
2013-07-08 09:17:22 -04:00
|
|
|
|
|
|
|
parameter (NFFT=8192)
|
|
|
|
parameter (NSZ=3413) !NFFT*5000/12000
|
|
|
|
parameter (MAXHSYM=322)
|
2017-10-21 20:09:01 -04:00
|
|
|
parameter (MAXQSYM=552)
|
2013-07-08 09:17:22 -04:00
|
|
|
real*8 hstep
|
|
|
|
real*4 dd(npts)
|
2017-10-21 20:09:01 -04:00
|
|
|
! real*4 ss(MAXHSYM,NSZ)
|
|
|
|
real*4 ss(MAXQSYM,NSZ)
|
2013-07-08 09:17:22 -04:00
|
|
|
real*4 savg(NSZ)
|
|
|
|
real*4 x(NFFT)
|
2015-02-10 19:50:35 -05:00
|
|
|
real*4 w(NFFT)
|
2013-07-08 09:17:22 -04:00
|
|
|
complex c(0:NFFT/2)
|
2015-02-10 19:50:35 -05:00
|
|
|
logical first
|
2013-07-08 09:17:22 -04:00
|
|
|
common/refspec/dfref,ref(NSZ)
|
|
|
|
equivalence (x,c)
|
2015-02-10 19:50:35 -05:00
|
|
|
data first/.true./
|
|
|
|
save /refspec/,first,w
|
2017-10-21 20:09:01 -04:00
|
|
|
common/sync/ss
|
2013-07-08 09:17:22 -04:00
|
|
|
|
|
|
|
hstep=2048.d0*12000.d0/11025.d0 !half-symbol = 2229.116 samples
|
2017-10-21 20:09:01 -04:00
|
|
|
qstep=hstep/2.0 !quarter-symbol = 1114.558 samples
|
2013-07-08 09:17:22 -04:00
|
|
|
nsps=nint(2*hstep)
|
|
|
|
df=12000.0/NFFT
|
2015-02-10 19:50:35 -05:00
|
|
|
nhsym=(npts-NFFT)/hstep
|
2017-10-21 20:09:01 -04:00
|
|
|
nqsym=(npts-NFFT)/qstep
|
2013-07-08 09:17:22 -04:00
|
|
|
savg=0.
|
|
|
|
fac1=1.e-3
|
|
|
|
|
2015-02-10 19:50:35 -05:00
|
|
|
if(first) then
|
|
|
|
! Compute the FFT window
|
2017-10-21 20:09:01 -04:00
|
|
|
! width=0.25*nsps
|
2015-02-10 19:50:35 -05:00
|
|
|
do i=1,NFFT
|
2017-10-21 20:09:01 -04:00
|
|
|
! z=(i-NFFT/2)/width
|
|
|
|
w(i)=1
|
|
|
|
if(i.gt.4458) w(i)=0
|
|
|
|
! w(i)=exp(-z*z)
|
2015-02-10 19:50:35 -05:00
|
|
|
enddo
|
|
|
|
first=.false.
|
|
|
|
endif
|
|
|
|
|
2017-10-21 20:09:01 -04:00
|
|
|
do j=1,nqsym
|
|
|
|
i0=(j-1)*qstep
|
2015-02-10 19:50:35 -05:00
|
|
|
x=fac1*w*dd(i0+1:i0+NFFT)
|
2013-07-08 09:17:22 -04:00
|
|
|
call four2a(c,NFFT,1,-1,0) !r2c forward FFT
|
|
|
|
do i=1,NSZ
|
|
|
|
s=real(c(i))**2 + aimag(c(i))**2
|
|
|
|
ss(j,i)=s
|
|
|
|
savg(i)=savg(i)+s
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
savg=savg/nhsym
|
|
|
|
|
2017-10-21 20:09:01 -04:00
|
|
|
! call flat65(ss,nhsym,MAXQSYM,NSZ,ref) !Flatten the 2d spectrum, saving
|
|
|
|
call flat65(ss,nqsym,MAXQSYM,NSZ,ref) !Flatten the 2d spectrum, saving
|
2013-07-08 09:17:22 -04:00
|
|
|
dfref=df ! the reference spectrum ref()
|
|
|
|
savg=savg/ref
|
2017-10-21 20:09:01 -04:00
|
|
|
! do j=1,nhsym
|
|
|
|
do j=1,nqsym
|
2013-07-08 09:17:22 -04:00
|
|
|
ss(j,1:NSZ)=ss(j,1:NSZ)/ref
|
|
|
|
enddo
|
|
|
|
|
|
|
|
return
|
|
|
|
end subroutine symspec65
|