summaryrefslogtreecommitdiff
path: root/lib/afc65b.f90
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
commitffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch)
tree1269efa852935b183daae4bb33a58d1b4d2ffb53 /lib/afc65b.f90
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'lib/afc65b.f90')
-rw-r--r--lib/afc65b.f9017
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/afc65b.f90 b/lib/afc65b.f90
index 18bbb691..d006e222 100644
--- a/lib/afc65b.f90
+++ b/lib/afc65b.f90
@@ -2,9 +2,14 @@ subroutine afc65b(cx,npts,fsample,nflip,mode65,a,ccfbest,dtbest)
! Find delta f, f1, f2 ==> a(1:3)
+ use jt65_mod, only: jt65_work,ensure_jt65_workspace
+
complex cx(npts)
real a(5),deltaa(5)
+ call ensure_jt65_workspace()
+ jt65_work%afc_valid=.false.
+ dtmax=0.
a=0.
a1=0.
a2=0.
@@ -57,7 +62,10 @@ subroutine afc65b(cx,npts,fsample,nflip,mode65,a,ccfbest,dtbest)
delta=deltaa(j)
10 a(j)=a(j)+delta
chisq2=fchisq65(cx,npts,fsample,nflip,a,ccfmax,dtmax)
- if(chisq2.eq.chisq1) go to 10
+ if(chisq2.eq.chisq1) then
+ a(j)=a(j)-delta
+ cycle
+ endif
if(chisq2.gt.chisq1) then
delta=-delta !Reverse direction
a(j)=a(j)+delta
@@ -75,13 +83,18 @@ subroutine afc65b(cx,npts,fsample,nflip,mode65,a,ccfbest,dtbest)
endif
! Find minimum of parabola defined by last three points
- delta=delta*(1./(1.+(chisq1-chisq2)/(chisq3-chisq2))+0.5)
+ if(chisq3.eq.chisq2) then
+ delta=0.5*delta
+ else
+ delta=delta*(1./(1.+(chisq1-chisq2)/(chisq3-chisq2))+0.5)
+ endif
a(j)=a(j)-delta
deltaa(j)=deltaa(j)*fn/3.
! write(*,4000) iter,j,a(1:2),-chisq2
!4000 format(2i2,4f9.4)
enddo
chisqr=fchisq65(cx,npts,fsample,nflip,a,ccfmax,dtmax)
+ if(chisqr0==0.) exit
fdiff=chisqr/chisqr0-1.0
! write(*,4000) 0,0,a(1:2),-chisqr,fdiff
if(abs(fdiff).lt.0.0001) exit