1 #ifndef _POWER_SPECTRUM_H_
2 #define _POWER_SPECTRUM_H_
4 #include "mspass/utility/Metadata.h"
5 #include "mspass/utility/MsPASSError.h"
6 #include "mspass/utility/ErrorLogger.h"
7 #include "mspass/seismic/BasicSpectrum.h"
48 const std::vector<T>& d,
81 double power(
const double f)
const;
85 const std::string base_error(
"PowerSpectrum::frequency: ");
87 +
"Sample number parameter passed cannot be negative");
89 +
"Sample number parameter passed xceeds range of spectrum array");
90 return this->
f0()+sample_number*this->
df();
100 return 1.0/(2.0*this->parent_dt);
110 const std::vector<T>& d,
const double dfin,
const std::string nm,
111 const double f0in,
const double dtin,
const int npts_in)
118 for(
size_t k=0;k<d.size();++k)
119 spectrum.push_back(
static_cast<double>(d[k]));
Definition: BasicSpectrum.h:20
int sample_number(const double f) const
Definition: BasicSpectrum.h:128
void set_live()
Definition: BasicSpectrum.h:94
double df() const
Definition: BasicSpectrum.h:96
double f0() const
Definition: BasicSpectrum.h:101
Definition: PowerSpectrum.h:13
std::vector< double > frequencies() const
Definition: PowerSpectrum.cc:106
double power(const double f) const
power at a given frequency.
Definition: PowerSpectrum.cc:90
size_t nf() const
Definition: PowerSpectrum.h:97
PowerSpectrum()
Definition: PowerSpectrum.cc:11
PowerSpectrum & operator+=(const PowerSpectrum &other)
Standard accumulation operator.
Definition: PowerSpectrum.cc:35
mspass::utility::ErrorLogger elog
Definition: PowerSpectrum.h:28
std::vector< double > spectrum
Definition: PowerSpectrum.h:22
std::vector< double > amplitude() const
Compute amplitude spectrum from power spectrum.
Definition: PowerSpectrum.cc:82
double frequency(const int sample_number) const
Definition: PowerSpectrum.h:83
double Nyquist() const
Definition: PowerSpectrum.h:99
std::string spectrum_type
Definition: PowerSpectrum.h:20
Container to hold error logs for a data object.
Definition: ErrorLogger.h:61
Base class for error object thrown by MsPASS library routines.
Definition: MsPASSError.h:40
Define metadata keys.
Definition: BasicSpectrum.h:6