Mantid
Loading...
Searching...
No Matches
FFT.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/Algorithm.h"
14#include "MantidAlgorithms/DllConfig.h"
15#include "MantidHistogramData/BinEdges.h"
16#include "MantidHistogramData/Points.h"
18#include <gsl/gsl_fft_complex.h>
19
20namespace Mantid {
21
22namespace HistogramData {
23class HistogramX;
24}
25
26namespace Algorithms {
27
33class MANTID_ALGORITHMS_DLL FFT : public API::Algorithm {
34public:
35 virtual ~FFT() = default;
37 const std::string name() const override { return "FFT"; }
39 const std::string summary() const override { return "Performs complex Fast Fourier Transform"; }
40
42 int version() const override { return 1; }
43 const std::vector<std::string> seeAlso() const override {
44 return {"ExtractFFTSpectrum", "FFTDerivative", "MaxEnt", "RealFFT", "SassenaFFT", "FFTSmooth"};
45 }
47 const std::string category() const override { return "Arithmetic\\FFT"; }
48
49protected:
51 std::map<std::string, std::string> validateInputs() override;
52
53private:
54 // Overridden Algorithm methods
55 void init() override;
56 void exec() override;
57
58 void createUnitsLabels(double &df);
59
60 // Perform forward transformation
61 void transformForward(std::vector<double> &data, const int xSize, const int ySize, const int dys,
62 const bool addPositiveOnly, const bool centerShift, const bool isComplex, const int iReal,
63 const int iImag, const double df, const double dx);
64 // Perform backward transformation
65 void transformBackward(std::vector<double> &data, const int xSize, const int ySize, const int dys,
66 const bool centerShift, const bool isComplex, const int iReal, const int iImag,
67 const double df);
68
69 void setupTAxis(const int nOut, const bool addPositiveOnly);
71 bool areBinWidthsUneven(const HistogramData::BinEdges &xBins) const;
73 double getPhaseShift(const HistogramData::Points &xPoints);
74
75private:
79 gsl_fft_complex_wavetable *m_wavetable;
80 gsl_fft_complex_workspace *m_workspace;
81 int m_iIm;
82 int m_iRe;
83 int m_iAbs;
84};
85
86} // namespace Algorithms
87} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Performs a Fast Fourier Transform of data.
Definition: FFT.h:33
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: FFT.h:37
virtual ~FFT()=default
const std::string summary() const override
Summary of algorithms purpose.
Definition: FFT.h:39
Mantid::API::MatrixWorkspace_sptr m_outWS
Definition: FFT.h:78
gsl_fft_complex_wavetable * m_wavetable
Definition: FFT.h:79
gsl_fft_complex_workspace * m_workspace
Definition: FFT.h:80
Mantid::API::MatrixWorkspace_const_sptr m_inWS
Definition: FFT.h:76
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition: FFT.h:42
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition: FFT.h:43
Mantid::API::MatrixWorkspace_const_sptr m_inImagWS
Definition: FFT.h:77
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Definition: FFT.h:47
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.