mirror of https://github.com/saitohirga/WSJT-X.git
Better symspec now.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2646 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
ac93f2b653
commit
68de5dd4bd
|
@ -19,7 +19,6 @@ void getfile(QString fname, int ntrperiod)
|
||||||
fread(jt9com_.d2,1,44,fp);
|
fread(jt9com_.d2,1,44,fp);
|
||||||
int nrd=fread(jt9com_.d2,2,npts,fp);
|
int nrd=fread(jt9com_.d2,2,npts,fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
// for(int i=0; i<npts; i++) jt9com_.d2[i]/=100;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,8 @@ program jt9sim
|
||||||
if(nsps.eq.0) stop 'Bad value for minutes.'
|
if(nsps.eq.0) stop 'Bad value for minutes.'
|
||||||
ihdr=0 !Temporary ###
|
ihdr=0 !Temporary ###
|
||||||
|
|
||||||
|
if(msg0(1:3).eq.'sin') read(msg0(4:),*) sinfreq
|
||||||
|
|
||||||
open(12,file='msgs.txt',status='old')
|
open(12,file='msgs.txt',status='old')
|
||||||
|
|
||||||
write(*,1000)
|
write(*,1000)
|
||||||
|
@ -111,6 +113,7 @@ program jt9sim
|
||||||
k=12000 !Start at t = 1 s
|
k=12000 !Start at t = 1 s
|
||||||
do isym=1,85
|
do isym=1,85
|
||||||
freq=f + itone(isym)*baud
|
freq=f + itone(isym)*baud
|
||||||
|
if(msg0(1:3).eq.'sin') freq=sinfreq
|
||||||
dphi=twopi*freq*dt
|
dphi=twopi*freq*dt
|
||||||
do i=1,nsps
|
do i=1,nsps
|
||||||
phi=phi + dphi
|
phi=phi + dphi
|
||||||
|
|
|
@ -26,20 +26,14 @@ subroutine symspec(k,ntrperiod,nsps,ndiskdat,nb,nbslider,pxdb,s,f0a,df3, &
|
||||||
real*4 s(NSMAX),w(NFFT1),w3(MAXFFT3)
|
real*4 s(NSMAX),w(NFFT1),w3(MAXFFT3)
|
||||||
real*4 stmp(NFFT2/2)
|
real*4 stmp(NFFT2/2)
|
||||||
real*4 x0(NFFT1),x1(NFFT1)
|
real*4 x0(NFFT1),x1(NFFT1)
|
||||||
real*4 x2(NFFT2)
|
real*4 x2(NFFT1+105)
|
||||||
complex cx2(0:NFFT2/2)
|
real*4 xx(NMAX)
|
||||||
complex cx2a(NFFT2A)
|
complex cx(0:MAXFFT3-1)
|
||||||
complex z,zfac
|
|
||||||
complex zsumx
|
|
||||||
complex cx(MAXFFT3)
|
|
||||||
complex cx00(NFFT1)
|
|
||||||
complex cx0(0:1023),cx1(0:1023)
|
|
||||||
logical*1 lstrong(0:1023) !Should be (0:512)
|
logical*1 lstrong(0:1023) !Should be (0:512)
|
||||||
integer*2 id2
|
integer*2 id2
|
||||||
complex c0
|
complex c0
|
||||||
common/jt9com/id2(NMAX),ss(184,NSMAX),savg(NSMAX),c0(NDMAX), &
|
common/jt9com/id2(NMAX),ss(184,NSMAX),savg(NSMAX),c0(NDMAX), &
|
||||||
nutc,npts8,junk(20)
|
nutc,npts8,junk(20)
|
||||||
equivalence (x2,cx2)
|
|
||||||
data rms/999.0/,k0/99999999/,ntrperiod0/0/,nfft3z/0/
|
data rms/999.0/,k0/99999999/,ntrperiod0/0/,nfft3z/0/
|
||||||
save
|
save
|
||||||
|
|
||||||
|
@ -58,19 +52,19 @@ subroutine symspec(k,ntrperiod,nsps,ndiskdat,nb,nbslider,pxdb,s,f0a,df3, &
|
||||||
if(nfft3.ne.nfft3z) then
|
if(nfft3.ne.nfft3z) then
|
||||||
pi=4.0*atan(1.0)
|
pi=4.0*atan(1.0)
|
||||||
do i=1,nfft3
|
do i=1,nfft3
|
||||||
w3(i)=(sin(i*pi/nfft3))**2 !Window for nfft3
|
w3(i)=2.0*(sin(i*pi/nfft3))**2 !Window for nfft3
|
||||||
enddo
|
enddo
|
||||||
stmp=0.
|
stmp=0.
|
||||||
nfft3z=nfft3
|
nfft3z=nfft3
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if(k.lt.k0) then
|
if(k.lt.k0) then
|
||||||
ja=-2*jstep
|
ja=-3*jstep
|
||||||
savg=0.
|
savg=0.
|
||||||
ihsym=0
|
ihsym=0
|
||||||
k1=0
|
k1=0
|
||||||
k8=0
|
k8=0
|
||||||
if(ndiskdat.eq.0) id2(k+1:)=0. !### Should not be needed ??? ###
|
x2=0.
|
||||||
endif
|
endif
|
||||||
k0=k
|
k0=k
|
||||||
|
|
||||||
|
@ -81,48 +75,33 @@ subroutine symspec(k,ntrperiod,nsps,ndiskdat,nb,nbslider,pxdb,s,f0a,df3, &
|
||||||
px=0.
|
px=0.
|
||||||
df2=12000.0/NFFT2
|
df2=12000.0/NFFT2
|
||||||
|
|
||||||
! nwindow=2
|
nwindow=2
|
||||||
nwindow=0 !### No windowing ###
|
! nwindow=0 !### No windowing ###
|
||||||
kstep1=NFFT1
|
kstep1=NFFT1
|
||||||
if(nwindow.ne.0) kstep1=NFFT1/2
|
if(nwindow.ne.0) kstep1=NFFT1/2
|
||||||
fac=1.0/(NFFT1*NFFT2)
|
fac=2.0/NFFT1
|
||||||
nblks=(k-k1)/kstep1
|
nblks=(k-k1)/kstep1
|
||||||
do nblk=1,nblks
|
do nblk=1,nblks
|
||||||
|
j=k1+1
|
||||||
do i=1,NFFT1
|
do i=1,NFFT1
|
||||||
x0(i)=fac*id2(k1+i)
|
x0(i)=id2(k1+i)
|
||||||
enddo
|
enddo
|
||||||
call timf2(x0,k,NFFT1,nwindow,nb,peaklimit,faclim,x1, &
|
call timf2(x0,k,NFFT1,nwindow,nb,peaklimit,faclim,x1, &
|
||||||
slimit,lstrong,px,nzap)
|
slimit,lstrong,px,nzap)
|
||||||
! x1=x0
|
|
||||||
x2=x1
|
|
||||||
call four2a(x2,NFFT2,1,-1,0) !Second forward FFT, r2c
|
|
||||||
|
|
||||||
i0=nint(1000.0/df2)
|
|
||||||
f0a=i0*df2
|
|
||||||
cx2a(1:NFFT2A/2)=cx2(i0:NFFT2A/2+i0-1)
|
|
||||||
cx2a(NFFT2A/2+1:NFFT2A)=cx2(i0-1-NFFT2A/2:i0-1)
|
|
||||||
call four2a(cx2a,NFFT2A,1,1,1)
|
|
||||||
|
|
||||||
c0(k8+1:k8+NFFT2A)=cx2a
|
|
||||||
npts8=k8+NFFT2A
|
|
||||||
|
|
||||||
!### Test for gliches at multiples of 128
|
|
||||||
! if(k8.lt.1000) then
|
|
||||||
! do i=k8+1,k8+NFFT2A
|
|
||||||
! write(82,4002) i,c0(i)
|
|
||||||
!4002 format(i8,2e12.3)
|
|
||||||
! enddo
|
|
||||||
! endif
|
|
||||||
!###
|
|
||||||
|
|
||||||
|
! Mix at 1500 Hz, lowpass at +/-750 Hz, and downsample to 1500 Hz complex.
|
||||||
|
x2(106:105+kstep1)=x1(1:kstep1)
|
||||||
|
call fil3(x2,kstep1+105,c0(k8+1),n2)
|
||||||
|
x2(1:105)=x1(kstep1-104:kstep1) !Save 105 trailing samples
|
||||||
k1=k1+kstep1
|
k1=k1+kstep1
|
||||||
k8=k8+kstep1/8
|
k8=k8+kstep1/8
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
npts8=k8
|
||||||
ja=ja+jstep !Index of first sample
|
ja=ja+jstep !Index of first sample
|
||||||
if(ja.lt.0) go to 999
|
if(ja.lt.0 .or. npts8.lt.ja+nfft3) go to 999
|
||||||
do i=1,nfft3 !Copy data into cx
|
do i=0,nfft3-1 !Copy data into cx
|
||||||
cx(i)=c0(ja+i)
|
cx(i)=c0(ja+i+1)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
!###
|
!###
|
||||||
|
@ -132,26 +111,33 @@ subroutine symspec(k,ntrperiod,nsps,ndiskdat,nb,nbslider,pxdb,s,f0a,df3, &
|
||||||
rms=sqrt(0.5*px/nsum)
|
rms=sqrt(0.5*px/nsum)
|
||||||
! endif
|
! endif
|
||||||
pxdb=0.
|
pxdb=0.
|
||||||
pxdb=20.0*log10(rms) + 166.0 !### ??? ###
|
if(rms.gt.0.0) pxdb=20.0*log10(rms)
|
||||||
if(pxdb.gt.60.0) pxdb=60.0
|
if(pxdb.gt.60.0) pxdb=60.0
|
||||||
! write(71,*) kstep1,nzap,nsum,px,rms,pxdb
|
|
||||||
! flush(71)
|
|
||||||
|
|
||||||
!###
|
!###
|
||||||
|
|
||||||
|
|
||||||
ihsym=ihsym+1
|
ihsym=ihsym+1
|
||||||
call four2a(cx,nfft3,1,-1,1) !Third forward FFT (X)
|
cx(0:nfft3-1)=w3(1:nfft3)*cx(0:nfft3-1) !Apply window w3
|
||||||
|
call four2a(cx,nfft3,1,1,1) !Third forward FFT (X)
|
||||||
|
|
||||||
n=min(184,ihsym)
|
n=min(184,ihsym)
|
||||||
df3=1500.0/nfft3
|
df3=1500.0/nfft3
|
||||||
|
i0=nint(-500.0/df3)
|
||||||
iz=min(NSMAX,nint(1000.0/df3))
|
iz=min(NSMAX,nint(1000.0/df3))
|
||||||
|
fac=(1.0/nfft3)**2
|
||||||
do i=1,iz
|
do i=1,iz
|
||||||
sx=real(cx(i))**2 + aimag(cx(i))**2
|
j=i0+i-1
|
||||||
|
if(j.lt.0) j=j+nfft3
|
||||||
|
sx=fac*(real(cx(j))**2 + aimag(cx(j))**2)
|
||||||
ss(n,i)=sx
|
ss(n,i)=sx
|
||||||
savg(i)=savg(i) + sx
|
savg(i)=savg(i) + sx
|
||||||
s(i)=sx
|
s(i)=sx
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
999 return
|
999 continue
|
||||||
|
! write(71,3003) k,nsum,nzap,px,rms,pxdb
|
||||||
|
!3003 format(3i10,3f12.2)
|
||||||
|
! flush(71)
|
||||||
|
|
||||||
|
return
|
||||||
end subroutine symspec
|
end subroutine symspec
|
||||||
|
|
|
@ -147,7 +147,6 @@ subroutine timf2(x0,k,nfft,nwindow,nb,peaklimit,faclim,x1, &
|
||||||
do i=0,kstep-1
|
do i=0,kstep-1
|
||||||
px=px + xw(i)*xw(i)
|
px=px + xw(i)*xw(i)
|
||||||
enddo
|
enddo
|
||||||
px=px/kstep
|
|
||||||
|
|
||||||
x1(0:kstep-1)=xw(0:kstep-1) + xs(0:kstep-1) !Recombine weak + strong
|
x1(0:kstep-1)=xw(0:kstep-1) + xs(0:kstep-1) !Recombine weak + strong
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//----------------------------------------------------------- MainWindow
|
//------------------------------------------------------------ MainWindow
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "devsetup.h"
|
#include "devsetup.h"
|
||||||
|
@ -314,7 +314,6 @@ void MainWindow::dataSink(int k)
|
||||||
static uchar lstrong[1024];
|
static uchar lstrong[1024];
|
||||||
static float slimit;
|
static float slimit;
|
||||||
|
|
||||||
|
|
||||||
if(m_diskData) {
|
if(m_diskData) {
|
||||||
ndiskdat=1;
|
ndiskdat=1;
|
||||||
jt9com_.ndiskdat=1;
|
jt9com_.ndiskdat=1;
|
||||||
|
@ -719,7 +718,6 @@ void MainWindow::diskDat() //diskDat()
|
||||||
{
|
{
|
||||||
int kstep=m_nsps/2;
|
int kstep=m_nsps/2;
|
||||||
m_diskData=true;
|
m_diskData=true;
|
||||||
|
|
||||||
for(int n=1; n<=184; n++) { // Do the half-symbol FFTs
|
for(int n=1; n<=184; n++) { // Do the half-symbol FFTs
|
||||||
int k=(n+1)*kstep;
|
int k=(n+1)*kstep;
|
||||||
dataSink(k);
|
dataSink(k);
|
||||||
|
|
Loading…
Reference in New Issue