mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-02 14:12:27 -04:00
Temporary code (### commented out ###) for calibrating SNR.
This commit is contained in:
parent
40331f3c1f
commit
cdcdedfe40
@ -143,10 +143,7 @@ subroutine ftrsd3(s3,chansym0,rxdat,rxprob,rxdat2,rxprob2,ntrials0, &
|
|||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
call rs_decode_sf(workdat,era_pos,numera,nerr) !Call the decoder
|
call rs_decode_sf(workdat,era_pos,numera,nerr) !Call the decoder
|
||||||
do i=0,NN-1
|
|
||||||
write(60,3101) i,chansym0(i),workdat(i),workdat(i)-chansym0(i)
|
|
||||||
3101 format(4i8)
|
|
||||||
enddo
|
|
||||||
if( nerr.ge.0) then
|
if( nerr.ge.0) then
|
||||||
! We have a candidate codeword. Find its hard and soft distance from
|
! We have a candidate codeword. Find its hard and soft distance from
|
||||||
! the received word. Also find pp1 and pp2 from the full array
|
! the received word. Also find pp1 and pp2 from the full array
|
||||||
|
39
lib/superfox/plotspec.f90
Normal file
39
lib/superfox/plotspec.f90
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
subroutine plotspec(dat)
|
||||||
|
|
||||||
|
use sfox_mod
|
||||||
|
real dat(NMAX)
|
||||||
|
real s(0:NSPS/2)
|
||||||
|
complex c(0:NSPS-1)
|
||||||
|
integer ipk(1)
|
||||||
|
|
||||||
|
nblks=NZ/NSPS
|
||||||
|
s=0.
|
||||||
|
fac=1.0/NSPS
|
||||||
|
do j=1,nblks
|
||||||
|
ib=j*NSPS
|
||||||
|
ia=ib-NSPS+1
|
||||||
|
c=fac*dat(ia:ib)
|
||||||
|
call four2a(c,NSPS,1,-1,1)
|
||||||
|
do i=0,NSPS/2
|
||||||
|
s(i)=s(i) + real(c(i))**2 + aimag(c(i))**2
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
|
||||||
|
df=12000.0/NSPS
|
||||||
|
ipk=maxloc(s)
|
||||||
|
f0=df*(ipk(1)-1)
|
||||||
|
p_sig_plus_noise=maxval(s)
|
||||||
|
p_noise=0.
|
||||||
|
do i=0,NSPS/2
|
||||||
|
f=i*df
|
||||||
|
if(f.le.2500+df .and. abs(f-f0).gt.0.5*df) p_noise=p_noise + s(i)
|
||||||
|
write(40,1000) f,s(i)
|
||||||
|
1000 format(2f10.3)
|
||||||
|
enddo
|
||||||
|
p_sig=p_sig_plus_noise - p_noise*df/2500.0
|
||||||
|
snr=p_sig/p_noise
|
||||||
|
snrdb=db(snr)
|
||||||
|
write(*,1100) snrdb
|
||||||
|
1100 format('Measured SNR:',f7.2)
|
||||||
|
|
||||||
|
end subroutine plotspec
|
@ -114,6 +114,7 @@ program sfoxtest
|
|||||||
call rs_encode_sf(msg0,parsym) !Compute parity symbols
|
call rs_encode_sf(msg0,parsym) !Compute parity symbols
|
||||||
chansym0(0:kk-1)=msg0(1:kk)
|
chansym0(0:kk-1)=msg0(1:kk)
|
||||||
chansym0(kk:nn-1)=parsym(1:nn-kk)
|
chansym0(kk:nn-1)=parsym(1:nn-kk)
|
||||||
|
! chansym0=NQ/2 !### TEMPORARY, for SNR calibration ###
|
||||||
|
|
||||||
! Generate clo, the LO for sync detection
|
! Generate clo, the LO for sync detection
|
||||||
call timer('clo ',0)
|
call timer('clo ',0)
|
||||||
@ -161,17 +162,17 @@ program sfoxtest
|
|||||||
|
|
||||||
crcvd=0.
|
crcvd=0.
|
||||||
crcvd(1:NMAX)=cshift(sig*cdat(1:NMAX),-nint(xdt*fsample)) + cnoise
|
crcvd(1:NMAX)=cshift(sig*cdat(1:NMAX),-nint(xdt*fsample)) + cnoise
|
||||||
|
|
||||||
dat=aimag(sig*cdat(1:NMAX)) + xnoise !Add generated AWGN noise
|
|
||||||
fac=32767.0
|
|
||||||
if(snr.ge.90.0) iwave(1:NMAX)=nint(fac*dat(1:NMAX))
|
|
||||||
if(snr.lt.90.0) iwave(1:NMAX)=nint(rms*dat(1:NMAX))
|
|
||||||
|
|
||||||
call timer('watterso',0)
|
call timer('watterso',0)
|
||||||
if(fspread.ne.0 .or. delay.ne.0) call watterson(crcvd,NMAX,NZ,fsample,&
|
if(fspread.ne.0 .or. delay.ne.0) call watterson(crcvd,NMAX,NZ,fsample,&
|
||||||
delay,fspread)
|
delay,fspread)
|
||||||
call timer('watterso',1)
|
call timer('watterso',1)
|
||||||
|
|
||||||
|
dat=aimag(sig*cdat(1:NMAX)) + xnoise !Add generated AWGN noise
|
||||||
|
! call plotspec(dat) !### TEMPORARY, for SNR calibration ###
|
||||||
|
fac=32767.0
|
||||||
|
if(snr.ge.90.0) iwave(1:NMAX)=nint(fac*dat(1:NMAX))
|
||||||
|
if(snr.lt.90.0) iwave(1:NMAX)=nint(rms*dat(1:NMAX))
|
||||||
|
|
||||||
! Find signal freq and DT
|
! Find signal freq and DT
|
||||||
call timer('sync ',0)
|
call timer('sync ',0)
|
||||||
call sfox_sync(crcvd,clo,nv,f,t)
|
call sfox_sync(crcvd,clo,nv,f,t)
|
||||||
@ -248,3 +249,5 @@ program sfoxtest
|
|||||||
|
|
||||||
999 call timer('sfoxtest',101)
|
999 call timer('sfoxtest',101)
|
||||||
end program sfoxtest
|
end program sfoxtest
|
||||||
|
|
||||||
|
! include 'plotspec.f90' !### TEMPORARY, for SNR calibration ###
|
||||||
|
Loading…
x
Reference in New Issue
Block a user