1 c===========================================================================
3 c This file is part of TISEAN
5 c Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber
7 c TISEAN is free software; you can redistribute it and/or modify
8 c it under the terms of the GNU General Public License as published by
9 c the Free Software Foundation; either version 2 of the License, or
10 c (at your option) any later version.
12 c TISEAN is distributed in the hope that it will be useful,
13 c but WITHOUT ANY WARRANTY; without even the implied warranty of
14 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 c GNU General Public License for more details.
17 c You should have received a copy of the GNU General Public License
18 c along with TISEAN; if not, write to the Free Software
19 c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 c===========================================================================
23 c Determine end-to-end mismatch before making surrogate data
24 c author T. Schreiber (1999)
25 c===========================================================================
27 parameter(nx=100000,mx=20)
28 dimension x(nx,mx), icol(mx)
29 character*72 file, fout
32 call whatido("Determine end-to-end mismatch",iverb)
37 call columns(mc,mx,icol)
38 if(mcmax.eq.0) mcmax=max(1,mc)
39 isout=igetout(fout,iverb)
41 call nthstring(1,file)
42 call xreadfile(nmax,mcmax,nx,x,nexcl,icol,file,iverb)
43 if(file.eq."-") file="stdin"
44 if(isout.eq.1) call addsuff(fout,file,"_end")
45 call outfile(fout,iunit,iverb)
49 call jump(nmax,nmaxp,nx,x,mcmax,wjump,etot,ejump,eslip,njump)
50 if(etot.lt.etotm) then
52 write(iunit,'(a,i7,a,i7,a,f5.1,a)')
54 . " offset: ", nexcl+njump,
55 . " lost: ", real(nmax-nmaxp)/real(nmax)*100, " %"
56 write(iunit,*) " jump: ", ejump*100, " %"
57 write(iunit,*) " slip: ", eslip*100, " %"
58 write(iunit,*) " weighted: ", etot*100, " %"
70 . "[-j# -o outfile -l# -x# -c# -V# -h] file")
71 call popt("j","weight given to jump relative to slip (0.5)")
72 call popt("l","number of values to be read (all)")
73 call popt("x","number of values to be skipped (0)")
74 call popt("m","number of columns to be read (1)")
75 call popt("c","columns to be read (1)")
81 subroutine jump(nmax,nmaxp,nx,x,mcmax,wjump,etot,ejump,eslip,
83 c loop through time ofsets to minimize jump effect
91 xj=xj+xjump(nmaxp,x(1+nj,m))
92 20 sj=sj+sjump(nmaxp,x(1+nj,m))
93 if(wjump*xj+(1-wjump)*sj.ge.etot) goto 10
94 etot=wjump*xj+(1-wjump)*sj
101 function xjump(nmax,x)
102 c contribution of end effect to 1st derivative
105 call rms(nmax,x,sc,sd)
108 xjump=(x(1)-x(nmax))**2/(nmax*sd**2)
111 function sjump(nmax,x)
112 c contribution of end effect to 2nd derivative
115 call rms(nmax,x,sc,sd)
118 sjump=((x(nmax)-x(nmax-1))-(x(2)-x(1)))**2 / (nmax*sd**2)