6 #include <boost/random/lagged_fibonacci.hpp>
7 #include <boost/random/normal_distribution.hpp>
8 #include <boost/random/variate_generator.hpp>
9 #include <boost/bind.hpp>
14 using namespace gplib;
16 int main(
int argc,
char* argv[])
19 string datafilename, outfilename;
22 string version =
"$Id: surfnoise.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
24 cout <<
"Program " << version << endl;
25 cout <<
" Add random noise to surface wave dispersion data" << endl;
27 <<
" Input is a surface wave dispersion file, output a dispersion file with added noise"
29 cout <<
" The noise level is specified relative to each datapoint" << endl;
33 datafilename = argv[1];
34 outfilename = argv[2];
35 noiselevel = atof(argv[3]);
39 datafilename = AskFilename(
"Input file: ");
40 outfilename = AskFilename(
"Output filename: ");
41 cout <<
"Noise level: ";
45 boost::lagged_fibonacci607
46 generator(static_cast<unsigned int>(std::time(0)));
50 for (
size_t i =0; i < ndata; ++i)
52 Data.
SetPhaseVelocities().at(i) = boost::variate_generator<boost::lagged_fibonacci607&,
53 boost::normal_distribution<> >(generator,
const trealdata & GetPhaseVelocities() const
Read-only access to the vector of phase velocities.
A class to read, write and store fundamental mode surface wave dispersion data.
virtual void WriteAscii(const std::string &filename) const
Write the data in simple ascii format.
void ReadFile(const std::string &filename)
Read data from file, depending on the extension.
trealdata & SetPhaseVelocities()
Read-write access to phase velocities, the format might be changed in the future. ...
int main(int argc, char *argv[])