44 #define STFINV_STFINVFOURIER_CC_VERSION \ 45 "STFINV_STFINVFOURIER_CC V1.5" 53 #include <aff/subarray.h> 54 #include <aff/slice.h> 55 #include <aff/arrayoperators.h> 76 const std::string& parameters)
77 :
Tbase(triples, stf, pairs, parameters)
100 const std::string& parameters)
101 :
Tbase(triples, stf, parameters)
125 return(
"STFFourierDomainEngine");
198 std::istringstream is(this->
parameter(
"fpad",
"1.5"));
202 "ERROR: parameter for option \"fpad\" not larger or equal 1");
204 bool poweroftwo=(this->
parameter(
"fpow2",
"false")==
"true");
208 unsigned int divisor=1;
211 std::istringstream is (this->
parameter(
"fdiv",
"100"));
214 "ERROR: parameter for option \"fdiv\" not larger than 0");
231 unsigned int rest=
nsamples % divisor;
250 std::istringstream is(this->
parameter(
"tshift",
"0."));
259 this->
parameter(
"irtap",
"0.,1.,2.,3.")));
264 "ERROR: taper definition times not in increasing order");
331 subarray.shape().setfirst(0,0);
332 subarray.shape().setfirst(1,0);
344 subarray.shape().setfirst(0,0);
345 subarray.shape().setfirst(1,0);
370 slice.shape().setfirst(0,0);
371 slice.shape().setfirst(1,0);
384 slice.shape().setfirst(0,0);
385 slice.shape().setfirst(1,0);
387 "slice.first(0)=" << slice.first(0) <<
" " <<
388 "slice.last(0)=" << slice.last(0) <<
" " 389 "slice.first(1)=" << slice.first(1) <<
" " <<
390 "slice.last(1)=" << slice.last(1) <<
" ");
428 for (
unsigned int i=0; i<this->
nreceivers(); ++i)
439 for (
unsigned int i=0; i<this->
npairs(); ++i)
444 syntheticref.copyin(this->
series(i));
464 for (
unsigned int i=0; i<this->
nreceivers(); ++i)
478 for (
unsigned int i=0; i<this->
npairs(); ++i)
508 convolvedsynthetic.shape().setfirst(0,0);
513 for (
unsigned int i=0; i<this->
nreceivers(); ++i)
515 for (
unsigned int j=0; j<this->
nfreq(); ++j)
527 =aff::subarray(inspecarray)()(2*this->
nreceivers(),
530 seriesspecarray.shape().setfirst(0,0);
531 seriesspecarray.shape().setfirst(1,0);
539 convolvedseries.shape().setfirst(0,0);
542 for (
unsigned int i=0; i<this->
npairs(); ++i)
544 for (
unsigned int j=0; j<this->
nfreq(); ++j)
558 "apply time shift of " <<
Mtshift <<
" seconds");
561 *3.141592653589793115998*2.*
Mtshift;
564 for (
unsigned int j=0; j<this->
nfreq(); ++j)
566 stffft(j) *= std::exp(sfac*this->
frequency(j));
585 Tfftengine::TAseries thestfseries=this->
stfseries();
603 "Taper width is larger than length of time series");
605 double tt3=this->
Mtt3;
606 double tt4=this->
Mtt4;
607 double tt1=this->
Mtt1+T;
608 double tt2=this->
Mtt2+T;
610 int l3=int(std::floor(tt3/this->
dt()));
611 int l2=int(std::ceil(tt2/this->
dt()));
622 for (
int l=l3; l<=l2; ++l)
625 double t=l*this->
dt();
630 (rl <= thestfseries.l(0))),
631 "Index out of range. Internal programming error! " 635 if ( (t>=tt3) && (t<=tt4) && (tt4>tt3) )
637 factor=0.5+0.5*cos(M_PI*(t-tt3)/(tt4-tt3));
639 else if ( (t>tt4) && (t<tt1) )
643 else if ( (t>=tt1) && (t<=tt2) && (tt2>tt1) )
645 factor=0.5-0.5*cos(M_PI*(t-tt1)/(tt2-tt1));
648 thestfseries(rl) = thestfseries(rl)*factor;
bool parameterisset(const std::string &key) const
check is parameter was set by user
std::vector< stfinv::WaveformPair > Tvectorofpairs
Vector of pairs.
unsigned int npairs() const
return number of additional signals to be convolved
double Mtt4
time values defining taper.
Tfftengine::TAseries TAseries
type of array for time series values
double Mtt2
time values defining taper.
static void classhelp(std::ostream &os=std::cout)
print online help
unsigned int nreceivers() const
return number of receiver signals in use
float Tvalue
Value type of samples.All references to time series samples in user workspace are based on this type...
Tfftengine Mfftenginestf
FFT processor for source time function correction filter.
double Mtt3
time values defining taper.
void fftinput()
copy input signals to workspace and transform input workspace to Fourier domain
Tfftengine::TAspectrum TAspectrum
type of array for Fourier transforms
suport debugging in libstfinv (prototypes)
Root namespace of library.
double Mtt1
time values defining taper.
bool Mapplyshift
true if shift must be applied
TAspectrum recordingcoeff(const unsigned int &i) const
return reference to Fourier coeffients of recorded data for frequency i
double Mtshift
time shift to be applied to STF in order to expose acausal parts
void stfshift()
apply time shift to stf prior to FFT to time domain
TAspectrum::Tvalue & stfcoeff(const unsigned int &i) const
return reference to Fourier coefficients of stf for frequency i
unsigned int nsamples() const
return number of samples used in time series
void taperstf()
apply a time domain taper to the correction filter response.
std::string parameter(const std::string &key, const std::string &defvalue="false") const
return the value of a parameters
void convolve()
convolve synthetics with stf
void putoutput()
copy workspace time series for convolved synthetics and stf to user memory
virtual const char * name() const
return name of engine
TAspectrum syntheticspec() const
return reference to Fourier transform of synthetics
Tseries::Tcoc recording(const unsigned int &i) const
return recorded data at receiver i
Tseries::Tcoc series(const unsigned int &i) const
return synthetic data of pair i
TAseries stfseries() const
return reference to time series container of stf
#define STFINV_value(P)
report value in a sequence of output operators
TAspectrum recordingspec() const
return reference to Fourier transform of recorded data
#define STFINV_assert(C, M)
Check an assertion and report by throwing an exception.
TAspectrum stfspec() const
return reference to Fourier transform of stf
static void classusage(std::ostream &os=std::cout)
print detailed description
void initialize()
initialize work space
Tseries::Tcoc synthetic(const unsigned int &i) const
return synthetic data at receiver i
Tseries convolvedseries(const unsigned int &i) const
return synthetic data convolved with stf for pair i
STFFourierDomainEngine(const stfinv::Tvectoroftriples &triples, const stfinv::Waveform &stf, const std::string ¶meters)
Constructor.
double frequency(const unsigned int &i) const
return value of frequency i in Hz
Tfftengine Mfftengineinput
combined FFT engine for recorded data and synthetics and additional time series
double dt() const
return sampling interval
void getinput()
copy input time series for recorded data and synthetics to workspace
virtual void help(std::ostream &os=std::cout) const
print online help
a base class for all engines which operate in the Fourier domain (prototypes)
unsigned int nfreq() const
return number of frequencies in use
Abstract base class for engines to derive source correction filter.
Tfftengine Mfftengineoutput
combined FFT engine for stf and convolved synthetics and additional convolved time series ...
virtual void usage(std::ostream &os=std::cout) const
print detailed description
char stfinvfourier_summary_usage[]
std::vector< stfinv::WaveformTriple > Tvectoroftriples
Vector of triples.
bool Mapplystftaper
true if time domain taper should be applied to filter response.
TAspectrum syntheticcoeff(const unsigned int &i) const
return reference to Fourier coefficients of synthetics for frequency i
void fftoutput()
convolve synthetics with Fourier transform of stf and transform convolved synthetics and stf to time ...
Tseries convolvedsynthetic(const unsigned int &i) const
return synthetic data convolved with stf at receiver i
Tseries stf() const
return source correction filter series
char stfinvfourier_description_usage[]
#define STFINV_debug(C, N, M)
produce debug output
aff::Series< Tvalue > Tseries
Type of sample values.
static void classusage(std::ostream &os=std::cout)
print detailed description