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

added FourPoint taper

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: 4483
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 24135425
......@@ -77,7 +77,7 @@ $(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR)
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 tapers.cc
dropcontainer.cc firfilters.cc tapers.cc ovtaper.cc
INCINSTALLPATH=$(LOCINCLUDEDIR)/tsxx
LIBINSTALLPATH=$(LOCLIBDIR)
......
/*! \file ovtaper.cc
* \brief offset variable taper (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 26/01/2012
*
* offset variable taper (implementation)
*
* Copyright (c) 2012 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 26/01/2012 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define TSXX_OVTAPER_CC_VERSION \
"TSXX_OVTAPER_CC V1.0 "
#define TSXX_OVTAPER_CC_CVSID \
"$Id$"
#include <tsxx/ovtaper.h>
namespace ts {
namespace tapers {
} // namespace tapers
} // namespace ts
/* ----- END OF ovtaper.cc ----- */
/*! \file ovtaper.h
* \brief offset variable taper (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 26/01/2012
*
* offset variable taper (prototypes)
*
* Copyright (c) 2012 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 26/01/2012 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TSXX_OVTAPER_H_VERSION
#define TSXX_OVTAPER_H_VERSION \
"TSXX_OVTAPER_H V1.0 "
#define TSXX_OVTAPER_H_CVSID \
"$Id$"
#include <tsxx/tapers.h>
namespace ts {
namespace tapers {
} // namespace tapers
} // namespace ts
#endif // TSXX_OVTAPER_H_VERSION (includeguard)
/* ----- END OF ovtaper.h ----- */
......@@ -31,11 +31,12 @@
* - 06/09/2007 V1.0 Thomas Forbriger
* - 17/09/2007 V1.1 added PSD norm
* - 27/04/2009 V1.2 added Cosine taper
* - 26/01/2012 V1.3 added FourPoint taper
*
* ============================================================================
*/
#define TF_TAPERS_CC_VERSION \
"TF_TAPERS_CC V1.2"
"TF_TAPERS_CC V1.3"
#define TF_TAPERS_CC_CVSID \
"$Id$"
......@@ -139,7 +140,7 @@ namespace ts {
return (retval);
} // double Hanning::psdnorm() const
/*----------------------------------------------------------------------*/
/*======================================================================*/
Cosine::Cosine(const double& f): Mfrac(f)
{
......@@ -177,6 +178,71 @@ namespace ts {
return (retval);
} // double Cosine::psdnorm() const
/*======================================================================*/
FourPoint::FourPoint(const double& dt,
const double& t1,
const double& t2,
const double& t3,
const double& t4)
: Mdt(dt), Mt1(t1), Mt2(t2), Mt3(t3), Mt4(t4)
{
TSXX_assert(Mdt>0,
"FourPoint taper sampling interval is not positive");
TSXX_assert(((0<=Mt1) && (Mt1<=Mt2) && (Mt2<=Mt3) && (Mt3<=Mt4)),
"FourPoint taper times are not in increasing order");
} // FourPoint::FourPoint(...)
/*----------------------------------------------------------------------*/
void FourPoint::init()
{
Mfac1=M_PI/(Mt2-Mt1);
Mfac2=M_PI/(Mt4-Mt3);
} // void FourPoint::init()
/*----------------------------------------------------------------------*/
double FourPoint::value(const int& i) const
{
double retval=0.;
double t=Mdt*i;
if (t<Mt1)
{
retval=0.;
}
else if (t<=Mt2)
{
retval=0.5*(1.-cos(Mfac1*(t-Mt1)));
}
else if (t<Mt3)
{
retval=1.;
}
else if (t<=Mt4)
{
retval=0.5*(1.+cos(Mfac2*(t-Mt3)));
}
else
{
retval=0.;
}
return (retval);
} // double FourPoint::value(const int& i) const
/*----------------------------------------------------------------------*/
double FourPoint::psdnorm() const
{
const double retval=1.;
TSXX_abort("FourPoint::psdnorm() is not yet defined");
/*!
* \todo
* FourPoint::psdnorm() must be implemented
*/
return (retval);
} // double FourPoint::psdnorm() const
} // namespace tapers
} // namespace ts
......
......@@ -31,6 +31,7 @@
* - 06/09/2007 V1.0 Thomas Forbriger
* - 17/09/2007 V1.1 added PSD norm
* - 27/04/2009 V1.2 added Cosine taper
* - 26/01/2012 V1.3 added FourPoint taper
*
* ============================================================================
*/
......@@ -39,7 +40,7 @@
#ifndef TF_TAPERS_H_VERSION
#define TF_TAPERS_H_VERSION \
"TF_TAPERS_H V1.1"
"TF_TAPERS_H V1.3"
#define TF_TAPERS_H_CVSID \
"$Id$"
......@@ -116,6 +117,39 @@ namespace ts {
/*----------------------------------------------------------------------*/
/*! \brief Provides a 4-point taper
*
* Provides a taper being defined by four times specific in seconds after
* first sample.
*
* \param dt sampling interval
* \param t1 taper equals zero for t<t1.
* \param t2 taper increases with sin**2(x)
* with x=0 at t=t1 and x=pi/2 at t=t2
* \param t3 taper is one for t2 < t < t3
* \param t4 taper decreases with cos**2(x)
* with x=0 at t=t3 and x=pi/2 at t=t4;
* taper equals zero for t>t4.
*/
class FourPoint: public Taper {
public:
FourPoint(const double& dt,
const double& t1,
const double& t2,
const double& t3,
const double& t4);
~FourPoint() { }
private:
void init();
double value(const int& i) const;
double psdnorm() const;
double Mdt;
double Mt1, Mt2, Mt3, Mt4;
double Mfac1, Mfac2;
}; // class Hanning
/*----------------------------------------------------------------------*/
//! inline function for template argument
template<class C>
void Taper::apply(C c) const
......
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