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===========================================================================
22 c Wiener filter (2): filter using periodogram in file
23 c author T. Schreiber (1998)
24 c===========================================================================
26 dimension x(nx), a(nx)
27 character*72 file, fout, ffin
31 call whatido("Wiener filter (second part)",iverb)
37 isfin=igetfin(ffin,iverb)
38 isout=igetout(fout,iverb)
39 call nthstring(1,file)
40 if(file.eq."-") stop "wiener2: cannot read stdin"
41 call readfile(nmax,x,nexcl,jcol,file,iverb)
42 call normal(nmax,x,sc,sd)
45 if(dh.eq.0.) dh=h/nmaxp
47 if(ibin.gt.0) write(istderr(),*)
48 . "wiener1: binning", 2*ibin+1," frequencies"
49 if(isout.eq.1) call addsuff(fout,file,"_amp")
50 if(fout.eq." ") fout="-"
51 call infile(fout,iunit,iverb)
52 read(iunit,*) dum, a(1)
53 do 10 i=2+ibin,(nmaxp+1)/2-ibin,2*ibin+1
54 10 read(iunit,*) dum, a(2*i-2)
55 if(mod(nmaxp,2).eq.0) read(iunit,*)
57 d=tospec(nmaxp,a,x,ibin)
58 if(iv_io(iverb).eq.1) write(istderr(),*) "rms correction: ", d
59 if(isfin.eq.1) call addsuff(ffin,file,"_wc")
62 call writefile(nmax,x,ffin,iverb)
69 . "[-f# -w# -o outfile1 -O outfile -l# -x# -c# -V# -h] file")
70 call ptext("to provide periodogram, first run:"//
71 . " wiener1 [-f# -w# -o outfile -l# -x# -c# -V# -h] file")
72 call ptext("make sure -f# -w# are the same in both wiener calls")
73 call popt("f","sampling rate (e.g. in Hz, default 1.)")
74 call popt("w","frequency resolution (e.g. in Hz, default 1/N)")
75 call popt("l","number of values to be read (all)")
76 call popt("x","number of values to be skipped (0)")
77 call popt("c","column to be read (1 or file,#)")
78 call popt("o","output file of wiener1, just -o means file_amp")
79 call popt("O","final output file name, just -O means file_wc")
81 call ptext("Note: ""-"" not accepted as file")
86 function igetfin(fout,iverb)
87 c gets alternate output file name, default " "
88 c return 1 if fout must be determined from input file name
92 call stcan("O",fout," ")
93 if(fout.ne." ") return