Commit 5eb61d47 authored by Daniel Armbruster's avatar Daniel Armbruster Committed by thomas.forbriger
Browse files

Problem of ticket:183 fixed - cycling through all traces

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: 4584
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent ba5615af
......@@ -69,7 +69,6 @@
#include <aff/seriesoperators.h>
#include <linearxx/lapackxx.h>
//typedef std::list<std::string> Tnamelist;
// double precision time series bundle which includes a WID2 header
typedef ts::TDsfftimeseries Tbundle;
typedef datrw::Tdseries Tseries;
......@@ -358,24 +357,31 @@ int main(int iargc, char* argv[])
if (infile->haskey(formatkey)) { itype=infile->value(formatkey); }
if (opt.verbose)
{
cout << "sigfit: Open trial signal file " << infile->name << " of format "
<< itype << endl;
cout << "sigfit: Open trial signal file " << infile->name
<< " of format " << itype << endl;
}
std::ifstream ifs(infile->name.c_str(),
datrw::ianystream::openmode(itype));
datrw::ianystream is(ifs, itype);
bool selectedTraces=infile->haskey(tracekey);
// no traces of file were selected -> read the entire file
if (! selectedTraces)
tfxx::RangeList<int> rangeList;
if (selectedTraces)
{
rangeList = tfxx::string::rangelist<int>(infile->value(tracekey));
}
int traceNum = 1;
while (is.good())
{
std::ifstream ifs(infile->name.c_str(),
datrw::ianystream::openmode(itype));
datrw::ianystream is(ifs, itype);
int traceNum = 1;
while (is.good())
Tbundle bundle;
// traces were selected by tracekey
if (selectedTraces && rangeList.contains(traceNum))
{
if (opt.verbose)
{
cout << "sigfit: Reading trace #" << traceNum << " ..." << endl;
}
Tbundle bundle;
is >> bundle;
is >> bundle.header;
bundlevec.push_back(bundle);
......@@ -383,28 +389,13 @@ int main(int iargc, char* argv[])
{
cout << " " << bundle.header.line().substr(0,69) << endl;
}
++traceNum;
}
} else
// traces were selected by rangelist -> read only selected traces
{
tfxx::RangeListStepper<int> rls(tfxx::string::rangelist<int>(
infile->value(tracekey)));
while (rls.valid())
} else
// no selection by tracekey -> read every single trace
{
std::ifstream ifs(infile->name.c_str(),
datrw::ianystream::openmode(itype));
datrw::ianystream is(ifs, itype);
int traceNum = 1;
// spool to selected trace
while (traceNum!=rls.current()) { is.skipseries(); ++traceNum; }
TFXX_assert(is.good(), "Illegal trace selected.");
if (opt.verbose)
{
cout << "sigfit: Reading trace #" << traceNum << " ..." << endl;
}
Tbundle bundle;
is >> bundle;
is >> bundle.header;
bundlevec.push_back(bundle);
......@@ -412,8 +403,8 @@ int main(int iargc, char* argv[])
{
cout << " " << bundle.header.line().substr(0,69) << endl;
}
++rls;
}
++traceNum;
}
++infile;
}
......
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