code: def _complex_domain(spectrogram):
      """
      Helper method used by complex_domain() & rectified_complex_domain().
  
      Parameters
      ----------
      spectrogram : :class:`Spectrogram` instance
          :class:`Spectrogram` instance.
  
      Returns
      -------
      numpy array
          Complex domain onset detection function.
  
      Notes
      -----
      We use the simple implementation presented in [1]_.
  
      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"
          )
      # expected spectrogram
      cd_target = np.zeros_like(phase)
      # assume constant phase change
      cd_target[1:] = 2 * phase[1:] - phase[:-1]
      # add magnitude
      cd_target = spectrogram * np.exp(1j * cd_target)
      # create complex spectrogram
      cd = spectrogram * np.exp(1j * phase)
      # subtract the target values
      cd[1:] -= cd_target[:-1]
      return np.asarray(cd)
  
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 13 for calling a global function with example usage: _complex_domain(spectrogram) and returns: np