version  0.0.1
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
FFTDeconOperator.h
1#ifndef __FFT_DECON_OPERATOR_H__
2#define __FFT_DECON_OPERATOR_H__
3#include "mspass/algorithms/TimeWindow.h"
4#include "mspass/algorithms/deconvolution/ComplexArray.h"
5#include "mspass/seismic/CoreTimeSeries.h"
6#include "mspass/utility/Metadata.h"
7#include <boost/archive/text_iarchive.hpp>
8#include <boost/archive/text_oarchive.hpp>
9#include <gsl/gsl_errno.h>
10#include <gsl/gsl_fft_complex.h>
11#include <string>
12namespace mspass::algorithms::deconvolution {
21public:
26 FFTDeconOperator &operator=(const FFTDeconOperator &parent);
27 void changeparameter(const mspass::utility::Metadata &md);
28 void change_size(const int nfft_new);
29 void change_shift(const int shift) { sample_shift = shift; };
30 int get_size() { return nfft; };
31 int get_shift() { return sample_shift; };
32 int operator_size() { return static_cast<int>(nfft); };
33 int operator_shift() { return sample_shift; };
34 double df(const double dt) {
35 double period;
36 period = static_cast<double>(nfft) * dt;
37 return 1.0 / period;
38 };
47 const ComplexArray &sw,
48 const double dt,
49 const double t0parent);
50
51protected:
52 int nfft;
53 int sample_shift;
54 gsl_fft_complex_wavetable *wavetable;
55 gsl_fft_complex_workspace *workspace;
56 ComplexArray winv;
57
58private:
59 friend boost::serialization::access;
60 template <class Archive>
61 void save(Archive &ar, const unsigned int version) const {
62 // std::cout << "Entered FFTDecon serialization save function"<<std::endl;
63 ar & nfft;
64 ar & sample_shift;
65 ar & winv;
66 // std::cout << "Exiting save function" << std::endl;
67 }
68 template <class Archive> void load(Archive &ar, const unsigned int version) {
69 // std::cout << "Entered FFTDecon serializaton load function" << std::endl;
70 ar &this->nfft;
71 ar &this->sample_shift;
72 // std::cout << "Loading winv vector" << std::endl;
73 ar & winv;
74 // std::cout << "Creating wavetable " << std::endl;
75 this->wavetable = gsl_fft_complex_wavetable_alloc(this->nfft);
76 // std::cout << "Creating workspace" << std::endl;
77 this->workspace = gsl_fft_complex_workspace_alloc(this->nfft);
78 // std::cout << "Exiting load" << std::endl;
79 }
80 BOOST_SERIALIZATION_SPLIT_MEMBER()
81};
82
83/* This helper is best referenced here */
84
97std::vector<double> circular_shift(const std::vector<double> &d, const int i0);
103int ComputeFFTLength(const mspass::algorithms::TimeWindow w, const double dt);
111int ComputeFFTLength(const mspass::utility::Metadata &md);
117extern "C" {
118unsigned int nextPowerOf2(unsigned int n);
119}
120} // namespace mspass::algorithms::deconvolution
121#endif
Defines a time window.
Definition TimeWindow.h:12
Object to hold components needed in all fft based decon algorithms.
Definition FFTDeconOperator.h:20
mspass::seismic::CoreTimeSeries FourierInverse(const ComplexArray &winv, const ComplexArray &sw, const double dt, const double t0parent)
Return inverse wavelet for Fourier methods.
Definition FFTDeconOperator.cc:115
Scalar time series data object.
Definition CoreTimeSeries.h:17
Definition Metadata.h:71