diff options
| author | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
| commit | 059831534c7e884f0a607ed86b582fd00d821731 (patch) | |
| tree | 76bcb67a78f8aa2654fd34c2ad801a62136b0170 /lib/superfox/qpc_sync.f90 | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'lib/superfox/qpc_sync.f90')
| -rw-r--r-- | lib/superfox/qpc_sync.f90 | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/superfox/qpc_sync.f90 b/lib/superfox/qpc_sync.f90 index ea9afb5b..9c80b390 100644 --- a/lib/superfox/qpc_sync.f90 +++ b/lib/superfox/qpc_sync.f90 @@ -46,6 +46,12 @@ subroutine qpc_sync(crcvd0,fsample,isync,fsync,ftol,f2,t2,snrsync) s0=s0+s(i) s1=s1+(i-i0)*s(i) enddo + if(.not. (s0 .gt. 0.0)) then + f2=fsync-750.0 + t2=0.0 + snrsync=0.0 + return + endif delta=s1/s0 i0=nint(i0+delta) f2=i0*df2-750.0 @@ -105,9 +111,22 @@ subroutine qpc_sync(crcvd0,fsample,isync,fsync,ftol,f2,t2,snrsync) sp=sp + p(lag) sq=sq + p(lag)*p(lag) enddo + if(nsum .le. 0) then + snrsync=0.0 + return + endif ave=sp/nsum - rms=sqrt(sq/nsum-ave*ave) - snrsync=(pmax-ave)/rms + var=sq/nsum-ave*ave + if(.not. (var .gt. 0.0)) then + snrsync=0.0 + return + endif + rms=sqrt(var) + if(rms .gt. 0.0) then + snrsync=(pmax-ave)/rms + else + snrsync=0.0 + endif return end subroutine qpc_sync |
