mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Rename refspec() to refspectrum().
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6601 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
88e47a5941
commit
23298c1743
@ -387,7 +387,7 @@ set (wsjt_FSRCS
|
||||
lib/ps4.f90
|
||||
lib/readwav.f90
|
||||
lib/rectify_msk.f90
|
||||
lib/refspec.f90
|
||||
lib/refspectrum.f90
|
||||
lib/savec2.f90
|
||||
lib/sec_midn.f90
|
||||
lib/setup65.f90
|
||||
|
@ -40,6 +40,14 @@ OBJS1 = jt9w.o smo.o sync9w.o pctile.o shell.o lorentzian.o fchisq0.o \
|
||||
jt9w: $(OBJS1)
|
||||
$(FC) -o jt9w $(OBJS1) -lfftw3f
|
||||
|
||||
OBJS2 = t1.o four2a.o db.o
|
||||
t1: $(OBJS2)
|
||||
$(FC) -o t1 $(OBJS2) -lfftw3f
|
||||
|
||||
OBJS3 = t2.o four2a.o db.o
|
||||
t2: $(OBJS3)
|
||||
$(FC) -o t2 $(OBJS3) -lfftw3f
|
||||
|
||||
.PHONY : clean
|
||||
|
||||
clean:
|
||||
|
@ -1,17 +0,0 @@
|
||||
subroutine refspec(id2,k)
|
||||
|
||||
! Input:
|
||||
! id2 raw 16-bit integer data, 12000 Hz sample rate
|
||||
! k pointer to the most recent new data
|
||||
|
||||
! Output (in common/c0com)
|
||||
! c0 complex data downsampled to 1500 Hz
|
||||
|
||||
parameter (NMAX=120*12000) !Total sample intervals per 30 minutes
|
||||
integer*2 id2(0:NMAX-1)
|
||||
|
||||
! write(*,3001) id2(k-3456:k-3456+9),k
|
||||
!3001 format(10i5,i10)
|
||||
|
||||
return
|
||||
end subroutine refspec
|
14
lib/refspectrum.f90
Normal file
14
lib/refspectrum.f90
Normal file
@ -0,0 +1,14 @@
|
||||
subroutine refspectrum(id2,brefspec)
|
||||
|
||||
! Input:
|
||||
! id2 i*2 Raw 16-bit integer data, 12000 Hz sample rate
|
||||
! brefspec logical True when accumulating a reference spectrum
|
||||
|
||||
integer*2 id2(3456)
|
||||
logical brefspec
|
||||
|
||||
! write(*,3001) id2(1:10),brefspec
|
||||
!3001 format(10i5,L8)
|
||||
|
||||
return
|
||||
end subroutine refspectrum
|
174
lib/t1.f90
174
lib/t1.f90
@ -1,140 +1,52 @@
|
||||
program t1
|
||||
|
||||
parameter (NSPM=1404)
|
||||
complex csig(0:NSPM-1)
|
||||
complex c(0:NSPM-1)
|
||||
complex cnoise(0:NSPM-1)
|
||||
complex cd(0:11,0:3)
|
||||
complex z,zmax
|
||||
integer itone(234)
|
||||
real r(234)
|
||||
real ss(0:3)
|
||||
character*12 arg
|
||||
parameter (NFFT=1024,NH=NFFT/2)
|
||||
real w(-24:24)
|
||||
real x(0:NFFT-1)
|
||||
complex cx(0:NH)
|
||||
equivalence (x,cx)
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.3) then
|
||||
print*,'Usage: t1 nsymtest snrdb iters'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,arg)
|
||||
read(arg,*) nsymtest
|
||||
call getarg(2,arg)
|
||||
read(arg,*) snrdb
|
||||
call getarg(3,arg)
|
||||
read(arg,*) iters
|
||||
! FIR lowpass filter designed using ScopeFIR
|
||||
|
||||
call init_random_seed() ! seed Fortran RANDOM_NUMBER generator
|
||||
call sgran() ! see C rand generator (used in gran)
|
||||
! fsample = 48000 Hz
|
||||
! Ntaps = 49
|
||||
! fc = 4500 Hz
|
||||
! fstop = 6000 Hz
|
||||
! Ripple = 1 dB
|
||||
! Stop Atten = 40 dB
|
||||
! fout = 12000 Hz
|
||||
! Filter coefficients:
|
||||
data w/ &
|
||||
0.000861074040, 0.010051920210, 0.010161983649, 0.011363155076, &
|
||||
0.008706594219, 0.002613872664,-0.005202883094,-0.011720748164, &
|
||||
-0.013752163325,-0.009431602741, 0.000539063909, 0.012636767098, &
|
||||
0.021494659597, 0.021951235065, 0.011564169382,-0.007656470131, &
|
||||
-0.028965787341,-0.042637874109,-0.039203309748,-0.013153301537, &
|
||||
0.034320769178, 0.094717832646, 0.154224604789, 0.197758325022, &
|
||||
0.213715139513, 0.197758325022, 0.154224604789, 0.094717832646, &
|
||||
0.034320769178,-0.013153301537,-0.039203309748,-0.042637874109, &
|
||||
-0.028965787341,-0.007656470131, 0.011564169382, 0.021951235065, &
|
||||
0.021494659597, 0.012636767098, 0.000539063909,-0.009431602741, &
|
||||
-0.013752163325,-0.011720748164,-0.005202883094, 0.002613872664, &
|
||||
0.008706594219, 0.011363155076, 0.010161983649, 0.010051920210, &
|
||||
0.000861074040/
|
||||
|
||||
call random_number(r)
|
||||
itone=0
|
||||
where(r.gt.0.5) itone=1
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
fmid=1500.0
|
||||
f0=fmid-500.
|
||||
f1=fmid+500.
|
||||
dt=1.0/12000.0
|
||||
|
||||
phi=0.
|
||||
do n=0,3
|
||||
k=-1
|
||||
dphi=twopi*f0*dt
|
||||
if(n.ge.2) dphi=twopi*f1*dt
|
||||
do i=0,5
|
||||
k=k+1
|
||||
phi=phi+dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
cd(k,n)=cmplx(cos(phi),sin(phi))
|
||||
x=0.
|
||||
do i=-24,24
|
||||
j=i
|
||||
if(j.lt.0) j=j+NFFT
|
||||
x(j)=w(i)
|
||||
enddo
|
||||
|
||||
dphi=twopi*f0*dt
|
||||
if(mod(n,2).eq.1) dphi=twopi*f1*dt
|
||||
do i=6,11
|
||||
k=k+1
|
||||
phi=phi+dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
cd(k,n)=cmplx(cos(phi),sin(phi))
|
||||
enddo
|
||||
call four2a(x,NFFT,1,-1,0) !r2c FFT
|
||||
|
||||
df=48000.0/NFFT
|
||||
do i=0,NH
|
||||
y=abs(cx(i))
|
||||
s=y*y
|
||||
f=i*df
|
||||
write(13,1000) f,y,s,db(s),cx(i)
|
||||
1000 format(6f12.6)
|
||||
enddo
|
||||
|
||||
! do k=0,11
|
||||
! write(13,1000) k,cd(k,0:3)
|
||||
!1000 format(i4,8f9.3)
|
||||
!enddo
|
||||
|
||||
! Generate signal waveform
|
||||
k=-1
|
||||
phi=0.
|
||||
do j=1,234
|
||||
dphi=twopi*f0*dt
|
||||
if(itone(j).eq.1) dphi=twopi*f1*dt
|
||||
do i=1,6
|
||||
k=k+1
|
||||
phi=phi+dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
csig(k)=cmplx(cos(phi),sin(phi))
|
||||
! write(14,1000) k,csig(k)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
write(*,1010)
|
||||
1010 format(' S/N (S+N)/N BER'/'----------------------')
|
||||
|
||||
isnra=10
|
||||
isnrb=-3
|
||||
nsyms=234
|
||||
do isnr=isnra,isnrb,-1
|
||||
snr=10.0**(0.1*isnr)
|
||||
if(snrdb.ne.0.0) snr=10.0**(0.1*snrdb)
|
||||
fac=1.0/sqrt(snr)
|
||||
nsumerr=0
|
||||
do iter=1,iters
|
||||
do i=0,NSPM-1
|
||||
x=gran()
|
||||
y=gran()
|
||||
cnoise(i)=cmplx(x,y)
|
||||
enddo
|
||||
|
||||
c=csig + fac*cnoise
|
||||
nerr=0
|
||||
n1=2
|
||||
nstep=2
|
||||
iz=5
|
||||
if(nsymtest.eq.2) then
|
||||
n1=3
|
||||
nstep=1
|
||||
iz=11
|
||||
endif
|
||||
|
||||
do j=1,nsyms
|
||||
smax=0.
|
||||
do n=0,n1,nstep
|
||||
s=0.
|
||||
k=6*(j-1)
|
||||
do i=0,iz
|
||||
s=s + aimag(c(k+i))*aimag(cd(i,n))
|
||||
enddo
|
||||
ss(n)=s
|
||||
if(abs(s).gt.abs(smax)) then
|
||||
smax=s
|
||||
npk=n
|
||||
endif
|
||||
enddo
|
||||
sym=max(abs(ss(2)),abs(ss(3))) - max(abs(ss(0)),abs(ss(1)))
|
||||
! ibit=npk/2
|
||||
ibit=0
|
||||
if(sym.ge.0.0) ibit=1
|
||||
if(ibit.ne.itone(j)) nerr=nerr+1
|
||||
enddo
|
||||
nsumerr=nsumerr+nerr
|
||||
enddo
|
||||
|
||||
write(*,1020) 10.0*log10(snr),10.0*log10(snr+1.0), &
|
||||
float(nsumerr)/(nsyms*iters)
|
||||
1020 format(f5.1,f7.1,f9.3)
|
||||
if(snrdb.ne.0.0) exit
|
||||
enddo
|
||||
|
||||
999 end program t1
|
||||
|
||||
end program t1
|
||||
|
@ -37,13 +37,13 @@ Mode nsps Rate B t_sym t_msg Suggested
|
||||
Slow modes, sample Rate 12000 Hz:
|
||||
------------------------------------------------------------------------
|
||||
JT9A 6912 1.736 15.625 576 48.96 QRP HF dxing
|
||||
JT9B 3840 1.736 28.125 576 48.96
|
||||
JT9C 1920 1.736 56.25 576 48.96
|
||||
JT9D 960 1.736 112.5 576 48.96
|
||||
JT9E 480 1.736 225 576 48.96
|
||||
JT9F 240 1.736 450 576 48.96
|
||||
JT9G 120 1.736 900 576 48.96
|
||||
JT9H 60 1.736 1800 576 48.96 Microwave EME?
|
||||
JT9B 6912 1.736 28.125 576 48.96
|
||||
JT9C 6912 1.736 56.25 576 48.96
|
||||
JT9D 6912 1.736 112.5 576 48.96
|
||||
JT9E 6912 1.736 225 576 48.96
|
||||
JT9F 6912 1.736 450 576 48.96
|
||||
JT9G 6912 1.736 900 576 48.96 Microwave EME?
|
||||
JT9H 6912 1.736 1800 576 48.96 Microwave EME?
|
||||
|
||||
WSPR 8192 1.465 5.86 683 110.59 Propagation probe
|
||||
|
||||
|
@ -99,7 +99,7 @@ extern "C" {
|
||||
void hash_calls_(char calls[], int* ih9, int len);
|
||||
void degrade_snr_(short d2[], int* n, float* db, float* bandwidth);
|
||||
void wav12_(short d2[], short d1[], int* nbytes, short* nbitsam2);
|
||||
void refspec_(short int d2[], int* k);
|
||||
void refspectrum_(short int d2[], bool* brefspec);
|
||||
}
|
||||
|
||||
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
|
||||
@ -874,8 +874,7 @@ void MainWindow::dataSink(qint64 frames)
|
||||
static float df3;
|
||||
|
||||
int k (frames);
|
||||
refspec_(dec_data.d2,&k);
|
||||
// wspr_downsample_(dec_data.d2,&k);
|
||||
refspectrum_(&dec_data.d2[k-3456],&m_bRefSpec);
|
||||
|
||||
if(m_diskData) {
|
||||
dec_data.params.ndiskdat=1;
|
||||
|
Loading…
Reference in New Issue
Block a user