wecopttool.frequency_parameters

frequency_parameters(freqs, zero_freq=True)[source]

Return the fundamental frequency and the number of frequencies in a frequency array.

This function can be used as a check for inputs to other functions since it raises an error if the frequency vector does not have the correct format freqs = [0, f1, 2*f1, ..., nfreq*f1] (or freqs = [f1, 2*f1, ..., nfreq*f1] if zero_freq = False).

Parameters:
  • freqs (ArrayLike) – The frequency array, starting at zero and having equal spacing.

  • zero_freq (bool) – Whether the first frequency should be zero.

Returns:

  • f1 – Fundamental frequency f1 [\(Hz\)]

  • nfreq – Number of frequencies (not including zero frequency), i.e., freqs = [0, f1, 2*f1, ..., nfreq*f1].

Raises:
  • ValueError – If the frequency vector is not evenly spaced.

  • ValueError – If the zero-frequency was expected but not included or not expected but included.

Return type:

tuple[float, int]