version
0.0.1
Defines the C++ API for MsPASS
|
#include <BasicSpectrum.h>
Public Member Functions | |
BasicSpectrum () | |
BasicSpectrum (const double dfin, const double f0in, const double dtin, const int npts_in) | |
BasicSpectrum (const BasicSpectrum &parent) | |
BasicSpectrum & | operator= (const BasicSpectrum &parent) |
bool | live () const |
bool | dead () const |
void | kill () |
void | set_live () |
double | df () const |
double | f0 () const |
double | dt () const |
Return the original sample interval of data used to generate spectrum. More... | |
double | rayleigh () const |
Return the Rayleigh bin size for this spectrum. More... | |
int | timeseries_npts () const |
int | sample_number (const double f) const |
void | set_df (const double dfin) |
void | set_f0 (const double f0in) |
void | set_dt (const double dtin) |
void | set_npts (const int npts_in) |
virtual std::vector< double > | frequencies () const =0 |
virtual double | frequency (const int sample_number) const =0 |
virtual size_t | nf () const =0 |
virtual double | Nyquist () const =0 |
Protected Attributes | |
double | dfval |
double | f0val |
double | parent_dt |
double | parent_npts |
bool | is_live |
Base class for family of data objects created by Fourier transforms.
There are a range of algorithms used in seismology that center on the use of Fourier Transforms. This base class is intended to be used as the base for any mspass C++ data object based on Fourier transforms where the data are stored with a vector defined on a uniform grid in frequency. That means any algorithm based on fFTs. The value of using a base class is that power spectra and complex spectra have many common concpets shared by this base class. Classic use of inheritance to avoid redundant code.
|
inline |
|
inline |
Parameterized constructor.
dfin | frequency bin size |
f0in | frequency of first component of data vector of regular frequency grid. |
dtin | parent sample interval of spectrum estimate. |
npts_in | number of actual samples of parent time series (may not be the same as spectrum link when zero padding is used. subclasses should provide a way to handle zero padding |
|
inline |
|
inline |
Test live condition of the data.
Returns true if the data are marked as being bad This method is part of a four methods for handling the concept of "live"==gppd versus "dead" == bad. The concept was borrowed from seismic reflection processing. This method is the negation of the live method.
|
inline |
|
inline |
Return the original sample interval of data used to generate spectrum.
When zero padding is used the original sample interval of data cannot be known without additional data. In this implementation we require the user to store that information with a protected attribute within the object. This retrieves that stored value.
|
inline |
|
pure virtual |
Return an std::vector container containing the frequency of each sample in the spectrum vector. Commonly necessary for plotting. Made virtual because nf method needs to be virtual.
Implemented in mspass::seismic::PowerSpectrum.
|
pure virtual |
Return frequency at a specified sample number. Virtual to allow subclasses to throw an error for illegal value.
Implemented in mspass::seismic::PowerSpectrum.
|
inline |
|
inline |
|
pure virtual |
Return the number of frequency bin.
Implemented in mspass::seismic::PowerSpectrum.
|
pure virtual |
Return the Nyquist frequency. Virtual because if f0 is not zero and the number of points is not the full fft output this needs to be handled differently.
Implemented in mspass::seismic::PowerSpectrum.
|
inline |
Return the Rayleigh bin size for this spectrum.
The Rayleigh bin size of a spectrum is 1/T where T is the length of the original time series. This method returns that attribute of this spectrum. Note the rayleigh and df methods will return the same number only when a spectrum is computed with no zero padding.
|
inline |
Return the integer sample number of the closest sample to the specified frequency. Uses rounding. Will throw a MsPASSError object if the specified frequency is not within the range of the data.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |