File: ccf2.f90

package info (click to toggle)
wsjtx 2.0.0%2Brepack-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 192,624 kB
  • sloc: cpp: 1,071,838; ansic: 60,751; f90: 25,266; python: 20,318; sh: 10,636; xml: 8,148; cs: 2,121; fortran: 2,051; yacc: 472; asm: 353; makefile: 316; perl: 19
file content (49 lines) | stat: -rw-r--r-- 1,307 bytes parent folder | download | duplicates (9)
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
40
41
42
43
44
45
46
47
48
49
subroutine ccf2(ss,nz,nflip,ccfbest,xlagpk)

!  parameter (LAGMIN=-86,LAGMAX=258)
  parameter (LAGMIN=-112,LAGMAX=258)  ! Look for DT from -3.6s to +5.0s
  real ss(nz)
  real ccf(-LAGMAX:LAGMAX)
  integer npr(126)

! The JT65 pseudo-random sync pattern:
  data npr/                                    &
      1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
      0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
      0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, &
      0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, &
      1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, &
      0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, &
      1,1,1,1,1,1/
  save

  ccfbest=0.
  lag1=LAGMIN
  lag2=LAGMAX
  do lag=lag1,lag2
     s0=0.
     s1=0.
     do i=1,126
        j=16*(i-1)+1 + lag
        if(j.ge.1 .and. j.le.nz-8) then
           x=ss(j)
           if(npr(i).eq.0) then
              s0=s0 + x
           else
              s1=s1 + x
           endif
        endif
     enddo
     ccf(lag)=nflip*(s1-s0)
     if(ccf(lag).gt.ccfbest) then
        ccfbest=ccf(lag)
        lagpk=lag
        xlagpk=lagpk
     endif
  enddo
  if( lagpk.gt.-LAGMAX .and. lagpk.lt.LAGMAX) then
     call peakup(ccf(lagpk-1),ccf(lagpk),ccf(lagpk+1),dx)
     xlagpk=lagpk+dx
  endif
  return
end subroutine ccf2