71 "usage: autocorr -v -o -D file [file [...]] outfile" "\n" 72 " or: autocorr --help|-h" "\n" 80 "-o overwrite existing output file" "\n" 81 "file ... input file(s)" "\n" 82 "outfile output file" "\n" 86 using namespace tfxx::cmdline;
87 static Declare options[]=
103 cerr << usage_text << endl;
108 Commandline cmdline(iargc, argv, options);
111 if (cmdline.optset(0))
113 cerr << usage_text << endl;
114 cerr << help_text << endl;
145 opt.
debug=cmdline.optset(3);
147 TFXX_assert(cmdline.extra(),
"missing input file!");
148 std::string outfile=cmdline.next();
149 TFXX_assert(cmdline.extra(),
"missing output file!");
151 while (cmdline.extra())
153 infiles.push_back(outfile);
154 outfile=cmdline.next();
157 if (opt.
verbose) { cout <<
"open output file " << outfile << endl; }
158 std::ofstream ofs(outfile.c_str());
159 datrw::osffstream os(ofs);
161 sff::SRCE srce=sff::srce_reference();
164 Tnames::const_iterator I=infiles.begin();
165 while (I!=infiles.end())
167 if (opt.
verbose) { cout <<
"open " << std::string(*I) << endl; }
168 std::ifstream ifs(I->c_str());
169 datrw::isffstream is(ifs, opt.
debug);
172 if (opt.
verbose) { cout <<
"read trace" << endl; }
175 is >> samples >> data.header;
179 if (opt.
verbose) { cout << data.header.line() << endl; }
181 result=ts::correlate(data,data);
183 result.header=data.header;
184 result.header.auxid=
"corr";
185 result.header.date=srce.date
186 +(result.first()*libtime::double2time(result.header.dt));
187 if (is.hasinfo()) { os << info; }
std::list< std::string > Tnames
aff::Series< double > Tseries