Commit 4fda7cc2 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding with sigfit

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1460
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 7a11d703
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sigfit.cc,v 1.1 2004-01-28 14:54:16 tforb Exp $
* $Id: sigfit.cc,v 1.2 2004-01-28 15:55:41 tforb Exp $
* \author Thomas Forbriger
* \date 28/01/2004
*
......@@ -19,13 +19,14 @@
#define SIGFIT_VERSION \
"SIGFIT V1.0 fit signal by trial-signals"
#define SIGFIT_CVSID \
"$Id: sigfit.cc,v 1.1 2004-01-28 14:54:16 tforb Exp $"
"$Id: sigfit.cc,v 1.2 2004-01-28 15:55:41 tforb Exp $"
#include <fstream>
#include <iostream>
#include <list>
#include <vector>
#include <tfxx/commandline.h>
#include <tfxx/error.h>
#include <sffxx.h>
#include <tsxx/bundles.h>
......@@ -125,26 +126,57 @@ int main(int iargc, char* argv[])
Options opt;
opt.verbose=cmdline.optset(1);
/*----------------------------------------------------------------------*/
// read file names
TFXX_assert(cmdline.extra(),"ERROR: missing signal file name!");
std::string signalname=cmdline.next();
TFXX_assert(cmdline.extra(),"ERROR: missing trial signal file name!");
Tnamelist namelist;
while (cmdline.extra()) { namelist.push_back(cmdline.next()); }
// read signal file
Tbundle signal;
{
if (opt.verbose)
{ cout << "read signal file \"" << signalname << "\"" << endl; }
std::ifstream is(signalname.c_str());
sff::FileHeader fileheader(is);
if (opt.verbose)
{ cout << " read trace" << endl; }
sff::InputWaveform<Tseries> inputwaveform(is);
sff::TraceHeader traceheader=inputwaveform.header();
signal.header=traceheader.wid2();
signal.series=inputwaveform.series();
bool last=traceheader.last();
std::string wid2line=signal.header.line();
if (opt.verbose)
{
cout << " " << wid2line.substr(0,69) << endl;
if (!last)
{
cout << "there are more traces in that files" << endl
<< "ignoring them..." << endl;
}
}
}
// read trial files
if (opt.verbose)
{ cout << namelist.size() << "files to read" << endl; }
// read files
{ cout << namelist.size() << " trial data files to read" << endl; }
Tbundlevec bundlevec;
for (Tnamelist::const_iterator i=namelist.begin(); i!=namelist.end(); i++)
{
if (opt.verbose)
{ cout << "read file \"" << *i << "\"" << endl; }
{ cout << "read trial data file \"" << *i << "\"" << endl; }
std::ifstream is(i->c_str());
sff::FileHeader fileheader(is);
bool last=false;
while(!last)
{
if (opt.verbose)
{ cout << " read trace #" << bundlevec.size()+1 << endl; }
{ cout << " read trial signal #" << bundlevec.size()+1 << endl; }
sff::InputWaveform<Tseries> inputwaveform(is);
sff::TraceHeader traceheader=inputwaveform.header();
Tbundle bundle;
......@@ -157,6 +189,23 @@ int main(int iargc, char* argv[])
{ cout << " " << wid2line.substr(0,69) << endl; }
}
}
/*----------------------------------------------------------------------*/
sff::WID2compare compare(sff::Fnsamples | sff::Fdt);
if (opt.verbose) { cout << "checking consistency..." << endl; }
for (Tbundlevec::const_iterator i=bundlevec.begin(); i!=bundlevec.end(); i++)
{
if (!compare (i->header,signal.header))
{
cerr << "ERROR: header signature mismatch:" << endl;
cerr << "signal:" << endl;
cerr << signal.header.line();
cerr << "trial signal:" << endl;
cerr << i->header.line();
TFXX_abort("baling out...");
}
}
}
/* ----- END OF sigfit.cc ----- */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment