Commit 2483eff5 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding and new module

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: 2366
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent e5ef8beb
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: fftwaff.cc,v 1.1 2006-07-12 06:14:18 tforb Exp $
* $Id: fftwaff.cc,v 1.2 2007-09-06 12:48:07 tforb Exp $
* \author Thomas Forbriger
* \date 11/07/2006
*
......@@ -19,7 +19,7 @@
#define TF_FFTWAFF_CC_VERSION \
"TF_FFTWAFF_CC V1.0 "
#define TF_FFTWAFF_CC_CVSID \
"$Id: fftwaff.cc,v 1.1 2006-07-12 06:14:18 tforb Exp $"
"$Id: fftwaff.cc,v 1.2 2007-09-06 12:48:07 tforb Exp $"
#include <fourier/fftwaff.h>
#include <tfxx/error.h>
......@@ -31,7 +31,7 @@ namespace fourier {
*/
namespace fft {
//! create plan
//! create plan.
void DRFFTWAFF::create_plan_forward() const
{
if (Mplan_forward==0)
......@@ -45,7 +45,7 @@ namespace fourier {
/*----------------------------------------------------------------------*/
//! create plan
//! create plan.
void DRFFTWAFF::create_plan_backward() const
{
if (Mplan_backward==0)
......@@ -59,7 +59,7 @@ namespace fourier {
/*----------------------------------------------------------------------*/
//! delete plan
//! delete plan.
DRFFTWAFF::~DRFFTWAFF()
{
if (Mplan_forward != 0) { rfftw_destroy_plan(Mplan_forward); }
......@@ -68,6 +68,10 @@ namespace fourier {
/*----------------------------------------------------------------------*/
/*! \brief Transform time series to Fourier coefficients.
*
* No scaling is applied.
*/
DRFFTWAFF::Tspectrum DRFFTWAFF::operator()(const Tseries::Tcoc& s) const
{
Tspectrum retval(this->Msize/2+1);
......@@ -92,6 +96,10 @@ namespace fourier {
/*----------------------------------------------------------------------*/
/*! \brief Transform Fourier coefficients to time series.
*
* No scaling is applied.
*/
DRFFTWAFF::Tseries DRFFTWAFF::operator()(const Tspectrum::Tcoc& s) const
{
Tseries retval;
......@@ -117,6 +125,7 @@ namespace fourier {
/*----------------------------------------------------------------------*/
//! Return appropriate scaling factor for sampling interval dt.
DRFFTWAFF::Tsample DRFFTWAFF::scale_series(const Tsample& dt) const
{
return(1./(Msize*dt));
......@@ -124,14 +133,19 @@ namespace fourier {
/*----------------------------------------------------------------------*/
//! Return appropriate scaling factor for sampling interval dt.
DRFFTWAFF::Tsample DRFFTWAFF::scale_spectrum(const Tsample& dt) const
{
return(dt);
} // Tsample DRFFTWAFF::scale_spectrum(const Tsample& dt) const
/*----------------------------------------------------------------------*/
DRFFTWAFF::Tspectrum
DRFFTWAFF::operator()(const Tseries::Tcoc& s,
/*! \brief Transform time series to Fourier coefficients and scale.
*
* Appropriate scaling is applied for sampling interval dt.
*/
DRFFTWAFF::Tspectrum DRFFTWAFF::operator()(const Tseries::Tcoc& s,
const double& dt) const
{
Tspectrum retval=this->operator()(s);
......@@ -141,8 +155,11 @@ namespace fourier {
/*----------------------------------------------------------------------*/
DRFFTWAFF::Tseries
DRFFTWAFF::operator()(const Tspectrum::Tcoc& s,
/*! \brief Transform Fourier coefficients to time series and scale.
*
* Appropriate scaling is applied for sampling interval dt.
*/
DRFFTWAFF::Tseries DRFFTWAFF::operator()(const Tspectrum::Tcoc& s,
const double& dt) const
{
return(this->scale_series(dt)*
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: fftwaff.h,v 1.1 2006-07-12 06:14:18 tforb Exp $
* $Id: fftwaff.h,v 1.2 2007-09-06 12:48:07 tforb Exp $
* \author Thomas Forbriger
* \date 11/07/2006
*
......@@ -25,7 +25,7 @@
#define TF_FFTWAFF_H_VERSION \
"TF_FFTWAFF_H V1.0 "
#define TF_FFTWAFF_H_CVSID \
"$Id: fftwaff.h,v 1.1 2006-07-12 06:14:18 tforb Exp $"
"$Id: fftwaff.h,v 1.2 2007-09-06 12:48:07 tforb Exp $"
#include<complex>
#include<rfftw.h>
......@@ -37,9 +37,11 @@ namespace fourier {
*/
namespace fft {
/*! A rigid class to do simple transforms using libdrfftw.a
/*! A rigid class to do simple transforms using libdrfftw.a.
*
* uses real double arrays
*
* How to use this class:
*/
class DRFFTWAFF {
public:
......
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.22 2006-11-21 16:36:55 tforb Exp $
# $Id: Makefile,v 1.23 2007-09-06 12:48:07 tforb Exp $
#
# Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach)
#
......@@ -34,7 +34,7 @@
HEADERS=$(shell find . -name \*.h)
LIBSRC=tsxx.cc filter.cc seifexx.cc seifeclass.cc \
anyfilter.cc filterbase.cc ipo.cc ipolin.cc sffheaders.cc random.cc \
dropcontainer.cc firfilters.cc
dropcontainer.cc firfilters.cc tapers.cc
INCINSTALLPATH=$(LOCINCLUDEDIR)/tsxx
LIBINSTALLPATH=$(LOCLIBDIR)
......
/*! \file tapers.cc
* \brief provide signal tapers (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id: tapers.cc,v 1.1 2007-09-06 12:48:08 tforb Exp $
* \author Thomas Forbriger
* \date 06/09/2007
*
* provide signal tapers (implementation)
*
* Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 06/09/2007 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define TF_TAPERS_CC_VERSION \
"TF_TAPERS_CC V1.0 "
#define TF_TAPERS_CC_CVSID \
"$Id: tapers.cc,v 1.1 2007-09-06 12:48:08 tforb Exp $"
#include <tsxx/tapers.h>
namespace ts {
//! \brief Provides signal tapers.
namespace tapers {
void Hanning::init(const int& f, const int& l) const
{
Mf=f;
Mfac=
} // void Hanning::init(const int& f, const int& l) const
double Hanning::value(const int& i) const
{
double s=std::sin((i-Mf)*Mfac);
return (s*s);
} // double Hanning::value(const int& i) const
} // namespace tapers
} // namespace ts
/* ----- END OF tapers.cc ----- */
/*! \file tapers.h
* \brief provide signal tapers (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: tapers.h,v 1.1 2007-09-06 12:48:08 tforb Exp $
* \author Thomas Forbriger
* \date 06/09/2007
*
* provide signal tapers (prototypes)
*
* Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 06/09/2007 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TF_TAPERS_H_VERSION
#define TF_TAPERS_H_VERSION \
"TF_TAPERS_H V1.0 "
#define TF_TAPERS_H_CVSID \
"$Id: tapers.h,v 1.1 2007-09-06 12:48:08 tforb Exp $"
namespace ts {
namespace tapers {
class Taper {
public:
//! apply taper to series container c.
template<class C>
void apply(C c) const;
private:
//! will be called prior to value to set ranges.
virtual void init(const int& f, const int& l) const;
//! returns taper value for sample index i.
virtual double value(const int& i) const;
}; // class Taper
/*----------------------------------------------------------------------*/
class Hanning: public Taper {
private:
void init(const int& f, const int& l) const;
double value(const int& i) const;
}; // class Hanning
/*----------------------------------------------------------------------*/
template<class C>
void Taper::apply(C c) const
{
this->init(c.f(), c.l());
for (int i=c.f(); i<=c.l(); ++i)
{ c(i) *= this->value(i); }
} // template<class C> void Taper::apply(C c)
} // namespace
} // namespace ts
#endif // TF_TAPERS_H_VERSION (includeguard)
/* ----- END OF tapers.h ----- */
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