Make both call-from-map65 and m65 from command line work properly on *.tf2 and *.iq files.

This commit is contained in:
Joe Taylor 2021-04-16 15:12:00 -04:00
parent 30d37f292b
commit a970ad1447
5 changed files with 90 additions and 51 deletions

View File

@ -48,6 +48,8 @@ subroutine ccf65(ss,nhsym,ssmax,sync1,ipol1,jpz,dt1,flipk, &
call four2a(pr2,NFFT,1,-1,0)
first=.false.
endif
syncshort=0.
snr2=0.
! Look for JT65 sync pattern and shorthand square-wave pattern.
ccfbest=0.
@ -82,7 +84,10 @@ subroutine ccf65(ss,nhsym,ssmax,sync1,ipol1,jpz,dt1,flipk, &
if(ccf(lag,ip).lt.0.0) flipk=-1.0
endif
enddo
!### Not sure why this is ever true???
if(sum(ccf).eq.0.0) return
!###
do lag=-11,54 !Check for best shorthand
ccf2=s2(lag+28)
if(ccf2.gt.ccfbest2) then
@ -95,11 +100,11 @@ subroutine ccf65(ss,nhsym,ssmax,sync1,ipol1,jpz,dt1,flipk, &
enddo
! Find rms level on baseline of "ccfblue", for normalization.
sum=0.
sumccf=0.
do lag=-11,54
if(abs(lag-lagpk).gt.1) sum=sum + ccf(lag,ipol1)
if(abs(lag-lagpk).gt.1) sumccf=sumccf + ccf(lag,ipol1)
enddo
base=sum/50.0
base=sumccf/50.0
sq=0.
do lag=-11,54
if(abs(lag-lagpk).gt.1) sq=sq + (ccf(lag,ipol1)-base)**2

View File

@ -53,8 +53,8 @@ subroutine decode0(dd,ss,savg,nstandalone)
call timer('map65a ',0)
call map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, &
mousedf,mousefqso,nagain,ndecdone,ndiskdat,nfshift,ndphi, &
nfcal,nkeep,mcall3b,nsum,nsave,nxant,rmsdd,mycall,mygrid, &
neme,ndepth,hiscall,hisgrid,nhsym,nfsample,nxpol,nmode)
nfcal,nkeep,mcall3b,nsum,nsave,nxant,rmsdd,mycall,mygrid, &
neme,ndepth,nstandalone,hiscall,hisgrid,nhsym,nfsample,nxpol,nmode)
call timer('map65a ',1)
call timer('decode0 ',1)

View File

@ -5,7 +5,8 @@ program m65
parameter (NSMAX=60*96000)
parameter (NFFT=32768)
integer*2 i2(4,87)
parameter (NREAD=2048)
integer*2 i2(NREAD)
real*8 hsym
real*4 ssz5a(NFFT)
logical*1 lstrong(0:1023)
@ -20,11 +21,12 @@ program m65
nfast,nsave,mycall,mygrid,hiscall,hisgrid,datetime
nargs=iargc()
if(nargs.lt.1 .or. nargs.eq.2) then
print*,'Usage: m65 <submode> <95238|96000> file1 [file2 ...]'
print*,' (Reads data from *.tf2 files.)'
if(nargs.ne.1 .and. nargs.lt.5) then
print*,'Usage: m65 Jsub Qsub Xpol <95238|96000> file1 [file2 ...]'
print*,'Examples: m65 B A X 96000 *.tf2'
print*,' m65 C C N 96000 *.iq'
print*,''
print*,' m65 -s'
print*,' m65 -s'
print*,' (Gets data from MAP65, via shared memory region.)'
go to 999
endif
@ -34,30 +36,50 @@ program m65
call ftnquit
go to 999
endif
!### These need fixing:
if(arg(1:1).eq.'A') nmode=1
if(arg(1:1).eq.'B') nmode=2
if(arg(1:1).eq.'C') nmode=3
!###
nfsample=96000
call getarg(2,arg)
if(arg.eq.'95238') then
nfsample=95238
call getarg(3,arg)
endif
n=1
if(arg(1:1).eq.'0') n=0
if(arg(1:1).eq.'A') n=1
if(arg(1:1).eq.'B') n=2
if(arg(1:1).eq.'C') n=3
nxpol=1
ifile1=3
call getarg(2,arg)
m=1
if(arg(1:1).eq.'0') m=0
if(arg(1:1).eq.'A') m=1
if(arg(1:1).eq.'B') m=2
if(arg(1:1).eq.'C') m=3
if(arg(1:1).eq.'D') m=4
if(arg(1:1).eq.'E') m=5
nmode=10*m + n
call getarg(3,arg)
nxpol=0
if(arg(1:1).eq.'X') nxpol=1
call getarg(4,arg)
nfsample=96000
if(arg.eq.'95238') nfsample=95238
ifile1=5
limtrace=0
lu=12
mycall='K1JT'
mygrid='FN20QI'
hiscall='K9AN'
hisgrid='EN50'
nfa=100
nfb=162
nfshift=6
ndepth=2
nfcal=344
idphi=-50
ntol=500
nkeep=10
mousefqso=141
nfcal=-720
if(nxpol.eq.0) then
nfa=55
nfb=143
mousefqso=70
endif
call ftninit('.')
@ -65,39 +87,36 @@ program m65
call getarg(ifile,infile)
open(10,file=infile,access='stream',status='old',err=998)
i1=index(infile,'.tf2')
if(i1.lt.1) i1=index(infile,'.iq')
read(infile(i1-4:i1-1),*,err=1) nutc0
go to 2
1 nutc0=0
2 hsym=2048.d0*96000.d0/11025.d0 !Samples per half symbol
read(10) fcenter
newdat=1
nhsym0=-999
k=0
fcenter=144.125d0
mousedf=0
mousefqso=125
newdat=1
mycall='K1JT'
nch=2
if(nxpol.eq.1) nch=4
if(ifile.eq.ifile1) call timer('m65 ',0)
do irec=1,9999999
call timer('read_tf2',0)
read(10) i2
call timer('read_tf2',1)
call timer('float ',0)
do i=1,87
read(10,end=10) i2
do i=1,NREAD,nch
k=k+1
dd(1,k)=i2(1,i)
dd(2,k)=i2(2,i)
dd(3,k)=i2(3,i)
dd(4,k)=i2(4,i)
dd(1,k)=i2(i)
dd(2,k)=i2(i+1)
if(nxpol.eq.1) then
dd(3,k)=i2(i+2)
dd(4,k)=i2(i+3)
endif
enddo
call timer('float ',1)
nhsym=(k-2048)/hsym
if(nhsym.ge.1 .and. nhsym.ne.nhsym0) then
ndiskdat=1
nb=0
! Emit signal readyForFFT
call timer('symspec ',0)
fgreen=-13.0
iqadjust=0
iqapply=0
@ -106,12 +125,13 @@ program m65
gainy=1.0265
phasex=0.01426
phasey=-0.01195
call timer('symspec ',0)
call symspec(k,nxpol,ndiskdat,nb,nbslider,idphi,nfsample, &
fgreen,iqadjust,iqapply,gainx,gainy,phasex,phasey,rejectx, &
rejecty,pxdb,pydb,ssz5a,nkhz,ihsym,nzap,slimit,lstrong)
call timer('symspec ',1)
nhsym0=nhsym
if(ihsym.ge.278) go to 10
! if(ihsym.ge.278) go to 10
endif
enddo
@ -120,7 +140,7 @@ program m65
3002 format('Image rejection:',2f7.1,' dB')
nutc=nutc0
nstandalone=1
call decode0(dd,ss,savg,nstandalone,nfsample)
call decode0(dd,ss,savg,nstandalone)
enddo
call timer('m65 ',1)

View File

@ -1,7 +1,7 @@
subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, &
mousedf,mousefqso,nagain,ndecdone,ndiskdat,nfshift,ndphi, &
nfcal,nkeep,mcall3b,nsum,nsave,nxant,rmsdd,mycall,mygrid, &
neme,ndepth,hiscall,hisgrid,nhsym,nfsample,nxpol,nmode)
neme,ndepth,nstandalone,hiscall,hisgrid,nhsym,nfsample,nxpol,nmode)
! Processes timf2 data from Linrad to find and decode JT65 signals.
@ -31,12 +31,22 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, &
data shmsg0/'ATT','RO ','RRR','73 '/
data nfile/0/,nutc0/-999/,nid/0/,ip000/1/,ip001/1/,mousefqso0/-999/
save
mode65=mod(nmode,10)
if(mode65.eq.3) mode65=4
mode_q65=nmode/10
nwrite_q65=0
bq65=mode_q65.gt.0
!###
write(71,3071) newdat,nutc,ntol,idphi,nfa,nfb, &
mousedf,mousefqso,nagain,ndecdone,ndiskdat,nfshift,ndphi, &
nfcal,nkeep,mcall3b,nsum,nsave,nxant,neme,ndepth, &
nhsym,nfsample,nxpol,nmode,mycall,mygrid,hiscall,hisgrid, &
sum(dd),sum(ss),sum(savg)
3071 format(16i5/9i6/a12,a6,2x,a12,a6/3e15.6)
!###
mcall3a=mcall3b
mousefqso0=mousefqso
xpol=(nxpol.ne.0)
@ -44,7 +54,6 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, &
nsum=0
!### Should use AppDir! ###
! open(23,file='release/CALL3.TXT',status='unknown')
open(23,file='CALL3.TXT',status='unknown')
df=96000.0/NFFT !df = 96000/NFFT = 2.930 Hz
@ -58,7 +67,9 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, &
2 if(ndphi.eq.1) dphi=30*iloop/57.2957795
nqdz=1
if(bq65 .and. nutc0.ge.0) nqdz=2
if(bq65 .and. (nutc0.ge.0 .or. (nstandalone.eq.1))) nqdz=2
! if(bq65) nqdz=2
write(69,*) nqdz,mousefqso
if(nutc.ne.nutc0) nfile=nfile+1
nutc0=nutc

View File

@ -25,6 +25,9 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, &
data first/.true./
save
write(72,*) nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, &
mycall0,hiscall0,hisgrid,mode_q65
if(first) then
open(9,file='wsjtx_dir.txt',status='old')
read(9,*) wsjtx_dir