STFINV library: seek source wavelet correction filter

◆ initstfinvenginewithpairs()

void initstfinvenginewithpairs ( struct CTriples  triples,
struct CWaveform  stf,
struct CPairs  pairs,
char *  parameters 
)

Initialize the engine and pass additional time series to be convolved on the fly.

The purpose of this function in comparion to initstfinvengine() is explained in the comments to parameter pairs.

Parameters
triplesThis function expects a struct CTriples containing references to the users workspace for recorded time series as well as synthetic time series. These will be used as input. As a third set a reference to a workspace for synthetic time series convolved with the source correction filter is expected. The latter will be used as output.
stfThe struct CWaveform presents a reference to the users work space for the source correction filter time series. It will be used to present the result of the processing to the user.
pairsThe struct CPairs presents a reference to the users work space for additional synthetic time series. These time series will not be used to determine the optimal source correction filter filter, but will be convolved with the obtained source time function on the fly. This is useful in particular with forward modelling code which uses a band limited source time function for the initial synthetics already. This source time function can be passed through this argument and will then be convolved with the optimized source correction filter, such that the result of the convolution is appropriate to obtain synthetics which provide a reduced misift with respect to the data.
parametersParameters to select one of the engines as well as to control the engines are passed in a character sequence. See also How to construct parameter strings

Definition at line 71 of file stfinv.cc.

References CWaveformTriple::convolvedsynthetics, CWaveformPair::convolvedsynthetics, CWaveformTriple::data, freestfinvengine(), CWaveformTriple::header, CWaveformHeader::n, CTriples::n, CPairs::n, CPairs::pairs, stfinv::capi::Pengine, CWaveformPair::sampling, CTripleHeader::sampling, stfinv::Waveform::sampling, CWaveform::sampling, stfinv::Waveform::series, CWaveform::series, STFINV_assert, CWaveformTriple::synthetics, CWaveformPair::synthetics, and CTriples::triples.

Referenced by initstfinvengine().

75 {
76  // remove existing engine if has previously been initialized
78 
79  // convert parameter string
80  std::string cxxparameters(parameters);
81 
82  // convert pointer to source correction filter array
83  stfinv::Waveform cxxstf;
84  cxxstf.sampling=stf.sampling;
85  aff::LinearShape shape(0, cxxstf.sampling.n-1, 0);
86  cxxstf.series
87  =stfinv::Tseries(shape,
88  aff::SharedHeap<Tvalue>(stf.series,
89  cxxstf.sampling.n));
90 
91  // convert pointer triples
92  // notice: it is not required to check consistency here; all header fields
93  // are transferred to the C++ containers; the C++ engine will check
94  // consistency during its initialization
95  STFINV_assert(triples.n>0, "no triples provided");
96  stfinv::Tvectoroftriples cxxtriples(triples.n);
97  for (int i=0; i<triples.n; ++i)
98  {
99  CWaveformTriple ctriple=triples.triples[i];
100  cxxtriples[i].header=ctriple.header;
101  const int& n=cxxtriples[i].header.sampling.n;
102  shape=aff::LinearShape(0, n-1, 0);
103  cxxtriples[i].data
104  =stfinv::Tseries::Tcoc(shape,
105  aff::SharedHeap<Tvalue>::Tcoc(ctriple.data, n));
106  cxxtriples[i].synthetics
107  =stfinv::Tseries::Tcoc(shape,
108  aff::SharedHeap<Tvalue>::Tcoc(ctriple.synthetics, n));
109  cxxtriples[i].convolvedsynthetics
110  =stfinv::Tseries(shape,
111  aff::SharedHeap<Tvalue>(ctriple.convolvedsynthetics, n));
112  }
113 
114  // convert pointer pairs
115  // notice: it is not required to check consistency here; all header fields
116  // are transferred to the C++ containers; the C++ engine will check
117  // consistency during its initialization
118  stfinv::Tvectorofpairs cxxpairs(pairs.n);
119  for (int i=0; i<pairs.n; ++i)
120  {
121  CWaveformPair cpair=pairs.pairs[i];
122  cxxpairs[i].sampling=cpair.sampling;
123  const int& n=cxxpairs[i].sampling.n;
124  shape=aff::LinearShape(0, n-1, 0);
125  cxxpairs[i].synthetics
126  =stfinv::Tseries::Tcoc(shape,
127  aff::SharedHeap<Tvalue>::Tcoc(cpair.synthetics, n));
128  cxxpairs[i].convolvedsynthetics
129  =stfinv::Tseries(shape,
130  aff::SharedHeap<Tvalue>(cpair.convolvedsynthetics, n));
131  }
132 
133  // create engine
134  stfinv::capi::Pengine=new stfinv::STFEngine(cxxtriples, cxxstf,
135  cxxpairs,
136  cxxparameters);
137 } // void initstfinvenginewithpairs
std::vector< stfinv::WaveformPair > Tvectorofpairs
Vector of pairs.
Definition: stfinvbase.h:125
A struct to store the time series for a pair of waveforms.This struct provides references to the user...
Definition: stfinv.h:104
int n
Number of triples (i.e. receivers) in the array.
Definition: stfinv.h:166
Tvalue * synthetics
Time series of synthetic data. This field actually is a pointer (C array) to the workspace where the ...
Definition: stfinv.h:81
stfinv::STFEngine * Pengine
Pointer to engine to work with.
Definition: stfinv.cc:63
CWaveformHeader sampling
Temporal sampling.
Definition: stfinvbase.h:114
Tvalue * convolvedsynthetics
Time series of convolved synthetic data. This field actually is a pointer (C array) to the workspace ...
Definition: stfinv.h:128
void freestfinvengine()
Free the engine.
Definition: stfinv.cc:161
A struct to store the time series for a waveform triple.This struct provides references to the users ...
Definition: stfinv.h:59
Tseries series
Time series of waveform.
Definition: stfinvbase.h:117
unsigned int n
Number of samples in time series array.
Tvalue * data
Time series of recorded data. This field actually is a pointer (C array) to the workspace where the u...
Definition: stfinv.h:72
#define STFINV_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:140
A class to store a single waveform. This will be used to pass the source correction filter...
Definition: stfinvbase.h:111
int n
Number of pairs in the array.
Definition: stfinv.h:190
Tvalue * convolvedsynthetics
Time series of convolved synthetic data. This field actually is a pointer (C array) to the workspace ...
Definition: stfinv.h:93
struct CWaveformPair * pairs
Pointer to array of waveform pairs. This actually is a C array for elements of type struct CWaveformP...
Definition: stfinv.h:196
struct CWaveformHeader sampling
Temporal sampling parameters. The header is expected to be the same for both time series...
Definition: stfinv.h:110
Tvalue * synthetics
Time series of synthetic data. This field actually is a pointer (C array) to the workspace where the ...
Definition: stfinv.h:117
Tvalue * series
Time series of waveform. This field actually is a pointer (C array) to the workspace where the user w...
Definition: stfinv.h:150
std::vector< stfinv::WaveformTriple > Tvectoroftriples
Vector of triples.
Definition: stfinvbase.h:132
Class to access any engine in the library.
Definition: stfinvany.h:60
aff::Series< Tvalue > Tseries
Type of sample values.
Definition: stfinvbase.h:56
struct CWaveformHeader sampling
Temporal sampling.
Definition: stfinv.h:142
struct CTripleHeader header
Temporal and spatial sampling parameters. The header is expected to be the same for all three time se...
Definition: stfinv.h:65
struct CWaveformTriple * triples
Pointer to array of waveform triples. This actually is a C array for elements of type struct CWavefor...
Definition: stfinv.h:172
Here is the call graph for this function:
Here is the caller graph for this function: