Correct the alignment of data returned to id2 when reference spectrum is used.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6625 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-04-18 14:37:44 +00:00
parent 1a9c6b3b6f
commit c849652940

View File

@ -5,7 +5,7 @@ subroutine refspectrum(id2,brefspec,buseref,fname)
! brefspec logical True when accumulating a reference spectrum ! brefspec logical True when accumulating a reference spectrum
parameter (NFFT=6912,NH=NFFT/2) parameter (NFFT=6912,NH=NFFT/2)
integer*2 id2(NH) integer*2 id2(NFFT)
logical*1 brefspec,buseref logical*1 brefspec,buseref
real x0(0:NH-1) !Input samples real x0(0:NH-1) !Input samples
@ -39,7 +39,7 @@ subroutine refspectrum(id2,brefspec,buseref,fname)
endif endif
if(brefspec) then if(brefspec) then
x(0:NH-1)=0.001*id2 x(0:NH-1)=0.001*id2(1:NH)
x(NH:NFFT-1)=0.0 x(NH:NFFT-1)=0.0
call four2a(x,NFFT,1,-1,0) !r2c FFT call four2a(x,NFFT,1,-1,0) !r2c FFT
@ -120,7 +120,7 @@ subroutine refspectrum(id2,brefspec,buseref,fname)
10 close(16) 10 close(16)
firstuse=.false. firstuse=.false.
endif endif
x0=id2 x0=id2(NH+1:NFFT)
x(0:NH-1)=x0s !Previous 2nd half to new 1st half x(0:NH-1)=x0s !Previous 2nd half to new 1st half
x(NH:NFFT-1)=x0 !New 2nd half x(NH:NFFT-1)=x0 !New 2nd half
x0s=x0 !Save the new 2nd half x0s=x0 !Save the new 2nd half
@ -129,10 +129,9 @@ subroutine refspectrum(id2,brefspec,buseref,fname)
cx=fil*cx cx=fil*cx
call four2a(cx,NFFT,1,1,-1) !c2r FFT (back to time domain) call four2a(cx,NFFT,1,1,-1) !c2r FFT (back to time domain)
x1=x1s + x(0:NH-1) !Add previous segment's 2nd half x1=x1s + x(0:NH-1) !Add previous segment's 2nd half
id2=nint(x1) id2(1:NH)=nint(x1)
x1s=x(NH:NFFT-1) !Save the new 2nd half x1s=x(NH:NFFT-1) !Save the new 2nd half
endif endif
return return
end subroutine refspectrum end subroutine refspectrum