Fix the loop exit criterion in polfit.f90.

This commit is contained in:
Joe Taylor 2021-07-01 11:14:46 -04:00
parent e0c06168cf
commit 525c791a16
2 changed files with 5 additions and 4 deletions

View File

@ -56,15 +56,16 @@ subroutine polfit(y,npts,a)
deltaa(j)=deltaa(j)*fn/3. deltaa(j)=deltaa(j)*fn/3.
! write(*,4000) iter,j,a,deltaa,chisq2 ! write(*,4000) iter,j,a,deltaa,chisq2
!4000 format(2i2,2(2x,3f8.2),f12.5) !4000 format(2i2,2(2x,3f8.2),f12.5)
enddo enddo ! j=1,nterms
chisqr=fchisq_pol(y,npts,a) chisqr=fchisq_pol(y,npts,a)
! write(*,4000) 0,0,a,chisqr ! write(*,4000) 0,0,a,chisqr
if(chisqr.lt.1.0) exit
if(deltaa(1).lt.0.01*(a(2)-a(1)) .and. deltaa(2).lt.0.01*(a(2)-a(1)) & if(deltaa(1).lt.0.01*(a(2)-a(1)) .and. deltaa(2).lt.0.01*(a(2)-a(1)) &
.and. deltaa(3).lt.1.0) exit .and. deltaa(3).lt.1.0) exit
if(chisqr/chisqr0.gt.0.99) exit if(chisqr/chisqr0.gt.0.99) exit
a(3)=mod(a(3)+360.0,180.0)
chisqr0=chisqr chisqr0=chisqr
enddo enddo ! iter
a(3)=mod(a(3)+360.0,180.0)
return return
end subroutine polfit end subroutine polfit

View File

@ -44,7 +44,7 @@ subroutine get_candidates(ss,savg,xpol,nfa,nfb,nts_jt65,nts_q65,cand,ncand)
enddo enddo
jz=j jz=j
call wb_sync(ss,savg,xpol,jz,nfa,nfb) call wb_sync(ss,savg,xpol,jz,nfa,nfb)
tstep=2048.0/11025.0 !0.185760 s: 0.5*tsym_jt65, 0.3096*tsym_q65 tstep=2048.0/11025.0 !0.185760 s: 0.5*tsym_jt65, 0.3096*tsym_q65
df3=96000.0/NFFT df3=96000.0/NFFT