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

set amplitudes

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: 1504
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent c84490fb
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sigfit.cc,v 1.14 2004-03-16 21:14:56 tforb Exp $
* $Id: sigfit.cc,v 1.15 2004-03-17 15:00:32 tforb Exp $
* \author Thomas Forbriger
* \date 28/01/2004
*
......@@ -23,7 +23,7 @@
#define SIGFIT_VERSION \
"SIGFIT V1.3 fit signal by trial-signals"
#define SIGFIT_CVSID \
"$Id: sigfit.cc,v 1.14 2004-03-16 21:14:56 tforb Exp $"
"$Id: sigfit.cc,v 1.15 2004-03-17 15:00:32 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -60,8 +60,8 @@ struct Options {
double searchrange;
bool usesearchrange;
bool equalsearch;
bool fittrend;
bool fitoffset;
bool fittrend, fitoffset;
double amptrend, ampoffset;
}; // struct Options
// formatted number output
......@@ -80,7 +80,7 @@ int main(int iargc, char* argv[])
{
SIGFIT_VERSION "\n"
"usage: sigfit [-v] [-Tdate v] [-truncate]" "\n"
" [-Sramp] [-Sconst] [-residual f]" "\n"
" [-Sramp[=v]] [-Sconst[=v]] [-residual f]" "\n"
" [-searchrange[=r]] [-equalsearch]" "\n"
" signal trial [trial ...]" "\n"
" or: sigfit --help|-h" "\n"
......@@ -92,8 +92,8 @@ int main(int iargc, char* argv[])
SIGFIT_CVSID "\n"
"\n"
"-v be verbose" "\n"
"-Sramp add a ramp to the set of trial signals" "\n"
"-Sconst add a constant to the set of trial signals" "\n"
"-Sramp[=v] add a ramp to the set of trial signals with amplitude v" "\n"
"-Sconst[=v] add a constant (of value v) to the set of trial signals" "\n"
"-Tdate v tolerance for comparison of date of first sample" "\n"
" v give the tolerance in units of the sampling interval" "\n"
"-truncate truncate all series to the same number of samples" "\n"
......@@ -129,9 +129,9 @@ int main(int iargc, char* argv[])
// 6: equal search ranges
{"equalsearch",arg_no,"-"},
// 7: fit a trend
{"Sramp",arg_no,"-"},
{"Sramp",arg_opt,"1."},
// 8: fit an offset
{"Sconst",arg_no,"-"},
{"Sconst",arg_opt,"1."},
{NULL}
};
......@@ -189,6 +189,8 @@ int main(int iargc, char* argv[])
opt.equalsearch=cmdline.optset(6);
opt.fittrend=cmdline.optset(7);
opt.fitoffset=cmdline.optset(8);
opt.amptrend=cmdline.double_arg(7);
opt.ampoffset=cmdline.double_arg(8);
/*----------------------------------------------------------------------*/
......@@ -269,7 +271,7 @@ int main(int iargc, char* argv[])
Tbundle synsignal;
synsignal.header=signal.header;
synsignal=Tseries(signal.shape());
synsignal.series()=1.;
synsignal.series()=opt.ampoffset;
synsignal.header.station="NSP";
synsignal.header.channel="off";
synsignal.header.auxid="NSP";
......@@ -285,7 +287,8 @@ int main(int iargc, char* argv[])
synsignal=Tseries(signal.shape());
for (int i=synsignal.first(); i<=synsignal.last(); ++i)
{
synsignal(i)=2.*(i-(0.5*(synsignal.first()+synsignal.last())))/
synsignal(i)=2.*opt.amptrend*
(i-(0.5*(synsignal.first()+synsignal.last())))/
synsignal.size();
}
synsignal.header.station="NSP";
......
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