MsPASS C++ API  2.4.1.dev4+g92330b7a
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

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

◆ TopMute() [3/3]

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

Standard copy constructor.

407: taper(parent.taper) {}

◆ ~TopMute()

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

Destructor. The destructor of this class is not null.

378{}

Member Function Documentation

◆ apply() [1/2]

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

Apply the operator to a Seismogram object.

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

◆ apply() [2/2]

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

Apply the operator to a TimeSeries object.

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

◆ get_t0()

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

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

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

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

◆ operator=()

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

Standard assignment operator.

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

◆ 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

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

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