VTK
9.4.20250325
|
perform Discrete Fourier Transforms More...
#include <vtkFFT.h>
Classes | |
struct | isFftType |
struct | isFftType< vtkFFT::ComplexNumber > |
struct | isFftType< vtkFFT::ScalarNumber > |
Public Types | |
enum | Octave { Hz_31_5 = 5 , Hz_63 = 6 , Hz_125 = 7 , Hz_250 = 8 , Hz_500 = 9 , kHz_1 = 10 , kHz_2 = 11 , kHz_4 = 12 , kHz_8 = 13 , kHz_16 = 14 } |
Enum containing octave band numbers, named upon their nominal midband frequency. More... | |
enum | OctaveSubdivision { Full , FirstHalf , SecondHalf , FirstThird , SecondThird , ThirdThird } |
Enum specifying which octave band we want to compute. More... | |
enum | Scaling : int { Density = 0 , Spectrum } |
Scaling modes for Spectrogram and Csd functions. More... | |
enum | SpectralMode : int { STFT = 0 , PSD } |
Spectral modes for Spectrogram and Csd functions. More... | |
typedef vtkObject | Superclass |
using | ScalarNumber = kiss_fft_scalar |
Useful type definitions and utilities. | |
using | ComplexNumber = kiss_fft_cpx |
Useful type definitions and utilities. | |
using | vtkScalarNumberArray = vtkAOSDataArrayTemplate< vtkFFT::ScalarNumber > |
Useful type definitions and utilities. | |
Public Member Functions | |
virtual vtkTypeBool | IsA (const char *type) |
Return 1 if this class is the same type of (or a subclass of) the named class. | |
vtkFFT * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) override |
Methods invoked by print to print information about the object including superclasses. | |
template<> | |
constexpr vtkFFT::ComplexNumber | Zero () |
![]() | |
vtkBaseTypeMacro (vtkObject, vtkObjectBase) | |
virtual void | DebugOn () |
Turn debugging output on. | |
virtual void | DebugOff () |
Turn debugging output off. | |
bool | GetDebug () |
Get the value of the debug flag. | |
void | SetDebug (bool debugFlag) |
Set the value of the debug flag. | |
virtual void | Modified () |
Update the modification time for this object. | |
virtual vtkMTimeType | GetMTime () |
Return this object's modified time. | |
void | PrintSelf (ostream &os, vtkIndent indent) override |
Methods invoked by print to print information about the object including superclasses. | |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
vtkTypeBool | HasObserver (unsigned long event) |
vtkTypeBool | HasObserver (const char *event) |
vtkTypeBool | InvokeEvent (unsigned long event) |
vtkTypeBool | InvokeEvent (const char *event) |
std::string | GetObjectDescription () const override |
The object description printed in messages and PrintSelf output. | |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkCommand * | GetCommand (unsigned long tag) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObserver (vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObservers (unsigned long event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObservers (const char *event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkTypeBool | HasObserver (unsigned long event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkTypeBool | HasObserver (const char *event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
Overloads to AddObserver that allow developers to add class member functions as callbacks for events. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
Overloads to AddObserver that allow developers to add class member functions as callbacks for events. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
Allow user to set the AbortFlagOn() with the return value of the callback method. | |
vtkTypeBool | InvokeEvent (unsigned long event, void *callData) |
This method invokes an event and return whether the event was aborted or not. | |
vtkTypeBool | InvokeEvent (const char *event, void *callData) |
This method invokes an event and return whether the event was aborted or not. | |
virtual void | SetObjectName (const std::string &objectName) |
Set/get the name of this object for reporting purposes. | |
virtual std::string | GetObjectName () const |
Set/get the name of this object for reporting purposes. | |
![]() | |
const char * | GetClassName () const |
Return the class name as a string. | |
virtual std::string | GetObjectDescription () const |
The object description printed in messages and PrintSelf output. | |
virtual vtkTypeBool | IsA (const char *name) |
Return 1 if this class is the same type of (or a subclass of) the named class. | |
virtual vtkIdType | GetNumberOfGenerationsFromBase (const char *name) |
Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). | |
virtual void | Delete () |
Delete a VTK object. | |
virtual void | FastDelete () |
Delete a reference to this object. | |
void | InitializeObjectBase () |
void | Print (ostream &os) |
Print an object to an ostream. | |
void | Register (vtkObjectBase *o) |
Increase the reference count (mark as used by another object). | |
virtual void | UnRegister (vtkObjectBase *o) |
Decrease the reference count (release by another object). | |
int | GetReferenceCount () |
Return the current reference count of this object. | |
void | SetReferenceCount (int) |
Sets the reference count. | |
bool | GetIsInMemkind () const |
A local state flag that remembers whether this object lives in the normal or extended memory space. | |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
Methods invoked by print to print information about the object including superclasses. | |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
Methods invoked by print to print information about the object including superclasses. | |
virtual bool | UsesGarbageCollector () const |
Indicate whether the class uses vtkGarbageCollector or not. | |
Static Public Member Functions | |
static std::vector< ComplexNumber > | IFft (const std::vector< ComplexNumber > &in) |
Compute the inverse of Fft . | |
static std::vector< ScalarNumber > | IRFft (const std::vector< ComplexNumber > &in) |
Compute the inverse of RFft . | |
static ScalarNumber | Abs (const ComplexNumber &in) |
Return the absolute value (also known as norm, modulus, or magnitude) of complex number. | |
static ScalarNumber | SquaredAbs (const ComplexNumber &in) |
Return the squared absolute value of the complex number. | |
static ComplexNumber | Conjugate (const ComplexNumber &in) |
Return the conjugate of the given complex number. | |
static std::vector< ScalarNumber > | FftFreq (int windowLength, double sampleSpacing) |
Return the DFT sample frequencies. | |
static std::vector< ScalarNumber > | RFftFreq (int windowLength, double sampleSpacing) |
Return the DFT sample frequencies for the real version of the dft (see Rfft ). | |
static std::array< double, 2 > | GetOctaveFrequencyRange (Octave octave, OctaveSubdivision octaveSubdivision=OctaveSubdivision::Full, bool baseTwo=true) |
Return lower and upper frequency from a octave band number / nominal midband frequency. | |
template<typename T > | |
static void | Transpose (T *data, unsigned int *shape) |
Transpose in place an inlined 2D matrix. | |
template<typename T > | |
static void | GenerateKernel1D (T *kernel, std::size_t n, WindowGenerator generator) |
Given a window generator function, create a symmetric 1D kernel. | |
template<typename T > | |
static void | GenerateKernel2D (T *kernel, std::size_t n, std::size_t m, WindowGenerator generator) |
Given a window generator function, create a symmetric 2D kernel. | |
static vtkFFT * | New () |
static vtkTypeBool | IsTypeOf (const char *type) |
static vtkFFT * | SafeDownCast (vtkObjectBase *o) |
static std::vector< ComplexNumber > | Fft (const std::vector< ScalarNumber > &in) |
Compute the one-dimensional DFT for complex input. | |
static void | Fft (ScalarNumber *input, std::size_t size, ComplexNumber *result) |
Compute the one-dimensional DFT for complex input. | |
static std::vector< ComplexNumber > | Fft (const std::vector< ComplexNumber > &in) |
Compute the one-dimensional DFT for complex input. | |
static void | Fft (ComplexNumber *input, std::size_t size, ComplexNumber *result) |
Compute the one-dimensional DFT for complex input. | |
static vtkSmartPointer< vtkScalarNumberArray > | Fft (vtkScalarNumberArray *input) |
Compute the one-dimensional DFT for complex input. | |
static std::vector< ComplexNumber > | RFft (const std::vector< ScalarNumber > &in) |
Compute the one-dimensional DFT for real input. | |
static void | RFft (ScalarNumber *input, std::size_t size, ComplexNumber *result) |
Compute the one-dimensional DFT for real input. | |
static vtkSmartPointer< vtkScalarNumberArray > | RFft (vtkScalarNumberArray *input) |
Compute the one-dimensional DFT for real input. | |
template<typename T , typename TW , typename std::enable_if< isFftType< T >::value >::type * = nullptr> | |
static std::vector< ComplexNumber > | OverlappingFft (const std::vector< T > &signal, const std::vector< TW > &window, std::size_t noverlap, bool detrend, bool onesided, unsigned int *shape=nullptr) |
Compute consecutive Fourier transforms Welch method without averaging nor scaling the result. | |
template<typename TW > | |
static vtkFFT::ComplexNumber * | OverlappingFft (vtkFFT::vtkScalarNumberArray *signal, const std::vector< TW > &window, std::size_t noverlap, bool detrend, bool onesided, unsigned int *shape=nullptr) |
Compute consecutive Fourier transforms Welch method without averaging nor scaling the result. | |
template<typename T , typename TW , typename std::enable_if< isFftType< T >::value >::type * = nullptr> | |
static std::vector< ComplexNumber > | Spectrogram (const std::vector< T > &signal, const std::vector< TW > &window, double sampleRate, int noverlap, bool detrend, bool onesided, vtkFFT::Scaling scaling, vtkFFT::SpectralMode mode, unsigned int *shape=nullptr, bool transpose=false) |
Compute a spectrogram with consecutive Fourier transforms using Welch method. | |
template<typename TW > | |
static vtkSmartPointer< vtkFFT::vtkScalarNumberArray > | Spectrogram (vtkFFT::vtkScalarNumberArray *signal, const std::vector< TW > &window, double sampleRate, int noverlap, bool detrend, bool onesided, vtkFFT::Scaling scaling, vtkFFT::SpectralMode mode, unsigned int *shape=nullptr, bool transpose=false) |
Compute a spectrogram with consecutive Fourier transforms using Welch method. | |
template<typename T , typename TW , typename std::enable_if< isFftType< T >::value >::type * = nullptr> | |
static std::vector< vtkFFT::ScalarNumber > | Csd (const std::vector< T > &signal, const std::vector< TW > &window, double sampleRate, int noverlap, bool detrend, bool onesided, vtkFFT::Scaling scaling) |
Compute the Cross Spectral Density of a given signal. | |
template<typename TW > | |
static vtkSmartPointer< vtkFFT::vtkScalarNumberArray > | Csd (vtkScalarNumberArray *signal, const std::vector< TW > &window, double sampleRate, int noverlap, bool detrend, bool onesided, vtkFFT::Scaling scaling) |
Compute the Cross Spectral Density of a given signal. | |
![]() | |
static vtkObject * | New () |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on. | |
static void | BreakOnError () |
This method is called when vtkErrorMacro executes. | |
static void | SetGlobalWarningDisplay (vtkTypeBool val) |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static void | GlobalWarningDisplayOn () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static void | GlobalWarningDisplayOff () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static vtkTypeBool | GetGlobalWarningDisplay () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
![]() | |
static vtkTypeBool | IsTypeOf (const char *name) |
Return 1 if this class type is the same type of (or a subclass of) the named class. | |
static vtkIdType | GetNumberOfGenerationsFromBaseType (const char *name) |
Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). | |
static vtkObjectBase * | New () |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on. | |
static void | SetMemkindDirectory (const char *directoryname) |
The name of a directory, ideally mounted -o dax, to memory map an extended memory space within. | |
static bool | GetUsingMemkind () |
A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space. | |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkFFT ()=default | |
~vtkFFT () override=default | |
![]() | |
vtkObject () | |
~vtkObject () override | |
void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) override |
void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr) |
These methods allow a command to exclusively grab all events. | |
void | InternalReleaseFocus () |
These methods allow a command to exclusively grab all events. | |
![]() | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) |
virtual void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) |
virtual void | ReportReferences (vtkGarbageCollector *) |
virtual void | ObjectFinalize () |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Static Protected Member Functions | |
template<typename T > | |
static constexpr T | Zero () |
Templated zero value, specialized for vtkFFT::ComplexNumber. | |
template<typename InputIt > | |
static std::iterator_traits< InputIt >::value_type | ComputeScaling (InputIt begin, InputIt end, Scaling scaling, double fs) |
For a given window defined by begin and end , compute the scaling needed to apply to the resulting FFT. | |
template<typename T , typename TW > | |
static void | PreprocessAndDispatchFft (const T *segment, const std::vector< TW > &window, bool detrend, bool onesided, vtkFFT::ComplexNumber *result) |
Dispatch the signal to the right FFT function according to the given parameters. | |
static void | RFft (ComplexNumber *input, std::size_t size, ComplexNumber *result) |
XXX(c++17): This function should NOT exist and is here just for the sake template unfolding purposes. | |
template<typename TW > | |
static void | ScaleFft (ComplexNumber *fft, unsigned int shape[2], const std::vector< TW > &window, double sampleRate, bool onesided, vtkFFT::Scaling scaling, vtkFFT::SpectralMode mode) |
Scale a fft according to its window and some mode. | |
![]() | |
static vtkMallocingFunction | GetCurrentMallocFunction () |
static vtkReallocingFunction | GetCurrentReallocFunction () |
static vtkFreeingFunction | GetCurrentFreeFunction () |
static vtkFreeingFunction | GetAlternateFreeFunction () |
using | WindowGenerator = ScalarNumber(*)(std::size_t, std::size_t) |
Window generator functions. | |
static ScalarNumber | HanningGenerator (std::size_t x, std::size_t size) |
Window generator functions. | |
static ScalarNumber | BartlettGenerator (std::size_t x, std::size_t size) |
Window generator functions. | |
static ScalarNumber | SineGenerator (std::size_t x, std::size_t size) |
Window generator functions. | |
static ScalarNumber | BlackmanGenerator (std::size_t x, std::size_t size) |
Window generator functions. | |
static ScalarNumber | RectangularGenerator (std::size_t x, std::size_t size) |
Window generator functions. | |
Additional Inherited Members | |
![]() | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
std::string | ObjectName |
![]() | |
std::atomic< int32_t > | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
perform Discrete Fourier Transforms
vtkFFT provides methods to perform Discrete Fourier Transforms (DFT). These include providing forward and reverse Fourier transforms. The current implementation uses the third-party library kissfft.
The terminology tries to follow the Numpy terminology, that is :
R
stands for Real (meaning optimized function for real inputs)I
stands for InverseSome functions provides pointer-based version of themself in order to prevent copying memory when possible.
using vtkFFT::ScalarNumber = kiss_fft_scalar |
Useful type definitions and utilities.
ScalarNumber is defined as a floating point number.
ComplexNumber is defined as a struct that contains two ScalarNumber. These 2 numbers should be contiguous in memory. First one should be named r and represent the real part, while second one should be named i and represent the imaginary part. This specification is important for the implementation of functions accepting and returning values from vtkDataArrays as it allows to do some zero-copy operations.
A vtkScalarNumberArray is a data array with a layout memory compatible with the underlying library for zero copy operations.
isFftType is a trait to tell templates if Type is either ScalarNumber or ComplexNumber.
Common operators such as +,-,*,/ between ScalarNumber and ComplexNumber are included in this header.
using vtkFFT::ComplexNumber = kiss_fft_cpx |
Useful type definitions and utilities.
ScalarNumber is defined as a floating point number.
ComplexNumber is defined as a struct that contains two ScalarNumber. These 2 numbers should be contiguous in memory. First one should be named r and represent the real part, while second one should be named i and represent the imaginary part. This specification is important for the implementation of functions accepting and returning values from vtkDataArrays as it allows to do some zero-copy operations.
A vtkScalarNumberArray is a data array with a layout memory compatible with the underlying library for zero copy operations.
isFftType is a trait to tell templates if Type is either ScalarNumber or ComplexNumber.
Common operators such as +,-,*,/ between ScalarNumber and ComplexNumber are included in this header.
Useful type definitions and utilities.
ScalarNumber is defined as a floating point number.
ComplexNumber is defined as a struct that contains two ScalarNumber. These 2 numbers should be contiguous in memory. First one should be named r and represent the real part, while second one should be named i and represent the imaginary part. This specification is important for the implementation of functions accepting and returning values from vtkDataArrays as it allows to do some zero-copy operations.
A vtkScalarNumberArray is a data array with a layout memory compatible with the underlying library for zero copy operations.
isFftType is a trait to tell templates if Type is either ScalarNumber or ComplexNumber.
Common operators such as +,-,*,/ between ScalarNumber and ComplexNumber are included in this header.
using vtkFFT::WindowGenerator = ScalarNumber (*)(std::size_t, std::size_t) |
Window generator functions.
Implementation only needs to be valid for x E [0; size / 2] because kernels are symmetric by definitions. This point is very important for some kernels like Bartlett for example.
Can be used with GenerateKernel1D
and GenerateKernel2D
for generating full kernels.
typedef vtkObject vtkFFT::Superclass |
enum vtkFFT::Octave |
enum vtkFFT::Scaling : int |
enum vtkFFT::SpectralMode : int |
|
protecteddefault |
|
overrideprotecteddefault |
|
static |
Compute the one-dimensional DFT for complex input.
If input is scalars then the imaginary part is set to 0
input has n complex points output has n complex points in case of success and empty in case of failure
|
static |
Compute the one-dimensional DFT for complex input.
If input is scalars then the imaginary part is set to 0
input has n complex points output has n complex points in case of success and empty in case of failure
|
static |
Compute the one-dimensional DFT for complex input.
If input is scalars then the imaginary part is set to 0
input has n complex points output has n complex points in case of success and empty in case of failure
|
static |
Compute the one-dimensional DFT for complex input.
If input is scalars then the imaginary part is set to 0
input has n complex points output has n complex points in case of success and empty in case of failure
|
static |
Compute the one-dimensional DFT for complex input.
If input is scalars then the imaginary part is set to 0
input has n complex points output has n complex points in case of success and empty in case of failure
|
static |
Compute the one-dimensional DFT for real input.
input has n scalar points output has (n/2) + 1 complex points in case of success and empty in case of failure
|
static |
Compute the one-dimensional DFT for real input.
input has n scalar points output has (n/2) + 1 complex points in case of success and empty in case of failure
|
static |
Compute the one-dimensional DFT for real input.
input has n scalar points output has (n/2) + 1 complex points in case of success and empty in case of failure
|
static |
Compute the inverse of Fft
.
The input should be ordered in the same way as is returned by Fft
, i.e.,
input has n complex points output has n scalar points in case of success and empty in case of failure
|
static |
Compute the inverse of RFft
.
The input is expected to be in the form returned by Rfft
, i.e. the real zero-frequency term followed by the complex positive frequency terms in order of increasing frequency.
input has (n/2) + 1 complex points output has n scalar points in case of success and empty in case of failure
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
Return the DFT sample frequencies.
Output has windowLength
size.
|
static |
Return the DFT sample frequencies for the real version of the dft (see Rfft
).
Output has (windowLength / 2) + 1 size.
|
static |
Return lower and upper frequency from a octave band number / nominal midband frequency.
[in] | octave | octave band number associated to nominal midband frequency |
[in] | octaveSubdivision | (optional) which subdivision of octave wanted (default: Full) |
[in] | baseTwo | (optional) whether to compute it using base-2 or base-10 (default: base-2) cf. "ANSI S1.11: Specification for Octave, Half-Octave, and Third Octave Band Filter Sets". |
|
static |
Compute consecutive Fourier transforms Welch method without averaging nor scaling the result.
[in] | signal | the input signal |
[in] | window | the window to use per segment. Its size defines the size of FFT and thus the size of the output. |
[in] | noverlap | number of samples that will overlap between two segment |
[in] | detrend | if true then each segment will be detrend using the mean value of the segment before applying the FFT. |
[in] | onesided | if true return a one-sided spectrum for real data. If input is copmlex then this option will be ignored. |
[out] | shape | if not nullptr , return the shape (n,m) of the result. n is the number of segment and m the number of samples per segment. |
|
static |
Compute consecutive Fourier transforms Welch method without averaging nor scaling the result.
[in] | signal | the input signal |
[in] | window | the window to use per segment. Its size defines the size of FFT and thus the size of the output. |
[in] | noverlap | number of samples that will overlap between two segment |
[in] | detrend | if true then each segment will be detrend using the mean value of the segment before applying the FFT. |
[in] | onesided | if true return a one-sided spectrum for real data. If input is copmlex then this option will be ignored. |
[out] | shape | if not nullptr , return the shape (n,m) of the result. n is the number of segment and m the number of samples per segment. |
|
static |
Compute a spectrogram with consecutive Fourier transforms using Welch method.
[in] | signal | the input signal |
[in] | window | the window to use per segment. Its size defines the size of FFT and thus the size of the output. |
[in] | sampleRate | sample rate of the input signal |
[in] | noverlap | number of samples that will overlap between two segment |
[in] | detrend | if true then each segment will be detrend using the mean value of the segment before applying the FFT. |
[in] | onesided | if true return a one-sided spectrum for real data. If input is copmlex then this option will be ignored. |
[in] | scaling | can be either Cross Spectral Density (V^2/Hz) or Cross Spectrum (V^2) |
[in] | mode | determine which type of value ares returned. It is very dependent to how you want to use the result afterwards. |
[out] | shape | if not nullptr , return the shape (n,m) of the result. n is the number of segment and m the number of samples per segment. Shape is inverted if transpose is true. |
[in] | transpose | allows to transpose the resulting the resulting matrix into something of shape (m, n) |
|
static |
Compute a spectrogram with consecutive Fourier transforms using Welch method.
[in] | signal | the input signal |
[in] | window | the window to use per segment. Its size defines the size of FFT and thus the size of the output. |
[in] | sampleRate | sample rate of the input signal |
[in] | noverlap | number of samples that will overlap between two segment |
[in] | detrend | if true then each segment will be detrend using the mean value of the segment before applying the FFT. |
[in] | onesided | if true return a one-sided spectrum for real data. If input is copmlex then this option will be ignored. |
[in] | scaling | can be either Cross Spectral Density (V^2/Hz) or Cross Spectrum (V^2) |
[in] | mode | determine which type of value ares returned. It is very dependent to how you want to use the result afterwards. |
[out] | shape | if not nullptr , return the shape (n,m) of the result. n is the number of segment and m the number of samples per segment. Shape is inverted if transpose is true. |
[in] | transpose | allows to transpose the resulting the resulting matrix into something of shape (m, n) |
|
static |
Compute the Cross Spectral Density of a given signal.
This is the optimized version for computing the csd of a single signal with itself. It uses Spectrogram behind the hood, and then average all resulting segments of the spectrogram.
[in] | signal | the input signal |
[in] | window | the window to use per segment. Its size defines the size of FFT and thus the size of the output. |
[in] | sampleRate | sample rate of the input signal |
[in] | noverlap | number of samples that will overlap between two segment |
[in] | detrend | if true then each segment will be detrend using the mean value of the segment before applying the FFT. |
[in] | onesided | if true return a one-sided spectrum for real data. If input is copmlex then this option will be ignored. |
[in] | scaling | can be either Cross Spectral Density (V^2/Hz) or Cross Spectrum (V^2) |
|
static |
Compute the Cross Spectral Density of a given signal.
This is the optimized version for computing the csd of a single signal with itself. It uses Spectrogram behind the hood, and then average all resulting segments of the spectrogram.
[in] | signal | the input signal |
[in] | window | the window to use per segment. Its size defines the size of FFT and thus the size of the output. |
[in] | sampleRate | sample rate of the input signal |
[in] | noverlap | number of samples that will overlap between two segment |
[in] | detrend | if true then each segment will be detrend using the mean value of the segment before applying the FFT. |
[in] | onesided | if true return a one-sided spectrum for real data. If input is copmlex then this option will be ignored. |
[in] | scaling | can be either Cross Spectral Density (V^2/Hz) or Cross Spectrum (V^2) |
|
static |
Transpose in place an inlined 2D matrix.
This algorithm is not optimized for square matrices but is generic. This will also effectively swap shape values. Worst case complexity is : O( (shape[0]*shape[1])^3/2 )
XXX: some fft libraries such as FFTW already propose functions to do that. This should be taken into account if the backend is changed at some point.
XXX: An optimized version could be implemented for square matrices
|
inlinestatic |
Window generator functions.
Implementation only needs to be valid for x E [0; size / 2] because kernels are symmetric by definitions. This point is very important for some kernels like Bartlett for example.
Can be used with GenerateKernel1D
and GenerateKernel2D
for generating full kernels.
|
inlinestatic |
Window generator functions.
Implementation only needs to be valid for x E [0; size / 2] because kernels are symmetric by definitions. This point is very important for some kernels like Bartlett for example.
Can be used with GenerateKernel1D
and GenerateKernel2D
for generating full kernels.
|
inlinestatic |
Window generator functions.
Implementation only needs to be valid for x E [0; size / 2] because kernels are symmetric by definitions. This point is very important for some kernels like Bartlett for example.
Can be used with GenerateKernel1D
and GenerateKernel2D
for generating full kernels.
|
inlinestatic |
Window generator functions.
Implementation only needs to be valid for x E [0; size / 2] because kernels are symmetric by definitions. This point is very important for some kernels like Bartlett for example.
Can be used with GenerateKernel1D
and GenerateKernel2D
for generating full kernels.
|
inlinestatic |
Window generator functions.
Implementation only needs to be valid for x E [0; size / 2] because kernels are symmetric by definitions. This point is very important for some kernels like Bartlett for example.
Can be used with GenerateKernel1D
and GenerateKernel2D
for generating full kernels.
|
static |
|
static |
|
static |
|
static |
|
virtual |
Return 1 if this class is the same type of (or a subclass of) the named class.
Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObjectBase.
|
static |
|
protectedvirtual |
vtkFFT * vtkFFT::NewInstance | ( | ) | const |
|
overridevirtual |
Methods invoked by print to print information about the object including superclasses.
Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from vtkObjectBase.
|
staticconstexprprotected |
Templated zero value, specialized for vtkFFT::ComplexNumber.
|
staticprotected |
For a given window defined by begin
and end
, compute the scaling needed to apply to the resulting FFT.
Used in the Spectrogram
function.
|
staticprotected |
Dispatch the signal to the right FFT function according to the given parameters.
Also detrend the signal and multiply it by the window. Used in the OverlappingFft
function.
|
staticprotected |
XXX(c++17): This function should NOT exist and is here just for the sake template unfolding purposes.
As long we don't have constexrp if
this is the easier way to deal with it.
|
staticprotected |
Scale a fft according to its window and some mode.
Used in the Spectrogram
function.
|
constexpr |