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, reference_signals=None)[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, or a NumPy ndarray with the window coefficients

  • 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

  • reference_signals (np.ndarray) – If specified, these signals will be used for the columns of the CPSD matrix. If not specified, the signals passed to the signals argument will be used for both the rows and columns of the CPSD matrix. Cannot be used simultaneously with the only_asds argument being set to True.

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)