Commit c1e533d1 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

ts/wf/cross [WP]: solved scaling problem

parent 80c67e90
......@@ -189,6 +189,9 @@ void FourierProcessor::setseries(const Tconsttimeseries& s)
Mseries=0.;
Mseries.copyin(s);
Mdt=s.header.dt;
TFXX_debug(this->Mdebug,
"FourierProcessor::setseries(const Tconsttimeseries& s)",
TFXX_value(s.header.dt));
Mpadded=Mseries;
Mspecavail=false;
} // void FourierProcessor::setseries(const Tconsttimeseries& s)
......@@ -217,6 +220,14 @@ void FourierProcessor::padseries(const unsigned int& n)
Mpadded=aff::subarray(Mseries)(Mseries.f(),Mseries.f()+n-1);
Mspectrum=MFFT(Mpadded);
Mspectrum *= MFFT.scale_spectrum(this->Mdt);
TFXX_debug(this->Mdebug,
"FourierProcessor::padseries(const Tconsttimeseries& n)",
"carried out FFT "
<< TFXX_value(Mpadded.size()) << ", "
<< TFXX_value(MFFT.size()) << ", "
<< TFXX_value(Mspectrum.size()) << ", \n"
<< TFXX_value(MFFT.scale_spectrum(this->Mdt)) << ", "
<< TFXX_value((this->Mdt)));
Mspecavail=true;
}
} // void FourierProcessor::padseries(const unsigned int& n)
......@@ -227,6 +238,8 @@ FourierProcessor::Tspectrum
specconv(const FourierProcessor::Tspectrum::Tcoc & sref,
const FourierProcessor::Tspectrum::Tcoc & ssig)
{
TFXX_assert(sref.size() == ssig.size(),
"inconsistent sets of coefficients");
FourierProcessor::Tspectrum result(sref.size());
result=FourierProcessor::Tspectrum::Tvalue(0.);
aff::Browser<FourierProcessor::Tspectrum::Tcoc> BR(sref);
......@@ -250,6 +263,8 @@ FourierProcessor::Tspectrum
speccorr(const FourierProcessor::Tspectrum::Tcoc & sref,
const FourierProcessor::Tspectrum::Tcoc & ssig)
{
TFXX_assert(sref.size() == ssig.size(),
"inconsistent sets of coefficients");
FourierProcessor::Tspectrum result(sref.size());
result=FourierProcessor::Tspectrum::Tvalue(0.);
aff::Browser<FourierProcessor::Tspectrum::Tcoc> BR(sref);
......@@ -531,8 +546,12 @@ int main(int iargc, char* argv[])
if (opt.fourier)
{
TFXX_debug(opt.debug,
"main()", "prepare FFTreference");
Tts::Tdttimeseries dtreference(reference);
"main()", "prepare FFTreference "
<< TFXX_value(reference.header.wid2().dt));
Tts::Tdttimeseries dtreference(reference,
reference.header.wid2().dt);
TFXX_debug(opt.debug,
"main()", TFXX_value(dtreference.header.dt));
FFTreference.setseries(dtreference);
}
}
......@@ -550,7 +569,7 @@ int main(int iargc, char* argv[])
{
TFXX_debug(opt.debug,
"main()", "prepare FFTdata");
Tts::Tdttimeseries dtdata(data);
Tts::Tdttimeseries dtdata(data, data.header.wid2().dt);
FFTdata.setseries(dtdata);
}
if (opt.convolve)
......@@ -565,7 +584,9 @@ int main(int iargc, char* argv[])
FourierProcessor::Tspectrum::Tcoc sdata=FFTdata(n);
FourierProcessor::Tspectrum::Tcoc sreference=FFTreference(n);
TFXX_debug(opt.debug,
"main()", "call specconv");
"main()", "call specconv "
<< TFXX_value(sreference.size()) << ", "
<< TFXX_value(sdata.size()));
FourierProcessor::Tspectrum
sresult=specconv(sreference, sdata);
TFXX_debug(opt.debug,
......@@ -576,6 +597,7 @@ int main(int iargc, char* argv[])
else
{
result=ts::convolve(reference,data);
result *= wid2line.dt;
} // else, if (opt.fourier)
wid2line.auxid="conv";
// set time of first sample
......@@ -609,6 +631,7 @@ int main(int iargc, char* argv[])
else
{
result=ts::correlate(reference,data);
result *= wid2line.dt;
} // else, if (opt.fourier)
wid2line.auxid="corr";
/*
......@@ -647,7 +670,6 @@ int main(int iargc, char* argv[])
}
wid2line.date=torigin;
}
result *= wid2line.dt;
result.header.wid2(wid2line);
/*
result.header.wid2().date=fileheader.srce.date
......@@ -656,7 +678,7 @@ int main(int iargc, char* argv[])
+(data.header.wid2().date-reference.header.wid2().date);
*/
if (opt.verbose) { cout << result.header.wid2().line() << endl; }
os << result.header << Tts::Tcoc(result);
os << result;
} // else; if (!referenceread)
} // else; if (doselect && (!traceranges.contains(itrace)))
}
......
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