ocmw.core.spectral module

Basic timeseries spectral analysis functions.

signal_from_fft

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

nextpow2

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

ssas_fft

Generates a single-sided amplitude spectrum.

Basic timeseries spectral analysis functions.

ocmw.core.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 (numpy.array, float) – reconstructed signal at the specifcied times.

ocmw.core.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 (int) – exponent in base two that gives n of the next highest power of 2.

ocmw.core.spectral.ssas_fft(X, Fs)[source]

Generates a single-sided amplitude spectrum.