Commit 663e9d68 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

Fourier Engine class is implemented

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.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 3977
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 9c17dee0
......@@ -40,6 +40,8 @@
#include <sstream>
#include <stfinv/stfinvfourier.h>
#include <aff/subarray.h>
#include <aff/slice.h>
namespace stfinv {
......@@ -88,8 +90,16 @@ namespace stfinv {
*/
void STFFourierDomainEngine::classhelp(std::ostream& os)
{
os << "This class is not yet implemented." << std::endl;
os << "Online help is not yet provided." << std::endl;
os << "Options and parameters in common for Fourier engines:\n"
<< "fpad=f padding factor (default: 1.5)\n"
<< "fpow2 use power of two\n"
<< "fdiv=d use integer multiple of d\n"
<< "These options define the number of samples N used for the FFT.\n"
<< "This should be larger than the number of samples M in the\n"
<< "original series to avoid wrap-around. N=M*f at least. If fpow2\n"
<< "is set, N will be the next power of 2 larger than M*f. Else if\n"
<< "fdiv is set, N will be the next integer multiple of d larger\n"
<< "than M*f." << std::endl;
} // void STFFourierDomainEngine::classhelp(std::ostream& os)
/*----------------------------------------------------------------------*/
......@@ -216,23 +226,67 @@ namespace stfinv {
STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::recordingspec() const
{
STFINV_abort("STFFourierDomainEngine::data not yet implemented");
TAspectrum inspecarray=Mfftengineinput.spectrum();
return(aff::subarray(inspecarray)()(0,this->nreceivers()-1));
} // STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::recordingspec() const
/*----------------------------------------------------------------------*/
STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::syntheticspec() const
{
STFINV_abort("STFFourierDomainEngine::synthetics not yet implemented");
TAspectrum inspecarray=Mfftengineinput.spectrum();
return(aff::subarray(inspecarray)()(this->nreceivers(),
(2*this->nreceivers())-1));
} // STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::syntheticspec() const
/*----------------------------------------------------------------------*/
STFFourierDomainEngine::Tspectrum STFFourierDomainEngine::stfspec() const
STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::stfspec() const
{
STFINV_abort("STFFourierDomainEngine::stf not yet implemented");
return(Mfftengineoutput.spectrum(this->nreceivers()));
} // STFFourierDomainEngine::Tspectrum STFFourierDomainEngine::stfspec() const
/*----------------------------------------------------------------------*/
STFFourierDomainEngine::TAspectrum
STFFourierDomainEngine::recordingcoeff(const unsigned int& i) const
{
STFFourierDomainEngine::TAspectrum rec=this->recordingspec();
return(aff::slice(rec)(1,i));
} // STFFourierDomainEngine::recordingcoeff(const unsigned int& i) const
/*----------------------------------------------------------------------*/
STFFourierDomainEngine::TAspectrum
STFFourierDomainEngine::syntheticcoeff(const unsigned int& i) const
{
STFFourierDomainEngine::TAspectrum syn=this->syntheticspec();
return(aff::slice(syn)(1,i));
} // STFFourierDomainEngine::syntheticcoeff(const unsigned int& i) const
/*----------------------------------------------------------------------*/
STFFourierDomainEngine::TAspectrum::Tvalue&
STFFourierDomainEngine::stfcoeff(const unsigned int& i) const
{
STFFourierDomainEngine::TAspectrum stffft=this->stfspec();
return(stffft(i));
} // STFFourierDomainEngine::stfcoeff(const unsigned int& i) const
/*----------------------------------------------------------------------*/
double STFFourierDomainEngine::frequency(const unsigned int& i) const
{
return(static_cast<double>(i)/(this->dt()*Mfftengineinput.nsamples()));
} // double STFFourierDomainEngine::frequency(const unsigned int& i) const
/*----------------------------------------------------------------------*/
unsigned int STFFourierDomainEngine::nfreq() const
{
return(Mfftengineinput.nfrequencies());
} // unsigned int STFFourierDomainEngine::nfreq() const
} // namespace stfinv
/* ----- END OF stfinvfourier.cc ----- */
......@@ -74,10 +74,6 @@ namespace stfinv {
typedef Tfftengine::TAseries TAseries;
//! \brief type of array for Fourier transforms
typedef Tfftengine::TAspectrum TAspectrum;
//! \brief type of series for time series values
typedef Tfftengine::Tseries Tfftseries;
//! \brief type of series for Fourier coefficients
typedef Tfftengine::Tspectrum Tspectrum;
protected:
/*! \brief Constructor.
*/
......@@ -110,7 +106,7 @@ namespace stfinv {
//! \brief return reference to Fourier transform of synthetics
TAspectrum syntheticspec() const;
//! \brief return reference to Fourier transform of stf
Tspectrum stfspec() const;
TAspectrum stfspec() const;
/*! \brief return reference to Fourier coeffients of recorded data for
* frequency i
*/
......
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