Fourier transform
General functions used for the discrete Fourier transform (DFT).
Added in version 1.0.4.
- nexus.SamplingFrequency(orig_step)
The sampling frequency \(f_s\) for the DFT is given by the inverse of the step size in the base space.
\[f_s = \frac{1}{orig\_step}\]- Parameters:
orig_step (float) – original step size in the base space.
- Returns:
sampling frequency for the DFT.
- Return type:
float
- nexus.Step(num_points, orig_step)
The frequency step \(\Delta f\) for the DFT is given by
\[\Delta f = \frac{f_s}{N} = \frac{1}{N * orig\_step}\]- Parameters:
num_points (int) – number of points of the original base space.
orig_step (float) – original step size in the base space.
- Returns:
step size for the Fourier transform.
- Return type:
float
- nexus.Resolution(num_points, sampling_frequency)
The resolution of the DFT is the smallest visible frequency. Same as the frequency step.
\[\Delta f = \frac{f_s}{N} = \frac{1}{N * orig\_step}.\]- Parameters:
num_points (int) – number of points of the original base space.
sampling_frequency (float) – sampling frequency of the Fourier transform.
- Returns:
Resolution of the DFT.
- Return type:
float
Note
Parceval’s theorem is
- nexus.NormalizationN(num_points)
Normalization factor \(\frac{1}{N}\). Used for Intensities to ensures Parseval’s theorem.
- Parameters:
num_points (int) – number of points of the original base space.
- Returns:
Normalization factor.
- Return type:
float
- nexus.NormalizationSqrtN(number_points)
Normalization factor \(\frac{1}{\sqrt{N}}\). Used for amplitudes to ensures Parseval’s theorem.
- Parameters:
num_points (int) – number of points of the original base space.
- Returns:
Normalization factor.
- Return type:
float
- nexus.NormalizationNIntegratedIntensity(number_points, orig_step)
Normalization for original-space-integrated intensity \(\frac{orig\_step}{N}\). Obeys Parseval’s theorem. Relates the Fourier components via
\[orig\_step * \sum_{k=0}^{N-1} \left| x(orig\_step)_k \right|^2 = \frac{orig\_step}{N} * \sum_{n=0}^{N-1} \left| X(fourier\_step)_n \right|^2\]- Parameters:
num_points (int) – number of points of the original base space.
orig_step (float) – original step size in the base space.
- Returns:
Normalization factor.
- Return type:
float
- nexus.NormalizationNIntegratedIntensityScaled(number_points, orig_step, fourier_step)
Normalization for original-space-integrated intensity scaled by Fourier step size \(\frac{step\_size}{N * fourier\_step}\). This normalization factor is scaled by the Fourier step in order to compensate for the changing sampling rate (with changing N or time_step), for which each bin represents a changing Fourier band. Similar to the scaling of a power density spectrum.
\[\frac{orig\_step}{fourier\_step} * \sum_{k=0}^{N-1} \left| x(orig\_step)_k \right|^2 = \frac{orig\_step}{N * fourier\_step} * \sum_{n=0}^{N-1} \left|X(fourier\_step)_n \right|^2\]- Parameters:
num_points (int) – number of points of the original base space.
orig_step (float) – original step size in the base space.
fourier_step (float) – step size in the Fourier space.
- Returns:
Normalization factor.
- Return type:
float
- nexus.NormalizationIntegratedIntensityScaled(orig_step, fourier_step)
Normalization for original-space-integrated intensity scaled by Fourier step size \(\frac{orig\_step}{fourier\_step}\). Assumes that the Fourier coefficients are already normalized by \(\frac{1}{\sqrt{N}}\). Normalization does not obey Parseval’s theorem. This normalization factor is scaled by the Fourier step in order to compensate for the changing sampling rate (with changing N or time_step), for which each bin represents a changing Fourier band. Similar to the scaling of a power density spectrum.
\[\frac{orig\_step}{fourier\_step} * \sum_{k=0}^{N-1} \left| x(orig\_step)_k \right|^2 = \frac{orig\_step}{fourier\_step} * \sum_{n=0}^{N-1} \left| \frac{1}{\sqrt{N}} X(fourier\_step)_n \right|^2\]Added in version 1.0.4.
- Parameters:
orig_step (float) – original step size in the base space.
fourier_step (float) – step size in the Fourier space.
- Returns:
Normalization factor.
- Return type:
float
Note
For window functions see https://en.wikipedia.org/wiki/Window_function
- nexus.Welch(num_points)
Creates a Welch window.
Added in version 1.0.4.
- Parameters:
num_points (int) – number of points.
- Returns:
Welch window.
- Return type:
list
- nexus.Sine(num_points)
Creates a Sine window.
Added in version 1.0.4.
- Parameters:
num_points (int) – number of points.
- Returns:
Sine window.
- Return type:
list
- nexus.Hann(num_points)
Creates a Hann window.
Added in version 1.0.4.
- Parameters:
num_points (int) – number of points.
- Returns:
Hann window.
- Return type:
list
- nexus.Hamming(num_points)
Creates a Hamming window.
Added in version 1.0.4.
- Parameters:
num_points (int) – number of points.
- Returns:
Hamming window.
- Return type:
list
- nexus.Kaiser(num_points, alpha)
Creates a Kaiser window.
Added in version 1.0.4.
- Parameters:
num_points (int) – number of points.
alpha (float) – alpha value.
- Returns:
Kaiser window.
- Return type:
list