summaryrefslogtreecommitdiff
path: root/lib/fchisq.f90
blob: 03168f8c51030ee7d00b75726863ae11bdfbd171 (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
real function fchisq(c3,npts,fsample,a)

  parameter (NMAX=85*16)
  complex c3(npts)
  complex c4(NMAX)
  real a(3)
  complex z
  include 'jt9sync.f90'

  call twkfreq(c3,c4,npts,fsample,a)

! Get sync power.
  nspsd=16
  sum1=0.
  k=-1
  do i=1,85
     z=0.
     do j=1,nspsd
        k=k+1
        z=z+c4(k+1)
     enddo
     pp=real(z)**2 + aimag(z)**2     
     if(isync(i).eq.1) then
        sum1=sum1+pp
     endif
  enddo
  fchisq=-sum1/10000.0

  return
end function fchisq