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:
36 const std::string name() const override { return "FFT"; }
38 const std::string summary() const override { return "Performs complex Fast Fourier Transform"; }
39
41 int version() const override { return 1; }
42 const std::vector<std::string> seeAlso() const override {
43 return {"ExtractFFTSpectrum", "FFTDerivative", "MaxEnt", "RealFFT", "SassenaFFT", "FFTSmooth"};
44 }
46 const std::string category() const override { return "Arithmetic\\FFT"; }
47
48protected:
50 std::map<std::string, std::string> validateInputs() override;
51
52private:
53 // Overridden Algorithm methods
54 void init() override;
55 void exec() override;
56
57 void createUnitsLabels(double &df);
58
59 // Perform forward transformation
60 void transformForward(std::vector<double> &data, const int xSize, const int ySize, const int dys,
61 const bool addPositiveOnly, const bool centerShift, const bool isComplex, const int iReal,
62 const int iImag, const double df, const double dx);
63 // Perform backward transformation
64 void transformBackward(std::vector<double> &data, const int xSize, const int ySize, const int dys,
65 const bool centerShift, const bool isComplex, const int iReal, const int iImag,
66 const double df);
67
68 void setupTAxis(const int nOut, const bool addPositiveOnly);
70 bool areBinWidthsUneven(const HistogramData::BinEdges &xBins) const;
72 double getPhaseShift(const HistogramData::Points &xPoints);
73
74private:
78 gsl_fft_complex_wavetable *m_wavetable;
79 gsl_fft_complex_workspace *m_workspace;
80 int m_iIm;
81 int m_iRe;
82 int m_iAbs;
83};
84
85} // namespace Algorithms
86} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
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:36
const std::string summary() const override
Summary of algorithms purpose.
Definition FFT.h:38
Mantid::API::MatrixWorkspace_sptr m_outWS
Definition FFT.h:77
gsl_fft_complex_wavetable * m_wavetable
Definition FFT.h:78
gsl_fft_complex_workspace * m_workspace
Definition FFT.h:79
Mantid::API::MatrixWorkspace_const_sptr m_inWS
Definition FFT.h:75
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition FFT.h:41
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition FFT.h:42
Mantid::API::MatrixWorkspace_const_sptr m_inImagWS
Definition FFT.h:76
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Definition FFT.h:46
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.