summaryrefslogtreecommitdiff
path: root/lib/ft8var/datacor.f90
blob: 849b6c20b06224eefd95755458395e00f62fd9b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

subroutine datacor(datapwr,datacorr)

  use jt65_mod2var, only : s3,correct

  real datapwr,datacorr

! calculate information tones power and datapower/syncpower ratio
  datapwr=0.0
  do i=1,63
     datapwr=datapwr+s3(correct(i)+1,i)
  enddo

! use short correlation function in time and frequency domains
  timeplus=0.; timeminus=0.; freqplus=0.; freqminus=0.
  do i=1,63
     k=i+1
     m=i-1
     if(i.eq.1) m=2
     if(i.eq.63) k=62
     timeplus=timeplus+s3(correct(i)+1,k)
     timeminus=timeminus+s3(correct(i)+1,m)
     if(correct(i).lt.63) then
        j=1
     else
        j=-1
     endif
     if(correct(i).gt.1) then
        n=-1
     else
        n=1
     endif
     freqplus=freqplus+s3(correct(i)+1+j,i)
     freqminus=freqminus+s3(correct(i)+1+n,i)
  enddo
  datacorr=datapwr*4.0/(timeplus+timeminus+freqplus+freqminus)

  return
end subroutine datacor