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

correction

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: 2156
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 04f648f7
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: noisymize.cc,v 1.4 2006-06-29 14:30:27 tforb Exp $ * $Id: noisymize.cc,v 1.5 2006-07-12 06:14:33 tforb Exp $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 27/06/2006 * \date 27/06/2006
* *
...@@ -13,13 +13,14 @@ ...@@ -13,13 +13,14 @@
* *
* REVISIONS and CHANGES * REVISIONS and CHANGES
* - 27/06/2006 V1.0 Thomas Forbriger * - 27/06/2006 V1.0 Thomas Forbriger
* - 11/07/2006 V1.1 keep result of full convolution length
* *
* ============================================================================ * ============================================================================
*/ */
#define NOISYMIZE_VERSION \ #define NOISYMIZE_VERSION \
"NOISYMIZE V1.0 program reads a set of SFF traces, convolves them with white noise and stacks" "NOISYMIZE V1.1 program reads a set of SFF traces, convolves them with white noise and stacks"
#define NOISYMIZE_CVSID \ #define NOISYMIZE_CVSID \
"$Id: noisymize.cc,v 1.4 2006-06-29 14:30:27 tforb Exp $" "$Id: noisymize.cc,v 1.5 2006-07-12 06:14:33 tforb Exp $"
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
...@@ -70,7 +71,7 @@ int main(int iargc, char* argv[]) ...@@ -70,7 +71,7 @@ int main(int iargc, char* argv[])
{ {
NOISYMIZE_VERSION "\n" NOISYMIZE_VERSION "\n"
"usage: noisymize Zin Rin Zout Rout" "\n" "usage: noisymize Zin Rin Zout Rout" "\n"
" [-v] [-type t] [-n n]" "\n" " [-v] [-type t] [-n n] [-o]" "\n"
" or: noisymize --help|-h" "\n" " or: noisymize --help|-h" "\n"
}; };
...@@ -229,7 +230,8 @@ int main(int iargc, char* argv[]) ...@@ -229,7 +230,8 @@ int main(int iargc, char* argv[])
// //
Zit=Zindata.begin(); Zit=Zindata.begin();
Rit=Rindata.begin(); Rit=Rindata.begin();
Tseries Zseries(Zit->size()), Rseries(Zit->size()); // results
Tseries Zseries, Rseries;
if (!opt.setnoiselength) if (!opt.setnoiselength)
{ {
opt.noiselength=Zit->size(); opt.noiselength=Zit->size();
...@@ -241,15 +243,23 @@ int main(int iargc, char* argv[]) ...@@ -241,15 +243,23 @@ int main(int iargc, char* argv[])
<< opt.noiselength << " samples of uniform gaussian noise" << opt.noiselength << " samples of uniform gaussian noise"
<< " and stack." << endl; << " and stack." << endl;
} }
bool initialize_result=true;
while((Zit!=Zindata.end()) && (Rit!=Rindata.end())) while((Zit!=Zindata.end()) && (Rit!=Rindata.end()))
{ {
if (opt.verbose) { cout << "*"; cout.flush(); } if (opt.verbose) { cout << "*"; cout.flush(); }
Tseries noise=ts::rnd::dugauss(opt.noiselength); Tseries noise=ts::rnd::dugauss(opt.noiselength);
Tseries fac=ts::rnd::dugauss(1); Tseries fac=ts::rnd::dugauss(1);
if (opt.verbose) { cout << "+"; cout.flush(); } if (opt.verbose) { cout << "+"; cout.flush(); }
Zseries += fac(0)*ts::convolve(*Zit, noise); if (initialize_result)
{ Zseries = fac(0)*ts::convolve(*Zit, noise); }
else
{ Zseries += fac(0)*ts::convolve(*Zit, noise); }
if (opt.verbose) { cout << "+"; cout.flush(); } if (opt.verbose) { cout << "+"; cout.flush(); }
Rseries += fac(0)*ts::convolve(*Rit, noise); if (initialize_result)
{ Rseries = fac(0)*ts::convolve(*Rit, noise); }
else
{ Rseries += fac(0)*ts::convolve(*Rit, noise); }
initialize_result=false;
++Zit; ++Zit;
++Rit; ++Rit;
} }
......
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