version  0.0.1
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
mspass::algorithms::VectorTaper Class Reference

#include <Taper.h>

Inheritance diagram for mspass::algorithms::VectorTaper:
mspass::algorithms::BasicTaper

Public Member Functions

 VectorTaper (const std::vector< double > taperdata)
 
int apply (mspass::seismic::TimeSeries &d)
 
int apply (mspass::seismic::Seismogram &d)
 
void disable ()
 
void enable ()
 
std::vector< double > get_taper ()
 
double get_t0head () const
 
double get_t1head () const
 
- Public Member Functions inherited from mspass::algorithms::BasicTaper
void enable_head ()
 
void disable_head ()
 
void enable_tail ()
 
void disable_tail ()
 
bool head_is_enabled ()
 
bool tail_is_enable ()
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Protected Attributes inherited from mspass::algorithms::BasicTaper
bool head
 
bool tail
 
bool all
 

Detailed Description

General taper.

This method provides a simple way to build a taper from a set of uniformly spaced points. The apply methods will dogmatically only accept input data of the same length as the taper defined in the operator.

Constructor & Destructor Documentation

◆ VectorTaper()

mspass::algorithms::VectorTaper::VectorTaper ( )
324 {
325 head = false;
326 tail = false;
327 all = false;
328}

Member Function Documentation

◆ apply() [1/2]

int mspass::algorithms::VectorTaper::apply ( mspass::seismic::Seismogram d)
virtual

Implements mspass::algorithms::BasicTaper.

353 {
354 if (all) {
355 if (d.npts() != taper.size()) {
356 stringstream ss;
357 ss << "VectorTaper apply method: size mismatch with data" << endl
358 << "operator taper size=" << taper.size()
359 << " but data vector length=" << d.npts() << endl
360 << "This operator requires these lengths to match" << endl;
361 d.elog.log_error("VectorTaper", ss.str(), ErrorSeverity::Complaint);
362 return -1;
363 }
364 for (int i = 0; i < d.npts(); ++i) {
365 double wt = taper[i];
366 for (int k = 0; k < 3; ++k) {
367 d.u(k, i) *= wt;
368 }
369 }
370 return 0;
371 } else
372 return -1;
373}
size_t npts() const
Definition BasicTimeSeries.h:171
mspass::utility::dmatrix u
Definition CoreSeismogram.h:52
int log_error(const mspass::utility::MsPASSError &merr)
Definition ErrorLogger.cc:72

◆ apply() [2/2]

int mspass::algorithms::VectorTaper::apply ( mspass::seismic::TimeSeries d)
virtual

Implements mspass::algorithms::BasicTaper.

336 {
337 if (all) {
338 if (d.npts() != taper.size()) {
339 stringstream ss;
340 ss << "VectorTaper apply method: size mismatch with data" << endl
341 << "operator taper size=" << taper.size()
342 << " but data vector length=" << d.npts() << endl
343 << "This operator requires these lengths to match" << endl;
344 d.elog.log_error("VectorTaper", ss.str(), ErrorSeverity::Complaint);
345 return -1;
346 }
347 for (int i = 0; i < d.npts(); ++i)
348 d.s[i] *= taper[i];
349 return 0;
350 } else
351 return -1;
352}
std::vector< double > s
Definition CoreTimeSeries.h:27

◆ disable()

void mspass::algorithms::VectorTaper::disable ( )
inline
158{ all = false; };

◆ enable()

void mspass::algorithms::VectorTaper::enable ( )
inline
159 {
160 if (taper.size() > 0)
161 all = true;
162 };

◆ get_t0head()

double mspass::algorithms::VectorTaper::get_t0head ( ) const
inlinevirtual

Implements mspass::algorithms::BasicTaper.

164 {
165 std::cerr << "get_t0head not implemented for VectorTaper";
166 return 0.0;
167 };

◆ get_t1head()

double mspass::algorithms::VectorTaper::get_t1head ( ) const
inlinevirtual

Implements mspass::algorithms::BasicTaper.

168 {
169 std::cerr << "get_t1head not implemented for VectorTaper";
170 return 0.0;
171 };

◆ get_taper()

std::vector< double > mspass::algorithms::VectorTaper::get_taper ( )
inline
163{ return taper; };

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