version  0.0.1
Defines the C++ API for MsPASS
Public Member Functions | List of all members
mspass::algorithms::TopMute Class Reference

Mute operator for "top" of signals defined first smaple forward. More...

#include <Taper.h>

Public Member Functions

 TopMute ()
 
 TopMute (const double t0, const double t1, const std::string type)
 Primary constructor driven by a named keyword. More...
 
 TopMute (const TopMute &parent)
 
 ~TopMute ()
 
TopMuteoperator= (const TopMute &parent)
 
int apply (mspass::seismic::TimeSeries &d)
 
int apply (mspass::seismic::Seismogram &d)
 
double get_t0 () const
 
double get_t1 () const
 
std::string taper_type () const
 

Detailed Description

Mute operator for "top" of signals defined first smaple forward.

A top mute is very commonly used in a many forms of seismic processing. It is, for example, a very low level operation in traditional seismic reflection processing. A top mute zeros the front (forward in time from first sample) of the signal and ramps up to a multiplier of 1 (does nothing) at some later time. It can also be thought of as a taper with only the low side altered. The implementation, in fact, uses the family of mspass taper operators internally the the high time range (tail) turned off.

The main constructor uses a string keyword to select the type of tapering applied to define the mute. Because of the relationship to mspass tapers there is also a constructor using the base class for Taper objects. It allows custom implementations of taper beyond those associated with keywords in the definition passed to the main constructor.

Constructor & Destructor Documentation

◆ TopMute() [1/3]

mspass::algorithms::TopMute::TopMute ( )

Default constructor. Exists but the result is invalid

419 {
420  taper=NULL;
421 }

◆ TopMute() [2/3]

mspass::algorithms::TopMute::TopMute ( const double  t0,
const double  t1,
const std::string  type 
)

Primary constructor driven by a named keyword.

This is the normal constructor most users will want to us. It is defined by a time range for the mute to ramp from 0 to 1 and a string matching one of the supported types. Note the mspass VectorTaper cannot be used for this constructor because it requires more than 2 arguments to be defined.

Parameters
t0is the end of the zeroed time range. Date from the first sample to this value will be zeroed.
t1end ramp. Data with t>t1 will be unaltered.
typedefines the type of taper desired. Current options are 'linear' and 'cosine'. They enable the LinearTaper and CosineTaper opeators respectively.
Exceptions
Thisfunction will throw a MsPASSError if t1<=t0.
426 {
427  const string base_error("TopMute parameterized constructor: ");
428  if(t1<=t0)
429  {
430  stringstream ss;
431  ss<<base_error<<"Zero time (t0) must be less than end of mute time (t1)"<<endl
432  << "Constructor was passed t0="<<t0<<" and t1="<<t1<<endl;
433  throw MsPASSError(ss.str(),ErrorSeverity::Invalid);
434  }
435  try{
436  if(type=="linear")
437  {
438  taper=std::make_shared<LinearTaper>(t0,t1,t0+999999.0,t1+999999.0);
439  taper->disable_tail();
440  }
441  else if(type=="cosine")
442  {
443  taper=std::make_shared<CosineTaper>(t0,t1,t0+999999.0,t1+999999.0);
444  taper->disable_tail();
445  }
446  else
447  {
448  stringstream ss;
449  ss << base_error<<"Unrecognized type argument="<<type<<endl
450  << "Current options are: linear OR cosine"<<endl;
451  throw MsPASSError(ss.str(),ErrorSeverity::Invalid);
452  }
453  }catch(...){throw;};
454 }
Base class for error object thrown by MsPASS library routines.
Definition: MsPASSError.h:40

◆ TopMute() [3/3]

mspass::algorithms::TopMute::TopMute ( const TopMute parent)

Standard copy constructor.

455  : taper(parent.taper)
456 {
457 }

◆ ~TopMute()

mspass::algorithms::TopMute::~TopMute ( )

Destructor. The destructor of this class is not null.

423 {
424 }

Member Function Documentation

◆ apply() [1/2]

int mspass::algorithms::TopMute::apply ( mspass::seismic::Seismogram d)

Apply the operator to a Seismogram object.

475 {
476  try{
477  int iret;
478  iret=this->taper->apply(d);
479  return iret;
480  }catch(...){throw;};
481 }

◆ apply() [2/2]

int mspass::algorithms::TopMute::apply ( mspass::seismic::TimeSeries d)

Apply the operator to a TimeSeries object.

467 {
468  try{
469  int iret;
470  iret=this->taper->apply(d);
471  return iret;
472  }catch(...){throw;};
473 }

◆ get_t0()

double mspass::algorithms::TopMute::get_t0 ( ) const
inline

Return the start of mute taper - points with time < this number are zeroed

230  {return taper->get_t0head();};

◆ get_t1()

double mspass::algorithms::TopMute::get_t1 ( ) const
inline

Return the end time of the mute taper - points after this point are unaltered by the mute.

233  {return taper->get_t1head();};

◆ operator=()

TopMute & mspass::algorithms::TopMute::operator= ( const TopMute parent)

Standard assignment operator.

459 {
460  if(&parent != this)
461  {
462  this->taper = parent.taper;
463  }
464  return *this;
465 }

◆ taper_type()

string mspass::algorithms::TopMute::taper_type ( ) const

Return a string with a name describing the form of the taper - currently returns either linear or cosine

489 {
490  BasicTaper *rawptr;
491  rawptr = this->taper.get();
492  if(dynamic_cast<const LinearTaper*>(rawptr))
493  return string("linear");
494  else if(dynamic_cast<const CosineTaper*>(rawptr))
495  return string("cosine");
496  else
497  /* note there is a VectorTaper child of BasicTaper but it is not supported
498  by TopMute - only allows linear and cosine - so if that happened somehow
499  we throw this exception in that case too. */
500  throw MsPASSError("TopMute::taper_type: Internal taper dynamic cast does not resolve; this should not happen and is a bug",
501  ErrorSeverity::Fatal);
502 }
Definition: Taper.h:21
Taper front and/or end of a time seris with a half cosine function.
Definition: Taper.h:119
Used to construct an operator to apply a linear taper to either end.
Definition: Taper.h:79

The documentation for this class was generated from the following files: