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

proceeding with signal processing

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: 1485
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 83bbccf1
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: bundles.h,v 1.1 2004-01-28 14:14:47 tforb Exp $
* $Id: bundles.h,v 1.2 2004-02-10 16:05:00 tforb Exp $
* \author Thomas Forbriger
* \date 28/01/2004
*
......@@ -23,7 +23,7 @@
#define TF_BUNDLES_H_VERSION \
"TF_BUNDLES_H V1.0 "
#define TF_BUNDLES_H_CVSID \
"$Id: bundles.h,v 1.1 2004-01-28 14:14:47 tforb Exp $"
"$Id: bundles.h,v 1.2 2004-02-10 16:05:00 tforb Exp $"
#include<aff/series.h>
#include<sffxx.h>
......@@ -42,6 +42,27 @@ namespace ts {
S series;
}; // struct Bundle
//! write a bundle to an output stream
template<class T>
std::ostream& operator<<(std::ostream& os,
const Bundle<sff::WID2, aff::Series<T> >& b)
{
sff::TraceHeader traceheader(b.header);
os << sff::OutputWaveform<aff::Series<T> >(b.series, traceheader,
sff::NM_maxdyn);
return(os);
}
//! function to assist writing of last bundle
template<class T>
sff::OutputWaveform<aff::Series<T> >
lastbundle(const Bundle<sff::WID2, aff::Series<T> >& b)
{
sff::TraceHeader traceheader(b.header, true);
return(sff::OutputWaveform<aff::Series<T> >(b.series, traceheader,
sff::NM_maxdyn));
}
// define bundle typedefs
typedef Bundle<sff::WID2, aff::Series<double> > TDsffbundle;
typedef Bundle<sff::WID2, aff::Series<float> > TSsffbundle;
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sigfit.cc,v 1.5 2004-02-08 15:35:44 tforb Exp $
* $Id: sigfit.cc,v 1.6 2004-02-10 16:05:00 tforb Exp $
* \author Thomas Forbriger
* \date 28/01/2004
*
......@@ -19,7 +19,7 @@
#define SIGFIT_VERSION \
"SIGFIT V1.0 fit signal by trial-signals"
#define SIGFIT_CVSID \
"$Id: sigfit.cc,v 1.5 2004-02-08 15:35:44 tforb Exp $"
"$Id: sigfit.cc,v 1.6 2004-02-10 16:05:00 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -32,6 +32,7 @@
#include <tsxx/innerproduct.h>
#include <aff/array.h>
#include <aff/dump.h>
#include <aff/seriesoperators.h>
#include <linearxx/lapackxx.h>
typedef std::list<std::string> Tnamelist;
......@@ -274,7 +275,42 @@ int main(int iargc, char* argv[])
rhs(i)=ts::innerproduct(bundlevec[i-1].series, signal.series);
}
// solve
coeff=linear::lapack::dposv(Matrix,rhs);
// set up synthetics
Tbundle synthetics;
synthetics.series=Tseries(signal.series.shape());
synthetics.series=0;
for (int i=1; i<=N; ++i)
{ synthetics.series += coeff(i) * bundlevec[i-1].series; }
synthetics.header=signal.header;
synthetics.header.channel="synt";
// set up residual
Tbundle residual;
residual.series=Tseries(signal.series.shape());
residual.series=signal.series-synthetics.series;
residual.header=signal.header;
residual.header.channel="diff";
// calculate rms values
double signalrms=ts::rms(signal.series);
double residualrms=ts::rms(residual.series);
cout << "signalrms: " << signalrms << endl;
cout << "residualrms: " << residualrms << endl;
cout << "coefficients: " << endl;
for (int i=1; i<=N; ++i)
{ cout << coeff(i) << " "; }
cout << endl;
std::ofstream os("junkname");
sff::FileHeader fileheader;
os << fileheader;
os << signal;
os << synthetics;
os << ts::lastbundle(residual);
}
/* ----- 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