STFINV library: seek source wavelet correction filter
stfinvbase.h
Go to the documentation of this file.
1 
38 // include guard
39 #ifndef STFINV_STFINVBASE_H_VERSION
40 
41 #define STFINV_STFINVBASE_H_VERSION \
42  "STFINV_STFINVBASE_H V1.2"
43 
46 #include<stfinv/error.h>
47 #include<aff/series.h>
48 #include<iostream>
49 #include<vector>
50 
51 namespace stfinv {
52 
56  typedef aff::Series<Tvalue> Tseries;
57 
58  /*----------------------------------------------------------------------*/
59 
63  struct WaveformPair {
69  Tseries::Tcoc synthetics;
75  }; // class WaveformPair
76 
77  /*----------------------------------------------------------------------*/
78 
82  struct WaveformTriple {
90  Tseries::Tcoc data;
94  Tseries::Tcoc synthetics;
102  double offset() const;
103  }; // class WaveformTriple
104 
105  /*----------------------------------------------------------------------*/
106 
111  struct Waveform {
118  }; // class Waveform
119 
120  /*----------------------------------------------------------------------*/
121 
125  typedef std::vector<stfinv::WaveformPair> Tvectorofpairs;
126 
127  /*----------------------------------------------------------------------*/
128 
132  typedef std::vector<stfinv::WaveformTriple> Tvectoroftriples;
133 
134  /*----------------------------------------------------------------------*/
135 
137 #define STFINV_baseillegal STFINV_abort("illegal call to abstract base class!")
138 
139  /*----------------------------------------------------------------------*/
140 
209  protected:
213  const stfinv::Waveform& stf,
214  const std::string& parameters);
223  const stfinv::Waveform& stf,
224  const stfinv::Tvectorofpairs& pairs,
225  const std::string& parameters);
226  public:
228  virtual ~STFBaseEngine() { }
229 
236  {
237  this->exec();
238  return(Mstf);
239  }
241  virtual void help(std::ostream& os=std::cout) const;
243  virtual void usage(std::ostream& os=std::cout) const;
245  virtual const char* name() const;
247  static void classhelp(std::ostream& os=std::cout);
249  static void classusage(std::ostream& os=std::cout);
251 
255  unsigned int nsamples() const
257  { return (Mstf.sampling.n); }
259  unsigned int nreceivers() const
260  { return (Mtriples.size()); }
262  unsigned int npairs() const
263  { return (Mpairs.size()); }
265  double dt() const
266  { return (Mstf.sampling.dt); }
268 
272  Tseries stf() const
274  { return (Mstf.series); }
276  Tseries::Tcoc recording(const unsigned int& i) const ;
278  Tseries::Tcoc synthetic(const unsigned int& i) const ;
280  Tseries convolvedsynthetic(const unsigned int& i) const ;
282  Tseries::Tcoc series(const unsigned int& i) const ;
284  Tseries convolvedseries(const unsigned int& i) const ;
286 
287  protected:
291  std::string parameter(const std::string& key,
293  const std::string& defvalue="false") const;
295  bool parameterisset(const std::string& key) const;
297  void checkreceiverindex(const unsigned int& i) const;
299  void checkseriesindex(const unsigned int& i) const;
301  virtual void exec() { STFINV_baseillegal; }
303  double weight(const unsigned int& i) const
304  { return(Mweights(i)); }
306  aff::Series<double> weights() const
307  { return(Mweights); }
309 
310  private:
314  void initialize(const std::string& parameters);
317  void parseparameters(std::string parameters);
319  void checkconsistency() const;
321  void setweights(const double& k);
323 
324  // member data
325  // -----------
326 
327  protected:
328  // protected members are accessed directly from derived classes
336  int Mdebug;
338  int Mverbose;
339  private:
346  aff::Series<double> Mweights;
347  }; // class STFBaseEngine
348 
349 } // namespace stfinv
350 
351 #endif // STFINV_STFINVBASE_H_VERSION (includeguard)
352 
353 /* ----- END OF stfinvbase.h ----- */
bool parameterisset(const std::string &key) const
check is parameter was set by user
Definition: stfinvbase.cc:266
A class to store the time series for a pair of time series.
Definition: stfinvbase.h:63
void checkseriesindex(const unsigned int &i) const
check for vaid index off additional time series pair
Definition: stfinvbase.cc:351
#define STFINV_baseillegal
Abort upon illegal call of base class function.
Definition: stfinvbase.h:137
std::vector< stfinv::WaveformPair > Tvectorofpairs
Vector of pairs.
Definition: stfinvbase.h:125
unsigned int npairs() const
return number of additional signals to be convolved
Definition: stfinvbase.h:262
static void classhelp(std::ostream &os=std::cout)
print online help
Definition: stfinvbase.cc:213
unsigned int nreceivers() const
return number of receiver signals in use
Definition: stfinvbase.h:259
void parseparameters(std::string parameters)
parse parameters and store them in Mparamap
Definition: stfinvbase.cc:241
double weight(const unsigned int &i) const
return weight for signal at receiver i
Definition: stfinvbase.h:303
Root namespace of library.
Definition: doxygen.txt:43
std::map< std::string, std::string > Tparamap
A map to store parameters.
virtual void help(std::ostream &os=std::cout) const
print online help
Definition: stfinvbase.cc:206
int Mverbose
verbose level
Definition: stfinvbase.h:338
CWaveformHeader sampling
Temporal sampling.
Definition: stfinvbase.h:114
stfinv::Waveform Mstf
source correction filter.
Definition: stfinvbase.h:332
void initialize(const std::string &parameters)
initialize base class
Definition: stfinvbase.cc:91
handle a parameter configuration string (prototypes)
unsigned int nsamples() const
return number of samples used in time series
Definition: stfinvbase.h:256
Tseries::Tcoc synthetics
Time series of synthetic data. This is understood as the impulse response of the subsurface.
Definition: stfinvbase.h:94
std::string parameter(const std::string &key, const std::string &defvalue="false") const
return the value of a parameters
Definition: stfinvbase.cc:279
Tseries series
Time series of waveform.
Definition: stfinvbase.h:117
stfinv::Tvectoroftriples Mtriples
Waveform triples.
Definition: stfinvbase.h:330
handle error conditions in libstfinv (prototypes)
unsigned int n
Number of samples in time series array.
Tseries::Tcoc recording(const unsigned int &i) const
return recorded data at receiver i
Definition: stfinvbase.cc:303
stfinv::Waveform run()
Start engine and return reference to source correction filter.
Definition: stfinvbase.h:235
virtual void usage(std::ostream &os=std::cout) const
print detailed description
Definition: stfinvbase.cc:220
A class to store the time series for a waveform triple.
Definition: stfinvbase.h:82
Structure to hold header information for a triple of waveforms.Each triple of waveforms reference by ...
Tseries::Tcoc series(const unsigned int &i) const
return synthetic data of pair i
Definition: stfinvbase.cc:327
static void classusage(std::ostream &os=std::cout)
print detailed description
Definition: stfinvbase.cc:227
int Mdebug
debug level
Definition: stfinvbase.h:336
Tseries::Tcoc synthetic(const unsigned int &i) const
return synthetic data at receiver i
Definition: stfinvbase.cc:311
Tseries convolvedseries(const unsigned int &i) const
return synthetic data convolved with stf for pair i
Definition: stfinvbase.cc:335
A class to store a single waveform. This will be used to pass the source correction filter...
Definition: stfinvbase.h:111
double dt
Sampling interval in seconds.
Tseries convolvedsynthetics
Time series of convolved synthetic data. This will contain the synthetic data convolved with the obta...
Definition: stfinvbase.h:99
virtual ~STFBaseEngine()
abstract base requires virtual destructor
Definition: stfinvbase.h:228
double dt() const
return sampling interval
Definition: stfinvbase.h:265
aff::Series< double > Mweights
Weights.
Definition: stfinvbase.h:346
Tseries::Tcoc synthetics
Time series of synthetic data.
Definition: stfinvbase.h:69
stfinv::Tvectorofpairs Mpairs
Waveform pairs.
Definition: stfinvbase.h:334
void checkreceiverindex(const unsigned int &i) const
check for vaid receiver index
Definition: stfinvbase.cc:343
virtual const char * name() const
return name of engine
Definition: stfinvbase.cc:296
Abstract base class for engines to derive source correction filter.
Definition: stfinvbase.h:208
virtual void exec()
Virtual function to run engine.
Definition: stfinvbase.h:301
Temporal sampling for time series data.
Tseries::Tcoc data
Time series of recorded data.
Definition: stfinvbase.h:90
STFBaseEngine(const stfinv::Tvectoroftriples &triples, const stfinv::Waveform &stf, const std::string &parameters)
Constructor.
Definition: stfinvbase.cc:69
Tseries convolvedsynthetics
Time series of convolved synthetic data. This will contain the synthetic data convolved with the obta...
Definition: stfinvbase.h:74
double offset() const
Return source offset of this waveform.
Definition: stfinvbase.cc:359
std::vector< stfinv::WaveformTriple > Tvectoroftriples
Vector of triples.
Definition: stfinvbase.h:132
CTripleHeader header
The header is expected to be the same for all three time series. In particular the number of samples ...
Definition: stfinvbase.h:87
void setweights(const double &k)
Set weights according to exponent.
definition of waveform header to be used in C and C++ (prototypes)
void checkconsistency() const
Check consistency of data members.
Definition: stfinvbase.cc:159
stfinv::tools::Tparamap Mparamap
Parameter map.
Definition: stfinvbase.h:344
Tseries convolvedsynthetic(const unsigned int &i) const
return synthetic data convolved with stf at receiver i
Definition: stfinvbase.cc:319
Tseries stf() const
return source correction filter series
Definition: stfinvbase.h:273
CWaveformHeader sampling
Temporal sampling.
Definition: stfinvbase.h:66
aff::Series< Tvalue > Tseries
Type of sample values.
Definition: stfinvbase.h:56
aff::Series< double > weights() const
return weights array
Definition: stfinvbase.h:306