STFINV library: seek source wavelet correction filter

◆ exec()

void stfinv::STFEngineNormalize::exec ( )
virtual

Start engine.

Reimplemented from stfinv::STFFourierDomainEngine.

Definition at line 79 of file stfinvnormalize.cc.

References stfinv::STFFourierDomainEngine::fftinput(), stfinv::STFFourierDomainEngine::fftoutput(), Mwaterlevel, stfinv::STFFourierDomainEngine::nfreq(), stfinv::STFBaseEngine::nreceivers(), stfinv::STFFourierDomainEngine::recordingcoeff(), stfinv::STFFourierDomainEngine::stfcoeff(), stfinv::STFFourierDomainEngine::syntheticcoeff(), stfinv::STFBaseEngine::weight(), and stfinv::STFBaseEngine::weights().

80  {
81  // read signals and calculate FFT
82  this->fftinput();
83 
84  // cycle through frequencies
85  // calculate weighted energy of all synthetic traces
86  Tseries syntheticenergy(0,this->nfreq()-1);
87  syntheticenergy=0.;
88  double totalsyntheticenergy=0.;
89  for (unsigned int i=0; i<this->nfreq(); ++i)
90  {
91  TAspectrum syntheticref=this->syntheticcoeff(i);
92  for (unsigned int j=0; j<this->nreceivers(); ++j)
93  {
94  syntheticenergy(i) += this->weight(j)*this->weight(j)
95  *std::norm(syntheticref(j));
96  }
97  totalsyntheticenergy += syntheticenergy(i);
98  }
99 
100  // calculate waterlevel
101  double waterlevel=Mwaterlevel*totalsyntheticenergy/this->nfreq();
102 
103  double weightsum=aff::func::sqrsum(this->weights());
104 
105  for (unsigned int i=0; i<this->nfreq(); ++i)
106  {
107  double recordingenergy=0.;
108  TAspectrum recordingref=this->recordingcoeff(i);
109  TAspectrum syntheticref=this->syntheticcoeff(i);
110  for (unsigned int j=0; j<this->nreceivers(); ++j)
111  {
112  recordingenergy += this->weight(j)*this->weight(j)
113  *std::norm(recordingref(j));
114  }
115 
116  double modulus
117  =std::sqrt(recordingenergy/(syntheticenergy(i)+waterlevel));
118 
119  double phase = 0.;
120  for (unsigned int j=0; j<this->nreceivers(); ++j)
121  {
122  phase += this->weight(j)*
123  (std::arg(recordingref(j))-std::arg(syntheticref(j)));
124  }
125  phase /= weightsum;
126 
127  this->stfcoeff(i)=std::polar(modulus, phase);
128  } // for (unsigned int i=0; i<this->nfreq(); ++i)
129 
130  // provide results to user
131  this->fftoutput();
132  } // void STFEngineNormalize::exec()
unsigned int nreceivers() const
return number of receiver signals in use
Definition: stfinvbase.h:259
double weight(const unsigned int &i) const
return weight for signal at receiver i
Definition: stfinvbase.h:303
void fftinput()
copy input signals to workspace and transform input workspace to Fourier domain
Tfftengine::TAspectrum TAspectrum
type of array for Fourier transforms
TAspectrum recordingcoeff(const unsigned int &i) const
return reference to Fourier coeffients of recorded data for frequency i
TAspectrum::Tvalue & stfcoeff(const unsigned int &i) const
return reference to Fourier coefficients of stf for frequency i
double Mwaterlevel
waterlevel
unsigned int nfreq() const
return number of frequencies in use
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 ...
aff::Series< Tvalue > Tseries
Type of sample values.
Definition: stfinvbase.h:56
aff::Series< double > weights() const
return weights array
Definition: stfinvbase.h:306
Here is the call graph for this function: