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

proceeding with flspherplotport

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.
proceeding with doz compu
started new project noisymize


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2140
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent bb41604e
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: sffxx.cc,v 1.20 2006-03-28 15:58:18 tforb Exp $ * $Id: sffxx.cc,v 1.21 2006-06-29 07:11:41 tforb Exp $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 21/12/2003 * \date 21/12/2003
* *
...@@ -43,13 +43,14 @@ ...@@ -43,13 +43,14 @@
* - check SFF file type version to be at least 1.10 * - check SFF file type version to be at least 1.10
* - 27/03/2006 V1.6 allow reading of V1.09 files * - 27/03/2006 V1.6 allow reading of V1.09 files
* introduced sff::STAT::decode_libversion * introduced sff::STAT::decode_libversion
* - 27/06/2006 V1.7 added INFO comparison
* *
* ============================================================================ * ============================================================================
*/ */
#define TF_SFFXX_CC_VERSION \ #define TF_SFFXX_CC_VERSION \
"TF_SFFXX_CC V1.6" "TF_SFFXX_CC V1.7"
#define TF_SFFXX_CC_CVSID \ #define TF_SFFXX_CC_CVSID \
"$Id: sffxx.cc,v 1.20 2006-03-28 15:58:18 tforb Exp $" "$Id: sffxx.cc,v 1.21 2006-06-29 07:11:41 tforb Exp $"
#include<sstream> #include<sstream>
#include <sffxx.h> #include <sffxx.h>
...@@ -465,6 +466,15 @@ namespace sff { ...@@ -465,6 +466,15 @@ namespace sff {
is >> nstacks; is >> nstacks;
} // INFO::read } // INFO::read
bool INFO::operator==(const INFO& info) const
{
return ((info.cs==this->cs) |
(info.cx==this->cx) |
(info.cy==this->cy) |
(info.cz==this->cz) |
(info.nstacks==this->nstacks));
}
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
// FileHeader // FileHeader
// ---------- // ----------
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: sffxx.h,v 1.28 2006-04-26 14:52:41 tforb Exp $ * $Id: sffxx.h,v 1.29 2006-06-29 07:11:41 tforb Exp $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 21/12/2003 * \date 21/12/2003
* *
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
* - TraceHeader modification functions * - TraceHeader modification functions
* - 23/12/2004 V1.3 added full block append to FREE * - 23/12/2004 V1.3 added full block append to FREE
* - 27/03/2006 V1.4 introduced sff::STAT::decode_libversion * - 27/03/2006 V1.4 introduced sff::STAT::decode_libversion
* - 27/06/2006 V1.5 added INFO comparison
* *
* ============================================================================ * ============================================================================
*/ */
...@@ -45,9 +46,9 @@ ...@@ -45,9 +46,9 @@
#ifndef TF_SFFXX_H_VERSION #ifndef TF_SFFXX_H_VERSION
#define TF_SFFXX_H_VERSION \ #define TF_SFFXX_H_VERSION \
"TF_SFFXX_H V1.4" "TF_SFFXX_H V1.5"
#define TF_SFFXX_H_CVSID \ #define TF_SFFXX_H_CVSID \
"$Id: sffxx.h,v 1.28 2006-04-26 14:52:41 tforb Exp $" "$Id: sffxx.h,v 1.29 2006-06-29 07:11:41 tforb Exp $"
#include<string> #include<string>
#include<cmath> #include<cmath>
...@@ -158,6 +159,7 @@ namespace sff { ...@@ -158,6 +159,7 @@ namespace sff {
INFO(std::istream& is) { read(is); } INFO(std::istream& is) { read(is); }
std::string line() const; std::string line() const;
void read(std::istream& is); void read(std::istream& is);
bool operator==(const INFO& info) const;
public: public:
Ecoosys cs; Ecoosys cs;
double cx, cy, cz; double cx, cy, cz;
......
/*! \file random.cc
* \brief create a random series (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id: random.cc,v 1.1 2006-06-29 07:11:42 tforb Exp $
* \author Thomas Forbriger
* \date 27/06/2006
*
* create a random series (implementation)
*
* Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 27/06/2006 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define TF_RANDOM_CC_VERSION \
"TF_RANDOM_CC V1.0 "
#define TF_RANDOM_CC_CVSID \
"$Id: random.cc,v 1.1 2006-06-29 07:11:42 tforb Exp $"
#include <random.h>
namespace tf {
}
/* ----- END OF random.cc ----- */
/*! \file random.h
* \brief create a random series (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: random.h,v 1.1 2006-06-29 07:11:42 tforb Exp $
* \author Thomas Forbriger
* \date 27/06/2006
*
* create a random series (prototypes)
*
* Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 27/06/2006 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TF_RANDOM_H_VERSION
#define TF_RANDOM_H_VERSION \
"TF_RANDOM_H V1.0 "
#define TF_RANDOM_H_CVSID \
"$Id: random.h,v 1.1 2006-06-29 07:11:42 tforb Exp $"
namespace tf {
}
#endif // TF_RANDOM_H_VERSION (includeguard)
/* ----- END OF random.h ----- */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: tstest.cc,v 1.2 2006-03-29 07:42:58 tforb Exp $ * $Id: tstest.cc,v 1.3 2006-06-29 07:11:42 tforb Exp $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 20/12/2003 * \date 20/12/2003
* *
...@@ -29,17 +29,20 @@ ...@@ -29,17 +29,20 @@
* *
* REVISIONS and CHANGES * REVISIONS and CHANGES
* - 20/12/2003 V1.0 Thomas Forbriger * - 20/12/2003 V1.0 Thomas Forbriger
* - 27/06/2006 V1.1 did not work anymore; deleted old code and filled
* with convolution test
* *
* ============================================================================ * ============================================================================
*/ */
#define TSTEST_VERSION \ #define TSTEST_VERSION \
"TSTEST V1.0 test time series modules" "TSTEST V1.1 test time series modules"
#define TSTEST_CVSID \ #define TSTEST_CVSID \
"$Id: tstest.cc,v 1.2 2006-03-29 07:42:58 tforb Exp $" "$Id: tstest.cc,v 1.3 2006-06-29 07:11:42 tforb Exp $"
#include <iostream> #include <iostream>
#include <tsxx.h> #include <tsxx.h>
#include <aff/dump.h> #include <aff/dump.h>
#include <tsxx/convolve.h>
using std::cout; using std::cout;
using std::cerr; using std::cerr;
...@@ -47,27 +50,35 @@ using std::endl; ...@@ -47,27 +50,35 @@ using std::endl;
int main(int iargc, char* argv[]) int main(int iargc, char* argv[])
{ {
CODE( ts::TimeSeries<int> A(20) ); {
CODE( cout << A.size() << endl); aff::Series<double> a(-2,2), b(-3,3), c, d;
CODE( cout << A.dt << endl); cout << endl;
CODE( A.dt=20. ); cout << "convolution test 1" << endl;
CODE( A(8)=401 ); for (int i=a.f(); i<=a.l(); ++i) { a(i)=i; }
CODE( const ts::TimeSeries<int> B(A) ); for (int i=b.f(); i<=b.l(); ++i) { b(i)=i; }
CODE( cout << B.size() << endl); DUMP( a );
CODE( A(2)=-15 ); DUMP( b );
aff::ConstSeries<int> Bs=B; DUMP( ts::convolve(a,b) );
DUMP(Bs); c=a;
#ifdef ILLEGAL1 c.shift(-c.f());
CODE( B(13)=3 ); DUMP( c );
#endif DUMP( ts::convolve(c,b) );
#ifdef ILLEGAL2 d=b;
CODE( B.dt=3 ); d.shift(-d.f());
#endif DUMP( d );
CODE( ts::TimeSeries<int> C ); DUMP( ts::convolve(c,d) );
CODE( C=B ); }
DUMP(C);
CODE( C(3)=-15 ); {
DUMP(B); aff::Series<double> a(-2,2), b(-3,3);
cout << endl;
cout << "convolution test 2" << endl;
for (int i=a.f(); i<=a.l(); ++i) { a(i)=1; }
for (int i=b.f(); i<=b.l(); ++i) { b(i)=1; }
DUMP( a );
DUMP( b );
DUMP( ts::convolve(a,b) );
}
} }
/* ----- END OF tstest.cc ----- */ /* ----- END OF tstest.cc ----- */
# this is <Makefile> # this is <Makefile>
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# $Id: Makefile,v 1.36 2006-03-28 15:28:08 tforb Exp $ # $Id: Makefile,v 1.37 2006-06-29 07:11:44 tforb Exp $
# #
# Copyright (c) 2005 by Thomas Forbriger (BFO Schiltach) # Copyright (c) 2005 by Thomas Forbriger (BFO Schiltach)
# #
...@@ -71,7 +71,8 @@ phasedsignals hamres siggen smoos dise: %: %.o ...@@ -71,7 +71,8 @@ phasedsignals hamres siggen smoos dise: %: %.o
-L$(LOCLIBDIR) -L$(LOCLIBDIR)
newprog $@ newprog $@
teseco resaseda gatherdiff autocorr cross tidofi fredofi sigfit: %: %.o noisymize teseco resaseda gatherdiff autocorr cross tidofi fredofi sigfit: \
%: %.o
$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ldatreadxx -llinearxx \ $(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ldatreadxx -llinearxx \
-ltsxx -ltfxx -lsffxx -lgsexx -ltime++ -laff \ -ltsxx -ltfxx -lsffxx -lgsexx -ltime++ -laff \
-llapack -lblas -lcseife -lsffxx -lg2c -lm\ -llapack -lblas -lcseife -lsffxx -lg2c -lm\
......
/*! \file noisymize.cc
* \brief program reads a set of SFF traces, convolves them with white noise and stacks
*
* ----------------------------------------------------------------------------
*
* $Id: noisymize.cc,v 1.1 2006-06-29 07:11:44 tforb Exp $
* \author Thomas Forbriger
* \date 27/06/2006
*
* program reads a set of SFF traces, convolves them with white noise and stacks
*
* Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 27/06/2006 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#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.1 2006-06-29 07:11:44 tforb Exp $"
#include <fstream>
#include <iostream>
#include <string>
#include <tfxx/commandline.h>
#include <tfxx/error.h>
#include <aff/series.h>
#include <tsxx/tsxx.h>
#include <tsxx/convolve.h>
#include <tsxx/sffheaders.h>
#include <datreadxx/readany.h>
using std::cout;
using std::cerr;
using std::endl;
// put all commandline settings into a struct
struct Options {
bool verbose;
std::string inputformat;
}; // struct Options
// put all filenames in one struct
struct Filenames {
std::string Zin;
std::string Rin;
std::string Zout;
std::string Rout;
}; // struct Filenames
// values type to be used for samples
typedef double Tvalue;
// time series
typedef aff::Series<Tvalue> Tseries;
// full featured time series file
typedef ts::sff::File<Tseries> Tfile;
int main(int iargc, char* argv[])
{
// define usage information
char usage_text[]=
{
NOISYMIZE_VERSION "\n"
"usage: noisymize Zin Rin Zout Rout" "\n"
"usage: noisymize [-v] [-type t]" "\n"
" or: noisymize --help|-h" "\n"
};
// define full help text
char help_text[]=
{
NOISYMIZE_CVSID "\n"
"\n"
"Zin vertical component input data" "\n"
"Rin radial component input data" "\n"
"Zout vertical component output data" "\n"
"Rout radial component output data" "\n"
"\n"
"-v be verbose" "\n"
"-type t input file type" "\n"
};
// define commandline options
using namespace tfxx::cmdline;
static Declare options[]=
{
// 0: print help
{"help",arg_no,"-"},
// 1: verbose mode
{"v",arg_no,"-"},
// 2: input format
{"type",arg_yes,"sff"},
{NULL}
};
// no arguments? print usage...
if (iargc<2)
{
cerr << usage_text << endl;
exit(0);
}
// collect options from commandline
Commandline cmdline(iargc, argv, options);
// help requested? print full help text...
if (cmdline.optset(0))
{
cerr << usage_text << endl;
cerr << help_text << endl;
exit(0);
}
/*
// dummy operation: print option settings
for (int iopt=0; iopt<2; iopt++)
{
cout << "option: '" << options[iopt].opt_string << "'" << endl;
if (cmdline.optset(iopt)) { cout << " option was set"; }
else { cout << "option was not set"; }
cout << endl;
cout << " argument (string): '" << cmdline.string_arg(iopt) << "'" << endl;
cout << " argument (int): '" << cmdline.int_arg(iopt) << "'" << endl;
cout << " argument (long): '" << cmdline.long_arg(iopt) << "'" << endl;
cout << " argument (float): '" << cmdline.float_arg(iopt) << "'" << endl;
cout << " argument (double): '" << cmdline.double_arg(iopt) << "'" << endl;
cout << " argument (bool): '";
if (cmdline.bool_arg(iopt))
{ cout << "true"; } else { cout << "false"; }
cout << "'" << endl;
}
while (cmdline.extra()) { cout << cmdline.next() << endl; }
// dummy operation: print rest of command line
while (cmdline.extra()) { cout << cmdline.next() << endl; }
*/
/*----------------------------------------------------------------------*/
// read command line settings
Options opt;
opt.verbose=cmdline.optset(1);
opt.inputformat=cmdline.string_arg(2);
Filenames filename;
TFXX_assert(cmdline.extra(), "ERROR: missing filename Zin!");
filename.Zin=cmdline.next();
TFXX_assert(cmdline.extra(), "ERROR: missing filename Rin!");
filename.Rin=cmdline.next();
TFXX_assert(cmdline.extra(), "ERROR: missing filename Zout!");
filename.Zout=cmdline.next();
TFXX_assert(cmdline.extra(), "ERROR: missing filename Rout!");
filename.Rout=cmdline.next();
/*----------------------------------------------------------------------*/
// read vertical component input data
if (opt.verbose)
{ cout << "read input file " << filename.Zin << endl; }
Tfile Zindata;
{
std::ifstream ifs(filename.Zin.c_str());
datread::ianystream is(ifs, datread::anyID(opt.inputformat));
Zindata.read(is.idatstream(), opt.verbose);
}
// read radial component input data
if (opt.verbose)
{ cout << "read input file " << filename.Rin << endl; }
Tfile Rindata;
{
std::ifstream ifs(filename.Rin.c_str());
datread::ianystream is(ifs, datread::anyID(opt.inputformat));
Rindata.read(is.idatstream(), opt.verbose);
}
/*----------------------------------------------------------------------*/
// consistency checks
// ------------------
//
if (opt.verbose) { cout << "consistency checks:" << endl; }
// check number of traces
TFXX_assert(Zindata.size()==Rindata.size(),
"ERROR: inconsitent number of traces");
if (opt.verbose)
{ cout << "input files both have " << Zindata.size() << " traces." << endl; }
// check trace headers
Tfile::Tbase::const_iterator Zit=Zindata.begin();
Tfile::Tbase::const_iterator Rit=Rindata.begin();
sff::WID2compare compare(sff::Fnsamples | sff::Fdt);
while((Zit!=Zindata.end()) && (Rit!=Rindata.end()))
{
TFXX_assert(compare(Zit->header.wid2(), Rit->header.wid2()),
"ERROR: inconsitent trace headers");
if (Zit->header.hasinfo())
{
sff::INFO Zinfo=Zit->header.info();
sff::INFO Rinfo=Rit->header.info();
TFXX_assert(Zinfo==Rinfo,
"ERROR: inconsitent coordinates");
}
++Zit;
++Rit;
}
if (opt.verbose)
{ cout << "trace headers and coordinates are consistent" << endl; }
/*----------------------------------------------------------------------*/
// go and noisymize data
// ---------------------
}
/* ----- 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