code: def weighted_phase_deviation(spectrogram):
      """
      Weighted Phase Deviation.
  
      Parameters
      ----------
      spectrogram : :class:`Spectrogram` instance
          :class:`Spectrogram` instance.
  
      Returns
      -------
      weighted_phase_deviation : numpy array
          Weighted phase deviation onset detection function.
  
      References
      ----------
      .. [1] Simon Dixon,
             "Onset Detection Revisited",
             Proceedings of the 9th International Conference on Digital Audio
             Effects (DAFx), 2006.
  
      """
      # cache phase
      phase = spectrogram.stft.phase()
      # make sure the spectrogram is not filtered before
      if np.shape(phase) != np.shape(spectrogram):
          raise ValueError(
              "spectrogram and phase must be of same shape"
          )
      # weighted_phase_deviation = spectrogram * phase_deviation
      wpd = np.abs(_phase_deviation(phase) * spectrogram)
      return np.asarray(np.mean(wpd, axis=1))
  
imports: from __future__ import absolute_import, division, print_function
  import numpy
  from scipy.ndimage import maximum_filter, minimum_filter, uniform_filter
  from ..audio.signal import smooth
  from ..processors import BufferProcessor, OnlineProcessor, ParallelProcessor, SequentialProcessor
  from ..utils import combine_events
label_desc: Use image node_id 11 for calling a global function with example usage: weighted_phase_deviation(spectrogram) and returns: np