1 #include <utl/FFTDataContainerAlgorithm.h>
17 const unsigned int n = timeseries.
GetSize();
20 WARNING(
"Warning: trying to do a Hilbert transform on an empty time series!");
30 for (
unsigned int i = 0; i < n; ++i) {
31 fftin[i].real(timeseries[i]);
34 Forward.
fft(fftin, fftout);
36 for (
unsigned int i = 0; i < n; ++i) {
39 tmp = imag(fftout[i]);
40 fftout[i].imag(-real(fftout[i]));
42 tmp = -imag(fftout[i]);
43 fftout[i].imag(real(fftout[i]));
48 Backward.
fft(fftout, fftin);
50 for (
unsigned int i = 0; i < n; ++i)
51 timeseries[i] = real(fftin[i])/n;
64 const unsigned int n = timeseries.
GetSize();
67 WARNING(
"Warning: trying to do a Hilbert envelope on an empty time series!");
72 std::complex<double>*
const fftout =
FFTWComplex(n);
77 for (
unsigned int j = 0; j < 3; ++j) {
79 for (
unsigned int i = 0; i < n; ++i) {
80 fftin[i].real(timeseries[i][j]);
83 Forward.
fft(fftin, fftout);
85 for (
unsigned int i = 0; i < n; ++i) {
88 tmp = imag(fftout[i]);
89 fftout[i].imag(-real(fftout[i]));
91 tmp = -imag(fftout[i]);
92 fftout[i].imag(real(fftout[i]));
97 Backward.
fft(fftout, fftin);
99 for (
unsigned int i = 0; i < n; ++i)
100 timeseries[i][j] = real(fftin[i])/n;
115 HilbertTransform(transformedContainter);
118 const unsigned int n = timeseries.
GetSize();
119 for (
unsigned int i = 0; i < n; ++i)
120 timeseries[i] =
sqrt(
Sqr(timeseries[i]) +
Sqr(transformedTimeseries[i]));
131 HilbertTransform(transformedContainter);
134 const unsigned int n = timeseries.
GetSize();
137 for (
unsigned int j = 0; j < 3; ++j) {
138 for (
unsigned int i = 0; i < n; ++i) {
139 timeseries[i][j] =
sqrt(
Sqr(timeseries[i][j]) +
Sqr(transformedTimeseries[i][j]));
constexpr T Sqr(const T &x)
void fft(Complex *in, Complex *out=NULL)
C< T > & GetTimeSeries()
read out the time series (write access)
#define WARNING(message)
Macro for logging warning messages.
Template class for a data container that offers and takes both time series and corresponding frequenc...
Template class for a FADC data or calibrated data container. Use the typedefs (TraceD, TraceI, etc.) defined in Trace-fwd.h.