All is in place for double-buffering of ss(), ss5(), savg().

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@438 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2007-06-29 14:45:15 +00:00
parent e36cd03a37
commit cb3d314679
8 changed files with 126 additions and 124 deletions

View File

@ -47,7 +47,7 @@ SRCS2F90 = astro0.F90 audio_init.F90 azdist0.f90 \
decode1.F90 ftn_init.F90 ftn_quit.f90 wsjtgen.F90 \ decode1.F90 ftn_init.F90 ftn_quit.f90 wsjtgen.F90 \
runqqq.F90 fivehz.F90 flushqqq.F90 map65a0.f90 \ runqqq.F90 fivehz.F90 flushqqq.F90 map65a0.f90 \
rfile.f90 rfile3a.f90 spec.f90 map65a.f90 display.F90 \ rfile.f90 rfile3a.f90 spec.f90 map65a.f90 display.F90 \
getfile.F90 getfile2.F90 recvpkt.F90 getfile.F90 getfile2.F90 recvpkt.F90 symspec.f90
SRCS2F77 = indexx.f gen65.f chkmsg.f \ SRCS2F77 = indexx.f gen65.f chkmsg.f \
gentone.f gencwid.f set.f db.f pctile.f sort.f ssort.f \ gentone.f gencwid.f set.f db.f pctile.f sort.f ssort.f \
@ -58,7 +58,7 @@ SRCS2F77 = indexx.f gen65.f chkmsg.f \
unpackmsg.f unpacktext.f astro.f azdist.f coord.f dcoord.f \ unpackmsg.f unpacktext.f astro.f azdist.f coord.f dcoord.f \
deg2grid.f dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f \ deg2grid.f dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f \
moon2.f MoonDop.f sun.f toxyz.f pfxdump.f \ moon2.f MoonDop.f sun.f toxyz.f pfxdump.f \
symspec.f ccf65.f trimlist.f chkhist.f decode1a.f \ ccf65.f trimlist.f chkhist.f decode1a.f \
filbig.f fil659.f fil658.f fil6521.f twkfreq.f decode65b.f \ filbig.f fil659.f fil658.f fil6521.f twkfreq.f decode65b.f \
afc65b.f fchisq.f ccf2.f rfile2.f afc65b.f fchisq.f ccf2.f rfile2.f

View File

@ -18,7 +18,10 @@ SRCS2F90 = a2d.f90 astro0.f90 audio_init.f90 azdist0.f90 \
decode1.f90 ftn_init.f90 ftn_quit.f90 wsjtgen.f90 \ decode1.f90 ftn_init.f90 ftn_quit.f90 wsjtgen.f90 \
runqqq.f90 fivehz.f90 flushqqq.f90 map65a0.f90 \ runqqq.f90 fivehz.f90 flushqqq.f90 map65a0.f90 \
rfile.f90 rfile3a.f90 spec.f90 map65a.f90 display.F90 \ rfile.f90 rfile3a.f90 spec.f90 map65a.f90 display.F90 \
getfile.f90 getfile2.f90 recvpkt.f90 savetf2.f90 getfile.f90 getfile2.f90 recvpkt.f90 savetf2.f90 \
symspec.f90
SRCSCOM = datcom.f90 gcom1.f90 gcom2.f90 gcom3.f90 gcom4.f90 spcom.f90
SRCS2F77 = indexx.f gen65.f chkmsg.f \ SRCS2F77 = indexx.f gen65.f chkmsg.f \
gentone.f gencwid.f set.f db.f pctile.f sort.f ssort.f \ gentone.f gencwid.f set.f db.f pctile.f sort.f ssort.f \
@ -29,7 +32,7 @@ SRCS2F77 = indexx.f gen65.f chkmsg.f \
unpackmsg.f unpacktext.f astro.f azdist.f coord.f dcoord.f \ unpackmsg.f unpacktext.f astro.f azdist.f coord.f dcoord.f \
deg2grid.f dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f \ deg2grid.f dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f \
moon2.f MoonDop.f sun.f toxyz.f pfxdump.f \ moon2.f MoonDop.f sun.f toxyz.f pfxdump.f \
symspec.f ccf65.f trimlist.f chkhist.f decode1a.f \ ccf65.f trimlist.f chkhist.f decode1a.f \
filbig.f fil659.f fil658.f fil6521.f twkfreq.f decode65b.f \ filbig.f fil659.f fil658.f fil6521.f twkfreq.f decode65b.f \
afc65b.f fchisq.f ccf2.f afc65b.f fchisq.f ccf2.f
@ -38,7 +41,7 @@ SRCS2C = resample.c ptt.c igray.c wrapkarn.c rfile3.c wfile3.c
MAP65.EXE: Audio.pyd map65.spec MAP65.EXE: Audio.pyd map65.spec
python c:\python23\installer\Build.py map65.spec python c:\python23\installer\Build.py map65.spec
Audio.pyd: $(OBJS2C) $(SRCS2F90) $(SRCS2F77) $(SRCS2C) Audio.pyd: $(OBJS2C) $(SRCS2F90) $(SRCS2F77) $(SRCS2C) $(SRCSCOM)
python f2py.py -c \ python f2py.py -c \
--quiet --"fcompiler=compaqv" \ --quiet --"fcompiler=compaqv" \
--opt="/nologo /traceback /warn:errors /fast /fpp /define:Win32 \ --opt="/nologo /traceback /warn:errors /fast /fpp /define:Win32 \

10
ccf65.f
View File

@ -1,4 +1,4 @@
subroutine ccf65(ss,sync1,ipol1,dt1,flipk,syncshort, subroutine ccf65(ss,nhsym,sync1,ipol1,dt1,flipk,syncshort,
+ snr2,ipol2,dt2) + snr2,ipol2,dt2)
parameter (NFFT=512,NH=NFFT/2) parameter (NFFT=512,NH=NFFT/2)
@ -52,10 +52,10 @@ C Look for JT65 sync pattern and shorthand square-wave pattern.
ccfbest=0. ccfbest=0.
ccfbest2=0. ccfbest2=0.
do ip=1,4 !Do all four pol'ns do ip=1,4 !Do all four pol'ns
do i=1,321 do i=1,nhsym ! ?? nhsym-1 ??
s(i)=min(4.0,ss(ip,i)+ss(ip,i+1)) s(i)=min(4.0,ss(ip,i)+ss(ip,i+1))
enddo enddo
do i=322,NFFT do i=nhsym+1,NFFT ! ?? nhsym ??
s(i)=0. s(i)=0.
enddo enddo
call four2a(s,NFFT,1,-1,0) !Real-to-complex FFT call four2a(s,NFFT,1,-1,0) !Real-to-complex FFT
@ -103,10 +103,10 @@ C Find rms level on baseline of "ccfblue", for normalization.
dt1=2.5 + lagpk*(2048.0/11025.0) dt1=2.5 + lagpk*(2048.0/11025.0)
C Find base level for normalizing snr2. C Find base level for normalizing snr2.
do i=1,322 do i=1,nhsym
tmp1(i)=ss(ipol2,i) tmp1(i)=ss(ipol2,i)
enddo enddo
call pctile(tmp1,tmp2,322,40,base) call pctile(tmp1,tmp2,nhsym,40,base)
snr2=0.398107*ccfbest2/base !### empirical snr2=0.398107*ccfbest2/base !### empirical
syncshort=0.5*ccfbest2/rms - 4.0 !### better normalizer than rms? syncshort=0.5*ccfbest2/rms - 4.0 !### better normalizer than rms?
dt2=2.5 + lagpk2*(2048.0/11025.0) dt2=2.5 + lagpk2*(2048.0/11025.0)

View File

@ -317,8 +317,6 @@ def openfile(event=NONE):
Audio.getfile(fname,len(fname)) Audio.getfile(fname,len(fname))
if Audio.gcom2.ierr: print 'Error ',Audio.gcom2.ierr, \ if Audio.gcom2.ierr: print 'Error ',Audio.gcom2.ierr, \
'when trying to read file',fname 'when trying to read file',fname
bdecode.configure(bg='#66FFFF',activebackground='#66FFFF', \
state=DISABLED)
mrudir=os.path.dirname(fname) mrudir=os.path.dirname(fname)
fileopened=os.path.basename(fname) fileopened=os.path.basename(fname)
os.chdir(appdir) os.chdir(appdir)

View File

@ -3,11 +3,9 @@ subroutine map65a(newdat)
! Processes timf2 data from Linrad to find and decode JT65 signals. ! Processes timf2 data from Linrad to find and decode JT65 signals.
parameter (MAXMSG=1000) !Size of decoded message list parameter (MAXMSG=1000) !Size of decoded message list
parameter (NFFT=32768) !Half symbol = 17833 samples;
real tavg(-50:50) !Temp for finding local base level real tavg(-50:50) !Temp for finding local base level
real base(4) !Local basel level at 4 pol'ns real base(4) !Local basel level at 4 pol'ns
real tmp (200) !Temp storage for pctile sorting real tmp (200) !Temp storage for pctile sorting
real short(3,NFFT) !SNR dt ipol for potential shorthands
real sig(MAXMSG,30) !Parameters of detected signals real sig(MAXMSG,30) !Parameters of detected signals
real a(5) real a(5)
character*22 msg(MAXMSG) character*22 msg(MAXMSG)
@ -16,9 +14,10 @@ subroutine map65a(newdat)
logical done(MAXMSG) logical done(MAXMSG)
logical even logical even
character decoded*22,blank*22 character decoded*22,blank*22
include 'datcom.f90' include 'spcom.f90'
real short(3,NFFT) !SNR dt ipol for potential shorthands
include 'gcom2.f90' include 'gcom2.f90'
common/spcom/ip0,ss(4,322,NFFT),ss5(322,NFFT),savg(4,NFFT) include 'datcom.f90'
data blank/' '/ data blank/' '/
data shmsg0/'ATT','RO ','RRR','73 '/ data shmsg0/'ATT','RO ','RRR','73 '/
data nfile/0/,nutc0/-999/,nid/0/,ip000/1/,ip001/1/ data nfile/0/,nutc0/-999/,nid/0/,ip000/1/,ip001/1/
@ -96,7 +95,7 @@ subroutine map65a(newdat)
if(smax.gt.1.1) then if(smax.gt.1.1) then
ntry=ntry+1 ntry=ntry+1
! Look for JT65 sync patterns and shorthand square-wave patterns. ! Look for JT65 sync patterns and shorthand square-wave patterns.
call ccf65(ss(1,1,i),sync1,ipol,dt,flipk, & call ccf65(ss(1,1,i),nhsym,sync1,ipol,dt,flipk, &
syncshort,snr2,ipol2,dt2) syncshort,snr2,ipol2,dt2)
shmsg=' ' shmsg=' '

View File

@ -1,6 +1,6 @@
subroutine spec(brightness,contrast,ngain,nspeed,a,a2) subroutine spec(brightness,contrast,ngain,nspeed,a,a2)
parameter (NX=750,NY=130,NTOT=NX*NY,NFFT=32768) parameter (NX=750,NY=130,NTOT=NX*NY)
! Input: ! Input:
integer brightness,contrast !Display parameters integer brightness,contrast !Display parameters
@ -14,9 +14,10 @@ subroutine spec(brightness,contrast,ngain,nspeed,a,a2)
logical first logical first
integer nstep(5) integer nstep(5)
integer b0,c0 integer b0,c0
real s(NFFT,NY)
! Could save memory by doing the averaging-by-7 (or 10?) of ss5 in symspec. ! Could save memory by doing the averaging-by-7 (or 10?) of ss5 in symspec.
common/spcom/ip0,ss(4,322,NFFT),ss5(322,NFFT),savg(4,NFFT) include 'spcom.f90'
real s(NFFT,NY)
include 'gcom1.f90' include 'gcom1.f90'
include 'gcom2.f90' include 'gcom2.f90'
include 'gcom3.f90' include 'gcom3.f90'

104
symspec.f
View File

@ -1,104 +0,0 @@
subroutine symspec(id,kbuf,kk,kkdone,rxnoise,newspec,newdat,
+ ndecoding)
C Compute spectra at four polarizations, using half-symbol steps.
parameter (NFFT=32768)
parameter (NSMAX=60*96000)
integer*2 id(4,NSMAX)
complex cx(NFFT),cy(NFFT) ! pad to 32k with zeros
complex z
real*8 ts,hsym
common/spcom/ip0,ss(4,322,NFFT),ss5(322,NFFT),savg(4,NFFT)
! fac=1.e-4
! fac=1.7e-4
fac=0.0002 * 10.0**(0.05*(-rxnoise))
hsym=2048.d0*96000.d0/11025.d0 !Samples per half symbol
npts=hsym !Integral samples per half symbol
ntot=322 !Half symbols per transmission
if(kkdone.eq.0) then
do ip=1,4
do i=1,NFFT
savg(ip,i)=0.
enddo
enddo
ts=1.d0 - hsym
n=0
endif
do nn=1,ntot
i0=ts+hsym !Starting sample pointer
if((i0+npts-1).gt.kk) go to 999 !See if we have enough points
i1=ts+2*hsym !Next starting sample pointer
ts=ts+hsym !OK, update the exact sample pointer
do i=1,npts !Copy data to FFT arrays
xr=fac*id(1,i0+i)
xi=fac*id(2,i0+i)
cx(i)=cmplx(xr,xi)
yr=fac*id(3,i0+i)
yi=fac*id(4,i0+i)
cy(i)=cmplx(yr,yi)
enddo
do i=npts+1,NFFT !Pad to 32k with zeros
cx(i)=0.
cy(i)=0.
enddo
call four2a(cx,NFFT,1,1,1) !Do the FFTs
call four2a(cy,NFFT,1,1,1)
n=n+1
do i=1,NFFT !Save and accumulate power spectra
sx=real(cx(i))**2 + aimag(cx(i))**2
ss(1,n,i)=sx ! Pol = 0
savg(1,i)=savg(1,i) + sx
z=cx(i) + cy(i)
s45=0.5*(real(z)**2 + aimag(z)**2)
ss(2,n,i)=s45 ! Pol = 45
savg(2,i)=savg(2,i) + s45
sy=real(cy(i))**2 + aimag(cy(i))**2
ss(3,n,i)=sy ! Pol = 90
savg(3,i)=savg(3,i) + sy
z=cx(i) - cy(i)
s135=0.5*(real(z)**2 + aimag(z)**2)
ss(4,n,i)=s135 ! Pol = 135
savg(4,i)=savg(4,i) + s135
z=cx(i)*conjg(cy(i))
! Leif's formula:
! ss5(n,i)=0.5*(sx+sy) + (real(z)**2 + aimag(z)**2 -
! + sx*sy)/(sx+sy)
! Leif's suggestion:
! ss5(n,i)=max(sx,s45,sy,s135)
! Linearly polarized component, from the Stokes parameters:
q=sx - sy
u=2.0*real(z)
! v=2.0*aimag(z)
ss5(n,i)=0.707*sqrt(q*q + u*u)
enddo
! if(n.eq.ntot) then
if(n.ge.279) then
newspec=1
newdat=1
ndecoding=1
go to 999
endif
kkdone=i1-1
call sleep_msec(0)
write(81,3001) n,kbuf,kk,kkdone
3001 format(4i10)
enddo
999 kkdone=i1-1
return
end

105
symspec.f90 Normal file
View File

@ -0,0 +1,105 @@
subroutine symspec(id,kbuf,kk,kkdone,rxnoise,newspec,newdat,ndecoding)
! Compute spectra at four polarizations, using half-symbol steps.
parameter (NSMAX=60*96000)
integer*2 id(4,NSMAX)
complex z
real*8 ts,hsym
include 'spcom.f90'
complex cx(NFFT),cy(NFFT) ! pad to 32k with zeros
fac=0.0002 * 10.0**(0.05*(-rxnoise))
hsym=2048.d0*96000.d0/11025.d0 !Samples per half symbol
npts=hsym !Integral samples per half symbol
ntot=322 !Half symbols per transmission
! ntot=279 !Half symbols in 51.8 sec
if(kkdone.eq.0) then
do ip=1,4
do i=1,NFFT
szavg(ip,i)=0.
enddo
enddo
ts=1.d0 - hsym
n=0
endif
do nn=1,ntot
i0=ts+hsym !Starting sample pointer
if((i0+npts-1).gt.kk) go to 999 !See if we have enough points
i1=ts+2*hsym !Next starting sample pointer
ts=ts+hsym !OK, update the exact sample pointer
do i=1,npts !Copy data to FFT arrays
xr=fac*id(1,i0+i)
xi=fac*id(2,i0+i)
cx(i)=cmplx(xr,xi)
yr=fac*id(3,i0+i)
yi=fac*id(4,i0+i)
cy(i)=cmplx(yr,yi)
enddo
do i=npts+1,NFFT !Pad to 32k with zeros
cx(i)=0.
cy(i)=0.
enddo
call four2a(cx,NFFT,1,1,1) !Do the FFTs
call four2a(cy,NFFT,1,1,1)
n=n+1
do i=1,NFFT !Save and accumulate power spectra
sx=real(cx(i))**2 + aimag(cx(i))**2
ssz(1,n,i)=sx ! Pol = 0
szavg(1,i)=szavg(1,i) + sx
z=cx(i) + cy(i)
s45=0.5*(real(z)**2 + aimag(z)**2)
ssz(2,n,i)=s45 ! Pol = 45
szavg(2,i)=szavg(2,i) + s45
sy=real(cy(i))**2 + aimag(cy(i))**2
ssz(3,n,i)=sy ! Pol = 90
szavg(3,i)=szavg(3,i) + sy
z=cx(i) - cy(i)
s135=0.5*(real(z)**2 + aimag(z)**2)
ssz(4,n,i)=s135 ! Pol = 135
szavg(4,i)=szavg(4,i) + s135
z=cx(i)*conjg(cy(i))
! Leif's formula:
! ss5(n,i)=0.5*(sx+sy) + (real(z)**2 + aimag(z)**2 -
! + sx*sy)/(sx+sy)
! Leif's suggestion:
! ss5(n,i)=max(sx,s45,sy,s135)
! Linearly polarized component, from the Stokes parameters:
q=sx - sy
u=2.0*real(z)
! v=2.0*aimag(z)
ssz5(n,i)=0.707*sqrt(q*q + u*u)
enddo
! if(n.eq.ntot) then
if(n.ge.279) then
call move(ssz5,ss5,322*NFFT)
newspec=1
call move(ssz,ss,4*322*NFFT)
call move(szavg,savg,4*NFFT)
newdat=1
ndecoding=1
go to 999
endif
kkdone=i1-1
nhsym=n
call sleep_msec(0)
write(81,3001) n,kbuf,kk,kkdone
3001 format(4i10)
enddo
999 kkdone=i1-1
return
end subroutine symspec