diff --git a/lib/flat4.f90 b/lib/flat4.f90 index f9d4c72f2..fd96a3aba 100644 --- a/lib/flat4.f90 +++ b/lib/flat4.f90 @@ -28,7 +28,7 @@ subroutine flat4(s,npts,nflatten) call pctile(s(ia),ib-ia+1,npct,base) !Find lowest npct of points in segment do i=ia,ib if(s(i).le.base) then - k=k+1 !Save these "lower envelope" points + if (k.lt.1000) k=k+1 !Save these "lower envelope" points x(k)=i-i0 y(k)=s(i) endif