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

finished

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: 1607
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent cc28502b
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: hpmo.cc,v 1.7 2004-12-23 12:38:26 tforb Exp $
* $Id: hpmo.cc,v 1.8 2004-12-23 14:03:34 tforb Exp $
* \author Thomas Forbriger
* \date 31/03/2004
*
......@@ -19,7 +19,7 @@
#define DATREAD_HPMO_CC_VERSION \
"DATREAD_HPMO_CC V1.0 "
#define DATREAD_HPMO_CC_CVSID \
"$Id: hpmo.cc,v 1.7 2004-12-23 12:38:26 tforb Exp $"
"$Id: hpmo.cc,v 1.8 2004-12-23 14:03:34 tforb Exp $"
#include <datreadxx/datread.h>
#include <datreadxx/util.h>
......@@ -40,7 +40,21 @@ namespace datread {
Tdseries ihpmostream::dseries()
{
Tdseries retval;
const int firstblock=Mindex[Mnextblock];
const int lastblock=Mindex[Mnextblock+1]-1;
const int nblocks=lastblock-firstblock+1;
const int nsamp=nblocks*datread::hpmo::nsamples;
Tdseries retval(nsamp);
int isample=0;
for (int iblock=firstblock; iblock<=lastblock; ++iblock)
{
for (int i=1; i<=datread::hpmo::nsamples; ++i)
{
retval(isample)=Mdatafile[iblock].Mdata(Mnextchannel, i);
++isample;
}
}
this->set_next_header();
return(retval);
}
......@@ -111,7 +125,7 @@ namespace datread {
<< Mnblocks << " contiguous data block(s)" << std::endl;
}
// marks last block
Mindex[Mnblocks]=nblocksread+1;
Mindex[Mnblocks]=nblocksread;
// init reading pointers
Mnextblock=0;
Mnextchannel=1;
......@@ -131,11 +145,13 @@ namespace datread {
void ihpmostream::set_next_header()
{
const int& firstblock=Mindex[Mnextblock];
const int& lastblock=Mindex[Mnextblock+1]-1;
const int firstblock=Mindex[Mnextblock];
const int lastblock=Mindex[Mnextblock+1]-1;
const int nblocks=lastblock-firstblock+1;
const int nsamp=nblocks*datread::hpmo::nsamples;
// DEBUG
std::cout << firstblock << " " << lastblock << " "
<< Mnextblock << " " << Mnextchannel << std::endl;
// std::cout << firstblock << " " << lastblock << " "
// << Mnextblock << " " << Mnextchannel << std::endl;
this->newtrace();
// set WID2 header
sff::WID2 wid2line;
......@@ -148,6 +164,7 @@ namespace datread {
oss.fill('0');
oss << Mnextchannel;
wid2line.channel=oss.str();
wid2line.nsamples=nsamp;
// calculate time of first sample for this channel
wid2line.date=Mdatafile[firstblock].Mtime;
wid2line.date -= libtime::TRelativeTime(0,0,0,57);
......@@ -159,6 +176,8 @@ namespace datread {
<< lastblock-firstblock+1 << " contiguous minute blocks";
sff::FREE tracefree;
tracefree.append(oss.str());
tracefree.append(qualityreports(&Mdatafile[firstblock],
lastblock-firstblock+1));
this->settracefree(tracefree);
// proceed pointers to next trace
++Mnextchannel;
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: hpmotest.cc,v 1.9 2004-12-23 12:38:26 tforb Exp $
* $Id: hpmotest.cc,v 1.10 2004-12-23 14:03:34 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2004
*
......@@ -19,7 +19,7 @@
#define HPMOTEST_VERSION \
"HPMOTEST V1.0 test hpmo reading functions"
#define HPMOTEST_CVSID \
"$Id: hpmotest.cc,v 1.9 2004-12-23 12:38:26 tforb Exp $"
"$Id: hpmotest.cc,v 1.10 2004-12-23 14:03:34 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -27,13 +27,14 @@
#include <datreadxx/error.h>
#include <datreadxx/readhpmo.h>
#include <datreadxx/hpmo.h>
#include <aff/dump.h>
using std::cout;
using std::cerr;
using std::endl;
struct Options {
bool verbose, stage1, stage2, stage3;
bool verbose, stage1, stage2, stage3, extractsamples;
}; // struct Options
int main(int iargc, char* argv[])
......@@ -43,7 +44,7 @@ int main(int iargc, char* argv[])
char usage_text[]=
{
HPMOTEST_VERSION "\n"
"usage: hpmotest [-v] [-s1] [-s2] [-s3] filename" "\n"
"usage: hpmotest [-v] [-s1] [-s2] [-s3] [-x] filename" "\n"
" or: hpmotest --help|-h" "\n"
};
......@@ -56,6 +57,7 @@ int main(int iargc, char* argv[])
"-s1 test reading functions of stage 1" "\n"
"-s2 test reading functions of stage 2" "\n"
"-s3 test reading functions of stage 3" "\n"
"-x extract samples in stage 3" "\n"
};
// define commandline options
......@@ -72,6 +74,8 @@ int main(int iargc, char* argv[])
{"s2",arg_no,"-"},
// 4: test stage 3
{"s3",arg_no,"-"},
// 5: extract samples
{"x",arg_no,"-"},
{NULL}
};
......@@ -121,6 +125,7 @@ int main(int iargc, char* argv[])
opt.stage1=cmdline.optset(2);
opt.stage2=cmdline.optset(3);
opt.stage3=cmdline.optset(4);
opt.extractsamples=cmdline.optset(5);
DATREAD_assert(cmdline.extra(), "missing filename!");
std::string infile=cmdline.next();
......@@ -208,7 +213,15 @@ int main(int iargc, char* argv[])
cout << filefree;
while (is.good())
{
is.skipseries();
datread::Tfseries data;
if (opt.extractsamples)
{
is >> data;
}
else
{
is.skipseries();
}
sff::WID2 wid2line;
cout << std::endl << "next trace: " << std::endl;
is >> wid2line;
......@@ -216,6 +229,7 @@ int main(int iargc, char* argv[])
sff::FREE tracefree;
is >> tracefree;
cout << tracefree;
if (opt.extractsamples) { DUMP( data ); }
}
}
}
......
Supports Markdown
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