summaryrefslogtreecommitdiff
path: root/lib/ft4
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2019-06-02 22:17:11 +0200
committerChristoph Berg <myon@debian.org>2019-06-02 22:17:11 +0200
commit851b658298afb9bafeda98ffbfa2ade612c656be (patch)
tree826d54e9dac4ce15fdd1b6af3360eeba7993a7d2 /lib/ft4
parentb7238399ea4f1ca51d8f7b8f9220af3da0913edf (diff)
New upstream version 2.1.0~rc6+repackupstream/2.1.0_rc6+repack
Diffstat (limited to 'lib/ft4')
-rw-r--r--lib/ft4/averaged_mf.f9064
-rw-r--r--lib/ft4/ft4_baseline.f9049
-rw-r--r--lib/ft4/ft4_downsample.f904
-rw-r--r--lib/ft4/ft4_params.f9012
-rw-r--r--lib/ft4/ft4sim.f909
-rw-r--r--lib/ft4/ft4sim_mult.f908
-rw-r--r--lib/ft4/gen_ft4wave.f906
-rw-r--r--lib/ft4/getcandidates4.f9024
-rw-r--r--lib/ft4/subtractft4.f9010
-rw-r--r--lib/ft4/sync4d.f9023
-rw-r--r--lib/ft4/syncft4.f90145
11 files changed, 165 insertions, 189 deletions
diff --git a/lib/ft4/averaged_mf.f90 b/lib/ft4/averaged_mf.f90
new file mode 100644
index 00000000..2986572b
--- /dev/null
+++ b/lib/ft4/averaged_mf.f90
@@ -0,0 +1,64 @@
+program averaged_mf
+
+ parameter (nsps=32)
+ complex cgfsk(3*nsps,64)
+ complex clin(3*nsps,64)
+ complex cavg(3*nsps,4)
+ complex cavl(3*nsps,4)
+ real pulse(3*nsps)
+ real dphi(3*nsps)
+
+ do i=1,3*NSPS
+ t=(i-1.5*nsps)/real(nsps)
+ pulse(i)=gfsk_pulse(1.0,t)
+ enddo
+
+ twopi=8.0*atan(1.0)
+ hmod=1.0
+ dphi_peak=twopi*hmod/real(nsps)
+
+ do iwf=1,64
+ i0=mod((iwf-1)/16,4)
+ i1=mod((iwf-1)/4,4)
+ i2=mod(iwf-1,4)
+ dphi=0.0
+ dphi(1:64)=dphi_peak*pulse(33:96)*i1
+ dphi(1:96)=dphi(1:96)+dphi_peak*pulse(1:96)*i0
+ dphi(33:96)=dphi(33:96)+dphi_peak*pulse(1:64)*i2
+ phi=0.0
+ do j=1,96
+ cgfsk(j,iwf)=cmplx(cos(phi),sin(phi))
+ phi=mod(phi+dphi(j),twopi)
+ enddo
+ cgfsk(:,iwf)=cgfsk(:,iwf)*conjg(cgfsk(48,iwf))
+ enddo
+
+ do iwf=1,64
+ i0=mod((iwf-1)/16,4)
+ i1=mod((iwf-1)/4,4)
+ i2=mod(iwf-1,4)
+ dphi=0.0
+ dphi(1:32)=dphi_peak*i1
+ dphi(33:64)=dphi_peak*i0
+ dphi(65:96)=dphi_peak*i2
+ phi=0.0
+ do j=1,96
+ clin(j,iwf)=cmplx(cos(phi),sin(phi))
+ phi=mod(phi+dphi(j),twopi)
+ enddo
+ enddo
+
+
+ do i=1,4
+ ib=(i-1)*16+1
+ ie=ib+15
+ cavg(:,i)=sum(cgfsk(:,ib:ie),2)/16.0
+ cavl(:,i)=sum(clin(:,ib:ie),2)/16.0
+ do j=1,96
+write(*,*) j
+write(21,*) i,j,real(cavg(j,i)),imag(cavg(j,i)),real(cavl(j,i)),imag(cavl(j,i))
+ enddo
+ enddo
+
+end program averaged_mf
+
diff --git a/lib/ft4/ft4_baseline.f90 b/lib/ft4/ft4_baseline.f90
new file mode 100644
index 00000000..85a60d9e
--- /dev/null
+++ b/lib/ft4/ft4_baseline.f90
@@ -0,0 +1,49 @@
+subroutine ft4_baseline(s,nfa,nfb,sbase)
+
+! Fit baseline to spectrum
+! Input: s(npts) Linear scale in power
+! Output: sbase(npts) Baseline
+
+ include 'ft4_params.f90'
+ implicit real*8 (a-h,o-z)
+ real*4 s(NH1)
+ real*4 sbase(NH1)
+ real*4 base
+ real*8 x(1000),y(1000),a(5)
+ data nseg/10/,npct/10/
+
+ df=12000.0/NFFT1 !5.21 Hz
+ ia=max(nint(200.0/df),nfa)
+ ib=min(NH1,nfb)
+ do i=ia,ib
+ s(i)=10.0*log10(s(i)) !Convert to dB scale
+ enddo
+
+ nterms=5
+ nlen=(ib-ia+1)/nseg !Length of test segment
+ i0=(ib-ia+1)/2 !Midpoint
+ k=0
+ do n=1,nseg !Loop over all segments
+ ja=ia + (n-1)*nlen
+ jb=ja+nlen-1
+ call pctile(s(ja),nlen,npct,base) !Find lowest npct of points
+ do i=ja,jb
+ if(s(i).le.base) then
+ if (k.lt.1000) k=k+1 !Save all "lower envelope" points
+ x(k)=i-i0
+ y(k)=s(i)
+ endif
+ enddo
+ enddo
+ kz=k
+ a=0.
+ call polyfit(x,y,y,kz,nterms,0,a,chisqr) !Fit a low-order polynomial
+ do i=ia,ib
+ t=i-i0
+ sbase(i)=a(1)+t*(a(2)+t*(a(3)+t*(a(4)+t*(a(5))))) + 0.65
+! write(51,3051) i*df,s(i),sbase(i)
+!3051 format(3f12.3)
+ sbase(i)=10**(sbase(i)/10.0)
+ enddo
+ return
+end subroutine ft4_baseline
diff --git a/lib/ft4/ft4_downsample.f90 b/lib/ft4/ft4_downsample.f90
index 819b10fb..ed55fb9a 100644
--- a/lib/ft4/ft4_downsample.f90
+++ b/lib/ft4/ft4_downsample.f90
@@ -4,7 +4,7 @@ subroutine ft4_downsample(dd,newdata,f0,c)
! Output: Complex data in c(), sampled at 1200 Hz
include 'ft4_params.f90'
- parameter (NFFT2=NMAX/16)
+ parameter (NFFT2=NMAX/NDOWN)
real dd(NMAX)
complex c(0:NMAX/NDOWN-1)
complex c1(0:NFFT2-1)
@@ -38,7 +38,7 @@ subroutine ft4_downsample(dd,newdata,f0,c)
endif
i0=nint(f0/df)
c1=0.
- c1(0)=cx(i0)
+ if(i0.ge.0 .and. i0.le.NMAX/2) c1(0)=cx(i0)
do i=1,NFFT2/2
if(i0+i.le.NMAX/2) c1(i)=cx(i0+i)
if(i0-i.ge.0) c1(NFFT2-i)=cx(i0-i)
diff --git a/lib/ft4/ft4_params.f90 b/lib/ft4/ft4_params.f90
index 46630cc2..2914260d 100644
--- a/lib/ft4/ft4_params.f90
+++ b/lib/ft4/ft4_params.f90
@@ -6,11 +6,11 @@ parameter (ND=87) !Data symbols
parameter (NS=16) !Sync symbols
parameter (NN=NS+ND) !Sync and data symbols (103)
parameter (NN2=NS+ND+2) !Total channel symbols (105)
-parameter (NSPS=512) !Samples per symbol at 12000 S/s
-parameter (NZ=NSPS*NN) !Sync and Data samples (52736)
-parameter (NZ2=NSPS*NN2) !Total samples in shaped waveform (53760)
-parameter (NMAX=18*3456) !Samples in iwave
-parameter (NFFT1=2048, NH1=NFFT1/2) !Length of FFTs for symbol spectra
+parameter (NSPS=576) !Samples per symbol at 12000 S/s
+parameter (NZ=NSPS*NN) !Sync and Data samples (59328)
+parameter (NZ2=NSPS*NN2) !Total samples in shaped waveform (60480)
+parameter (NMAX=21*3456) !Samples in iwave (72576)
+parameter (NFFT1=2304, NH1=NFFT1/2) !Length of FFTs for symbol spectra
parameter (NSTEP=NSPS) !Coarse time-sync step size
parameter (NHSYM=(NMAX-NFFT1)/NSTEP) !Number of symbol spectra (1/4-sym steps)
-parameter (NDOWN=16) !Downsample factor
+parameter (NDOWN=18) !Downsample factor
diff --git a/lib/ft4/ft4sim.f90 b/lib/ft4/ft4sim.f90
index 94ab8218..959cf423 100644
--- a/lib/ft4/ft4sim.f90
+++ b/lib/ft4/ft4sim.f90
@@ -6,7 +6,7 @@ program ft4sim
use packjt77
include 'ft4_params.f90' !Set various constants
parameter (NWAVE=NN*NSPS)
- parameter (NZZ=18*3456) !62208
+ parameter (NZZ=21*3456) !72576
type(hdr) h !Header for .wav file
character arg*12,fname*17
character msg37*37,msgsent37*37
@@ -51,12 +51,11 @@ program ft4sim
hmod=1.0 !Modulation index (0.5 is MSK, 1.0 is FSK)
tt=NSPS*dt !Duration of symbols (s)
baud=1.0/tt !Keying rate (baud)
- txt=NZ*dt !Transmission length (s)
+ txt=NZ2*dt !Transmission length (s)
bandwidth_ratio=2500.0/(fs/2.0)
sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*snrdb)
if(snrdb.gt.90.0) sig=1.0
- txt=NN*NSPS/12000.0
! Source-encode, then get itone()
i3=-1
@@ -111,8 +110,10 @@ program ft4sim
c0((NN+1)*NSPS:(NN+2)*NSPS-1)=c0((NN+1)*NSPS:(NN+2)*NSPS-1)*(1.0+cos(twopi*(/(i,i=0,NSPS-1)/)/(2.0*NSPS) ))/2.0
c0((NN+2)*NSPS:)=0.
- k=nint((xdt+0.5)/dt)
+ k=nint((xdt+0.5)/dt)-NSPS
c0=cshift(c0,-k)
+ if(k.gt.0) c0(0:k-1)=0.0
+ if(k.lt.0) c0(NZZ+k:NZZ-1)=0.0
do ifile=1,nfiles
c=c0
diff --git a/lib/ft4/ft4sim_mult.f90 b/lib/ft4/ft4sim_mult.f90
index 31309328..d93978e5 100644
--- a/lib/ft4/ft4sim_mult.f90
+++ b/lib/ft4/ft4sim_mult.f90
@@ -6,7 +6,7 @@ program ft4sim_mult
use packjt77
include 'ft4_params.f90' !FT4 protocol constants
parameter (NWAVE=NN*NSPS)
- parameter (NZZ=65760) !Length of .wav file (4.48+1.0)*12000
+ parameter (NZZ=72576) !Length of .wav file (21*3456)
type(hdr) h !Header for .wav file
character arg*12,fname*17,cjunk*4
character msg37*37,msgsent37*37,c77*77
@@ -17,8 +17,6 @@ program ft4sim_mult
integer itone(NN)
integer*1 msgbits(77)
integer*2 iwave(NZZ) !Generated full-length waveform
- integer icos4(4)
- data icos4/0,1,3,2/
! Get command-line argument(s)
nargs=iargc()
@@ -55,8 +53,8 @@ program ft4sim_mult
read(10,1003,end=100) cjunk,isnr,xdt0,ifreq,msg37
1003 format(a4,30x,i3,f5.1,i5,1x,a37)
if(cjunk.eq.'File') go to 100
- if(isnr.lt.-16) isnr=-16
- f0=ifreq*93.75/50.0
+ if(isnr.lt.-17) isnr=-17
+ f0=ifreq*960.0/576.0
call random_number(r)
xdt=r-0.5
! Source-encode, then get itone()
diff --git a/lib/ft4/gen_ft4wave.f90 b/lib/ft4/gen_ft4wave.f90
index 410e8340..82399361 100644
--- a/lib/ft4/gen_ft4wave.f90
+++ b/lib/ft4/gen_ft4wave.f90
@@ -2,8 +2,8 @@ subroutine gen_ft4wave(itone,nsym,nsps,fsample,f0,cwave,wave,icmplx,nwave)
real wave(nwave)
complex cwave(nwave)
- real pulse(6144) !512*4*3
- real dphi(0:240000-1)
+ real pulse(6912) !576*4*3
+ real dphi(0:250000-1)
integer itone(nsym)
logical first
data first/.true./
@@ -13,7 +13,7 @@ subroutine gen_ft4wave(itone,nsym,nsps,fsample,f0,cwave,wave,icmplx,nwave)
twopi=8.0*atan(1.0)
dt=1.0/fsample
hmod=1.0
-! Compute the frequency-smoothing pulse
+! Compute the smoothed frequency-deviation pulse
do i=1,3*nsps
tt=(i-1.5*nsps)/real(nsps)
pulse(i)=gfsk_pulse(1.0,tt)
diff --git a/lib/ft4/getcandidates4.f90 b/lib/ft4/getcandidates4.f90
index 5d42ca74..f7cef02e 100644
--- a/lib/ft4/getcandidates4.f90
+++ b/lib/ft4/getcandidates4.f90
@@ -10,7 +10,6 @@ subroutine getcandidates4(dd,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
complex cx(0:NH1)
real candidate(3,maxcand)
real dd(NMAX)
- integer indx(NH1)
integer ipk(1)
equivalence (x,cx)
logical first
@@ -26,7 +25,6 @@ subroutine getcandidates4(dd,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
! Compute symbol spectra, stepping by NSTEP steps.
savg=0.
- tstep=NSTEP/12000.0
df=12000.0/NFFT1
fac=1.0/300.0
do j=1,NHSYM
@@ -40,28 +38,21 @@ subroutine getcandidates4(dd,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
enddo
savg=savg + s(1:NH1,j) !Average spectrum
enddo
+ savg=savg/NHSYM
savsm=0.
do i=8,NH1-7
savsm(i)=sum(savg(i-7:i+7))/15.
enddo
+
nfa=fa/df
- if(nfa.lt.1) nfa=1
+ if(nfa.lt.nint(200.0/df)) nfa=nint(200.0/df)
nfb=fb/df
if(nfb.gt.nint(5000.0/df)) nfb=nint(5000.0/df)
- n300=300/df
- n2500=2500/df
-! np=nfb-nfa+1
- np=n2500-n300+1
- indx=0
- call indexx(savsm(n300:n2500),np,indx)
- xn=savsm(n300+indx(nint(0.3*np)))
ncand=0
- if(xn.le.1.e-8) return
- savsm=savsm/xn
-! call ft4_baseline(savg,nfa,nfb,sbase)
-! savsm=savsm/sbase
-
- f_offset = -1.5*12000/512
+ call ft4_baseline(savg,nfa,nfb,sbase)
+ if(any(sbase(nfa:nfb).le.0)) return
+ savsm(nfa:nfb)=savsm(nfa:nfb)/sbase(nfa:nfb)
+ f_offset = -1.5*12000.0/NSPS
do i=nfa+1,nfb-1
if(savsm(i).ge.savsm(i-1) .and. savsm(i).ge.savsm(i+1) .and. &
savsm(i).ge.syncmin) then
@@ -69,6 +60,7 @@ subroutine getcandidates4(dd,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
del=0.
if(den.ne.0.0) del=0.5*(savsm(i-1)-savsm(i+1))/den
fpeak=(i+del)*df+f_offset
+ if(fpeak.lt.0.0 .or. fpeak.gt.4910.0) cycle
speak=savsm(i) - 0.25*(savsm(i-1)-savsm(i+1))*del
ncand=ncand+1
if(ncand.gt.maxcand) then
diff --git a/lib/ft4/subtractft4.f90 b/lib/ft4/subtractft4.f90
index 83470d7e..ae104ddb 100644
--- a/lib/ft4/subtractft4.f90
+++ b/lib/ft4/subtractft4.f90
@@ -9,8 +9,8 @@ subroutine subtractft4(dd,itone,f0,dt)
use timer_module, only: timer
- parameter (NMAX=18*3456,NFRAME=(103+2)*512)
- parameter (NFFT=NMAX,NFILT=1400)
+ parameter (NMAX=21*3456,NSPS=576,NFFT=NMAX,NFILT=1400)
+ parameter (NFRAME=(103+2)*NSPS)
real*4 dd(NMAX), window(-NFILT/2:NFILT/2), xjunk
complex cref,camp,cfilt,cw
integer itone(103)
@@ -19,13 +19,13 @@ subroutine subtractft4(dd,itone,f0,dt)
common/heap8/cref(NFRAME),camp(NMAX),cfilt(NMAX),cw(NMAX),xjunk(NFRAME)
save first
- nstart=dt*12000+1-512
+ nstart=dt*12000+1-NSPS
nsym=103
- nsps=512
fs=12000.0
icmplx=1
bt=1.0
- call gen_ft4wave(itone,nsym,nsps,fs,f0,cref,xjunk,icmplx,NFRAME)
+ nss=NSPS
+ call gen_ft4wave(itone,nsym,nss,fs,f0,cref,xjunk,icmplx,NFRAME)
camp=0.
do i=1,nframe
id=nstart-1+i
diff --git a/lib/ft4/sync4d.f90 b/lib/ft4/sync4d.f90
index bda7ed4a..28cb10b9 100644
--- a/lib/ft4/sync4d.f90
+++ b/lib/ft4/sync4d.f90
@@ -60,7 +60,16 @@ subroutine sync4d(cd0,i0,ctwk,itwk,sync)
z4=0.
if(itwk.eq.1) csync2=ctwk*csynca !Tweak the frequency
- if(i1.ge.0 .and. i1+4*NSS-1.le.NP-1) z1=sum(cd0(i1:i1+4*NSS-1:2)*conjg(csync2))
+ if(i1.ge.0 .and. i1+4*NSS-1.le.NP-1) then
+ z1=sum(cd0(i1:i1+4*NSS-1:2)*conjg(csync2))
+ elseif( i1.lt.0 ) then
+ npts=(i1+4*NSS-1)/2
+ if(npts.le.8) then
+ z1=0.
+ else
+ z1=sum(cd0(0:i1+4*NSS-1:2)*conjg(csync2(2*NSS-npts:)))
+ endif
+ endif
if(itwk.eq.1) csync2=ctwk*csyncb !Tweak the frequency
if(i2.ge.0 .and. i2+4*NSS-1.le.NP-1) z2=sum(cd0(i2:i2+4*NSS-1:2)*conjg(csync2))
@@ -69,8 +78,16 @@ subroutine sync4d(cd0,i0,ctwk,itwk,sync)
if(i3.ge.0 .and. i3+4*NSS-1.le.NP-1) z3=sum(cd0(i3:i3+4*NSS-1:2)*conjg(csync2))
if(itwk.eq.1) csync2=ctwk*csyncd !Tweak the frequency
- if(i4.ge.0 .and. i4+4*NSS-1.le.NP-1) z4=sum(cd0(i4:i4+4*NSS-1:2)*conjg(csync2))
-
+ if(i4.ge.0 .and. i4+4*NSS-1.le.NP-1) then
+ z4=sum(cd0(i4:i4+4*NSS-1:2)*conjg(csync2))
+ elseif( i4+4*NSS-1.gt.NP-1 ) then
+ npts=(NP-1-i4+1)/2
+ if(npts.le.8) then
+ z4=0.
+ else
+ z4=sum(cd0(i4:i4+2*npts-1:2)*conjg(csync2(1:npts)))
+ endif
+ endif
sync = p(z1) + p(z2) + p(z3) + p(z4)
return
diff --git a/lib/ft4/syncft4.f90 b/lib/ft4/syncft4.f90
deleted file mode 100644
index 4841c560..00000000
--- a/lib/ft4/syncft4.f90
+++ /dev/null
@@ -1,145 +0,0 @@
-subroutine syncft4(iwave,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, &
- ncand,sbase)
-
- include 'ft4_params.f90'
-! Search over +/- 2.5s relative to 0.5s TX start time.
- parameter (JZ=20)
- complex cx(0:NH1)
- real s(NH1,NHSYM)
- real savg(NH1)
- real sbase(NH1)
- real x(NFFT1)
- real sync2d(NH1,-JZ:JZ)
- real red(NH1)
- real candidate0(3,maxcand)
- real candidate(3,maxcand)
- real dd(NMAX)
- integer jpeak(NH1)
- integer indx(NH1)
- integer ii(1)
- integer*2 iwave(NMAX)
- integer icos4(0:3)
- data icos4/0,1,3,2/ !Costas 4x4 tone pattern
- equivalence (x,cx)
-
- dd=iwave/1e3
-! Compute symbol spectra, stepping by NSTEP steps.
- savg=0.
- tstep=NSTEP/12000.0
- df=12000.0/NFFT1
- fac=1.0/300.0
- do j=1,NHSYM
- ia=(j-1)*NSTEP + 1
- ib=ia+NSPS-1
- x(1:NSPS)=fac*dd(ia:ib)
- x(NSPS+1:)=0.
- call four2a(x,NFFT1,1,-1,0) !r2c FFT
- do i=1,NH1
- s(i,j)=real(cx(i))**2 + aimag(cx(i))**2
- enddo
- savg=savg + s(1:NH1,j) !Average spectrum
- enddo
-
- call baseline(savg,nfa,nfb,sbase)
-
- ia=max(1,nint(nfa/df))
- ib=nint(nfb/df)
- nssy=NSPS/NSTEP ! # steps per symbol
- nfos=NFFT1/NSPS ! # frequency bin oversampling factor
- jstrt=0.25/tstep
- candidate0=0.
- k=0
-
- do i=ia,ib
- do j=-JZ,+JZ
- ta=0.
- tb=0.
- tc=0.
- t0a=0.
- t0b=0.
- t0c=0.
- do n=0,3
- m=j+jstrt+nssy*n
- if(m.ge.1.and.m.le.NHSYM) then
- ta=ta + s(i+nfos*icos4(n),m)
- t0a=t0a + sum(s(i:i+nfos*3:nfos,m))
- endif
- tb=tb + s(i+nfos*icos4(n),m+nssy*36)
- t0b=t0b + sum(s(i:i+nfos*3:nfos,m+nssy*36))
- if(m+nssy*72.le.NHSYM) then
- tc=tc + s(i+nfos*icos4(n),m+nssy*72)
- t0c=t0c + sum(s(i:i+nfos*3:nfos,m+nssy*72))
- endif
- enddo
- t=ta+tb+tc
- t0=t0a+t0b+t0c
- t0=(t0-t)/3.0
- sync_abc=t/t0
- t=tb+tc
- t0=t0b+t0c
- t0=(t0-t)/3.0
- sync_bc=t/t0
- sync2d(i,j)=max(sync_abc,sync_bc)
- enddo
- enddo
-
- red=0.
- do i=ia,ib
- ii=maxloc(sync2d(i,-JZ:JZ)) - 1 - JZ
- j0=ii(1)
- jpeak(i)=j0
- red(i)=sync2d(i,j0)
- enddo
- iz=ib-ia+1
- call indexx(red(ia:ib),iz,indx)
- ibase=indx(nint(0.40*iz)) - 1 + ia
- if(ibase.lt.1) ibase=1
- if(ibase.gt.nh1) ibase=nh1
- base=red(ibase)
- red=red/base
- do i=1,min(maxcand,iz)
- n=ia + indx(iz+1-i) - 1
- if(red(n).lt.syncmin.or.isnan(red(n)).or.k.eq.maxcand) exit
- k=k+1
-! candidate0(1,k)=n*df+37.5*1.5
- candidate0(1,k)=n*df
- candidate0(2,k)=(jpeak(n)-1)*tstep
- candidate0(3,k)=red(n)
- enddo
- ncand=k
-
-! Put nfqso at top of list, and save only the best of near-dupe freqs.
- do i=1,ncand
- if(abs(candidate0(1,i)-nfqso).lt.10.0) candidate0(1,i)=-candidate0(1,i)
- if(i.ge.2) then
- do j=1,i-1
- fdiff=abs(candidate0(1,i))-abs(candidate0(1,j))
- if(abs(fdiff).lt.4.0) then
- if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0.
- if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0.
- endif
- enddo
- endif
- enddo
-
- fac=20.0/maxval(s)
- s=fac*s
-
-! Sort by sync
-! call indexx(candidate0(3,1:ncand),ncand,indx)
-! Sort by frequency
- call indexx(candidate0(1,1:ncand),ncand,indx)
- k=1
-! do i=ncand,1,-1
- do i=1,ncand
- j=indx(i)
-! if( candidate0(3,j) .ge. syncmin .and. candidate0(2,j).ge.-1.5 ) then
- if( candidate0(3,j) .ge. syncmin ) then
- candidate(2:3,k)=candidate0(2:3,j)
- candidate(1,k)=abs(candidate0(1,j))
- k=k+1
- endif
- enddo
- ncand=k-1
- return
-end subroutine syncft4