fastwater.general.spectral module

Signal processing tools for supporting spectral analysis of fluid data.

fastwater.general.spectral.nextpow2(n)[source]

Find the power of two the gives n or the next highest power of 2 beyond if n is not a power of 2.

Parameters

n (int) – number of points to find the next power of 2 for.

Returns

power – exponent in base two that gives n of the next highest power of 2.

Return type

int

fastwater.general.spectral.signal_from_fft(times, freq, components, spectrum)[source]

Reconstruct a times series from the frequency spectrum, with the option to separate out frequency dependent processes using a subset of the spectral components.

Parameters
  • times (numpy.array, float) – time stamps (in seconds) to reconstruct signal for.

  • freq (numpy.array, float) – bin frequencies (in Hz).

  • components (tuple, int) – set of frequency components to include in reconstruction.

  • spectrum (numpy.array, complex, float) – complex spectral data at defined frequencies.

Returns

signal – reconstructed signal at the specifcied times.

Return type

numpy.array, float