Commit 72412d24 authored by thomas.forbriger's avatar thomas.forbriger

[WP][TASK] (stfinv): implement normalization core

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.

Implement core algorithm of STFEngineNormalize. Algorithm compiles but is not
yet tested.

Missing:
- weighting of phase average with modulus
- testing
parent 9ea7f3bf
......@@ -84,14 +84,6 @@ namespace stfinv {
// read signals and calculate FFT
this->fftinput();
STFINV_debug(Mdebug&2, "STFEngineNormalize::exec()",
"waterlevel=" << waterlevel);
STFINV_debug(Mdebug&2, "STFEngineNormalize::exec()",
"nfreq=" << this->nfreq());
STFINV_illegal;
// IMPLEMENT HERE
// cycle through frequencies
// calculate weighted energy of all synthetic traces
Tseries syntheticenergy(0,this->nfreq()-1);
......@@ -103,7 +95,7 @@ namespace stfinv {
for (unsigned int j=0; j<this->nreceivers(); ++j)
{
syntheticenergy(i) += this->weight(j)*this->weight(j)
*conj(syntheticref(j))*syntheticref(j);
*std::norm(syntheticref(j));
}
totalsyntheticenergy += syntheticenergy(i);
}
......@@ -121,7 +113,7 @@ namespace stfinv {
for (unsigned int j=0; j<this->nreceivers(); ++j)
{
recordingenergy += this->weight(j)*this->weight(j)
*conj(recordingref(j))*recordingref(j);
*std::norm(recordingref(j));
}
double modulus
......@@ -131,13 +123,11 @@ namespace stfinv {
for (unsigned int j=0; j<this->nreceivers(); ++j)
{
phase += this->weight(j)*
(aimag(std::log(recordingref(j)))-aimag(std::log(syntheticref(j))));
(std::arg(recordingref(j))-std::arg(syntheticref(j)));
}
phase /= weightsum;
// imaginary unit in C++?
this->stfcoeff(i)=numerator/denominator;
this->stfcoeff(i)=std::polar(modulus, phase);
} // for (unsigned int i=0; i<this->nfreq(); ++i)
// provide results to user
......
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