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

program compiles

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: 2144
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent d87886ce
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.37 2006-06-29 07:11:44 tforb Exp $
# $Id: Makefile,v 1.38 2006-06-29 13:49:51 tforb Exp $
#
# Copyright (c) 2005 by Thomas Forbriger (BFO Schiltach)
#
......@@ -71,7 +71,7 @@ phasedsignals hamres siggen smoos dise: %: %.o
-L$(LOCLIBDIR)
newprog $@
noisymize teseco resaseda gatherdiff autocorr cross tidofi fredofi sigfit: \
teseco resaseda gatherdiff autocorr cross tidofi fredofi sigfit: \
%: %.o
$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ldatreadxx -llinearxx \
-ltsxx -ltfxx -lsffxx -lgsexx -ltime++ -laff \
......@@ -79,6 +79,15 @@ noisymize teseco resaseda gatherdiff autocorr cross tidofi fredofi sigfit: \
-L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS)
newprog $@
noisymize: \
%: %.o
$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ldatreadxx -llinearxx \
-ltsxx -ltfxx -lsffxx -lgsexx -ltime++ -laff \
-lgsl -lgslcblas \
-llapack -lblas -lcseife -lsffxx -lg2c -lm\
-L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS)
newprog $@
phasetest%.sff: phasedsignals
phasedsignals $@ -v -o -p $(patsubst phasetest%.sff,%,$@) -n 16 \
-t 10. -b 3. -s 0. -O 2 -N 6 -h 0.5
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: noisymize.cc,v 1.2 2006-06-29 12:59:21 tforb Exp $
* $Id: noisymize.cc,v 1.3 2006-06-29 13:49:52 tforb Exp $
* \author Thomas Forbriger
* \date 27/06/2006
*
......@@ -19,7 +19,7 @@
#define NOISYMIZE_VERSION \
"NOISYMIZE V1.0 program reads a set of SFF traces, convolves them with white noise and stacks"
#define NOISYMIZE_CVSID \
"$Id: noisymize.cc,v 1.2 2006-06-29 12:59:21 tforb Exp $"
"$Id: noisymize.cc,v 1.3 2006-06-29 13:49:52 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -27,10 +27,11 @@
#include <tfxx/commandline.h>
#include <tfxx/error.h>
#include <aff/series.h>
#include <aff/seriesoperators.h>
#include <tsxx/tsxx.h>
#include <tsxx/convolve.h>
#include <tsxx/sffheaders.h>
#include <tsxx/noise.h>
#include <tsxx/random.h>
#include <datreadxx/readany.h>
using std::cout;
......@@ -39,7 +40,7 @@ using std::endl;
// put all commandline settings into a struct
struct Options {
bool verbose, setnoiselength;
bool verbose, setnoiselength, overwrite;
int noiselength;
std::string inputformat;
}; // struct Options
......@@ -86,6 +87,7 @@ int main(int iargc, char* argv[])
"-v be verbose" "\n"
"-type t input file type" "\n"
"-n n number of noise samples to use" "\n"
"-o overwrite output" "\n"
};
// define commandline options
......@@ -100,6 +102,8 @@ int main(int iargc, char* argv[])
{"type",arg_yes,"sff"},
// 3: number of noise samples
{"n",arg_yes,"1"},
// 4: number of noise samples
{"o",arg_no,"-"},
{NULL}
};
......@@ -154,6 +158,7 @@ int main(int iargc, char* argv[])
opt.inputformat=cmdline.string_arg(2);
opt.setnoiselength=cmdline.optset(3);
opt.noiselength=cmdline.int_arg(3);
opt.overwrite=cmdline.optset(4);
Filenames filename;
TFXX_assert(cmdline.extra(), "ERROR: missing filename Zin!");
......@@ -222,8 +227,8 @@ int main(int iargc, char* argv[])
// go and noisymize data
// ---------------------
//
Tfile::Tbase::const_iterator Zit=Zindata.begin();
Tfile::Tbase::const_iterator Rit=Rindata.begin();
Zit=Zindata.begin();
Rit=Rindata.begin();
Tseries Zseries(Zit->size()), Rseries(Zit->size());
if (!opt.setnoiselength)
{
......@@ -231,8 +236,8 @@ int main(int iargc, char* argv[])
}
if (opt.verbose)
{
cout << "convolve " << Zit->size() " data samples (each trace) "
<< "with" << endl
cout << "convolve " << Zit->size()
<< " data samples (each trace) with" << endl
<< opt.noiselength << " samples of uniform gaussian noise"
<< " and stack." << endl;
}
......@@ -248,7 +253,60 @@ int main(int iargc, char* argv[])
/*----------------------------------------------------------------------*/
// write result
if (opt.verbose)
{ cout << "prepare output data" << endl; }
typedef ts::sff::SFFTimeSeries<Tseries> Tsffseries;
Tsffseries Zoutdata(Zseries), Routdata(Rseries);
Tsffseries::Theader Zheader(Zindata[0].header);
Tsffseries::Theader Rheader(Rindata[0].header);
sff::WID2 wid2line=Zheader.wid2();
wid2line.nsamples=Zoutdata.size();
wid2line.channel="Z";
Zheader.wid2(wid2line);
Zoutdata.header=Zheader;
wid2line=Rheader.wid2();
wid2line.nsamples=Routdata.size();
wid2line.channel="R";
Rheader.wid2(wid2line);
Routdata.header=Rheader;
{
if (opt.verbose) { cout << "open output file " << filename.Zout << endl; }
// check if output file exists and open
if (!opt.overwrite)
{
std::ifstream file(filename.Zout.c_str(),std::ios_base::in);
TFXX_assert((!file.good()),"ERROR: output file exists!");
}
std::ofstream ofs(filename.Zout.c_str());
sff::SFFostream<Tseries> os(ofs);
// prepare file FREE block
sff::FREE filefree;
filefree.append(NOISYMIZE_VERSION);
os << Zoutdata;
}
{
if (opt.verbose) { cout << "open output file " << filename.Rout << endl; }
// check if output file exists and open
if (!opt.overwrite)
{
std::ifstream file(filename.Rout.c_str(),std::ios_base::in);
TFXX_assert((!file.good()),"ERROR: output file exists!");
}
std::ofstream ofs(filename.Rout.c_str());
sff::SFFostream<Tseries> os(ofs);
// prepare file FREE block
sff::FREE filefree;
filefree.append(NOISYMIZE_VERSION);
os << Routdata;
}
}
/* ----- END OF noisymize.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