code: def phase_deviation(spectrogram):
      """
      Phase Deviation.
  
      Parameters
      ----------
      spectrogram : :class:`Spectrogram` instance
          :class:`Spectrogram` instance.
  
      Returns
      -------
      phase_deviation : numpy array
          Phase deviation onset detection function.
  
      References
      ----------
      .. [1] Juan Pablo Bello, Chris Duxbury, Matthew Davies and Mark Sandler,
             "On the use of phase and energy for musical onset detection in the
             complex domain",
             IEEE Signal Processing Letters, Volume 11, Number 6, 2004.
  
      """
      # absolute phase changes in instantaneous frequency
      pd = np.abs(_phase_deviation(spectrogram.stft.phase()))
      return np.asarray(np.mean(pd, 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 10 for calling a global function with example usage: phase_deviation(spectrogram) and returns: np