1#ifndef _POWER_SPECTRUM_H_
2#define _POWER_SPECTRUM_H_
3#include "mspass/seismic/BasicSpectrum.h"
4#include "mspass/utility/ErrorLogger.h"
5#include "mspass/utility/Metadata.h"
6#include "mspass/utility/MsPASSError.h"
47 const double dfin,
const std::string nm,
const double f0in,
48 const double dtin,
const int npts_in);
76 double power(
const double f)
const;
79 const std::string base_error(
"PowerSpectrum::frequency: ");
82 base_error +
"Sample number parameter passed cannot be negative");
86 "Sample number parameter passed xceeds range of spectrum array");
87 return this->
f0() + sample_number * this->
df();
96 double Nyquist()
const {
return 1.0 / (2.0 * this->parent_dt); };
106 const std::vector<T> &d,
const double dfin,
107 const std::string nm,
const double f0in,
108 const double dtin,
const int npts_in)
113 for (
size_t k = 0; k < d.size(); ++k)
114 spectrum.push_back(
static_cast<double>(d[k]));
Definition BasicSpectrum.h:19
int sample_number(const double f) const
Definition BasicSpectrum.h:124
void set_live()
Definition BasicSpectrum.h:91
double df() const
Definition BasicSpectrum.h:93
double f0() const
Definition BasicSpectrum.h:98
Definition PowerSpectrum.h:11
std::vector< double > frequencies() const
Definition PowerSpectrum.cc:90
double power(const double f) const
power at a given frequency.
Definition PowerSpectrum.cc:74
size_t nf() const
Definition PowerSpectrum.h:94
PowerSpectrum()
Definition PowerSpectrum.cc:10
PowerSpectrum & operator+=(const PowerSpectrum &other)
Standard accumulation operator.
Definition PowerSpectrum.cc:30
mspass::utility::ErrorLogger elog
Definition PowerSpectrum.h:26
std::vector< double > spectrum
Definition PowerSpectrum.h:20
std::vector< double > amplitude() const
Compute amplitude spectrum from power spectrum.
Definition PowerSpectrum.cc:67
double frequency(const int sample_number) const
Definition PowerSpectrum.h:78
double Nyquist() const
Definition PowerSpectrum.h:96
std::string spectrum_type
Definition PowerSpectrum.h:18
Container to hold error logs for a data object.
Definition ErrorLogger.h:60
Base class for error object thrown by MsPASS library routines.
Definition MsPASSError.h:38
Define metadata keys.
Definition BasicSpectrum.h:6