sdynpy.signal_processing.sdynpy_cpsd.cpsd

cpsd(signals: ndarray, sample_rate: int, samples_per_frame: int, overlap: float, window: str, averages_to_keep: Optional[int] = None, only_asds: bool = False)[source]

Compute cpsd from signals

Parameters
  • signals (np.ndarray) – 2D numpy array containing the signals, with each row containing a signal and each column containing a sample of each signal

  • sample_rate (int) – Sample rate of the signal.

  • samples_per_frame (int) – Number of samples per frame in the CPSD

  • overlap (float) – Overlap as a fraction of the frame (e.g. 0.5 not 50).

  • window (str) – Name of a window function in scipy.signal.windows.

  • averages_to_keep (int, optional) – Optional number of averages to use. The default is None.

  • only_asds (bool, optional) – If True, only compute autospectral densities, otherwise compute the full CPSD matrix

Returns

  • frequency_spacing (float) – The frequency spacing of the CPSD matrix

  • response_spectral_matrix (np.ndarray) – A complex array with dimensions number of frequency lines by number of signals (by number of signals, if only_asds is False)