version  0.0.1
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
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.
 
 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

376{ taper = NULL; }

◆ 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.
378 {
379 const string base_error("TopMute parameterized constructor: ");
380 if (t1 <= t0) {
381 stringstream ss;
382 ss << base_error << "Zero time (t0) must be less than end of mute time (t1)"
383 << endl
384 << "Constructor was passed t0=" << t0 << " and t1=" << t1 << endl;
385 throw MsPASSError(ss.str(), ErrorSeverity::Invalid);
386 }
387 try {
388 if (type == "linear") {
389 taper =
390 std::make_shared<LinearTaper>(t0, t1, t0 + 999999.0, t1 + 999999.0);
391 taper->disable_tail();
392 } else if (type == "cosine") {
393 taper =
394 std::make_shared<CosineTaper>(t0, t1, t0 + 999999.0, t1 + 999999.0);
395 taper->disable_tail();
396 } else {
397 stringstream ss;
398 ss << base_error << "Unrecognized type argument=" << type << endl
399 << "Current options are: linear OR cosine" << endl;
400 throw MsPASSError(ss.str(), ErrorSeverity::Invalid);
401 }
402 } catch (...) {
403 throw;
404 };
405}

◆ TopMute() [3/3]

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

Standard copy constructor.

406: taper(parent.taper) {}

◆ ~TopMute()

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

Destructor. The destructor of this class is not null.

377{}

Member Function Documentation

◆ apply() [1/2]

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

Apply the operator to a Seismogram object.

422 {
423 try {
424 int iret;
425 iret = this->taper->apply(d);
426 return iret;
427 } catch (...) {
428 throw;
429 };
430}

◆ apply() [2/2]

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

Apply the operator to a TimeSeries object.

413 {
414 try {
415 int iret;
416 iret = this->taper->apply(d);
417 return iret;
418 } catch (...) {
419 throw;
420 };
421}

◆ get_t0()

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

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

232{ 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.

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

◆ operator=()

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

Standard assignment operator.

407 {
408 if (&parent != this) {
409 this->taper = parent.taper;
410 }
411 return *this;
412}

◆ 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

437 {
438 BasicTaper *rawptr;
439 rawptr = this->taper.get();
440 if (dynamic_cast<const LinearTaper *>(rawptr))
441 return string("linear");
442 else if (dynamic_cast<const CosineTaper *>(rawptr))
443 return string("cosine");
444 else
445 /* note there is a VectorTaper child of BasicTaper but it is not supported
446 by TopMute - only allows linear and cosine - so if that happened somehow
447 we throw this exception in that case too. */
448 throw MsPASSError("TopMute::taper_type: Internal taper dynamic cast does "
449 "not resolve; this should not happen and is a bug",
450 ErrorSeverity::Fatal);
451}

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