code: def complex_flux(
      spectrogram,
      diff_frames=None,
      diff_max_bins=3,
      temporal_filter=3,
      temporal_origin=0,
  ):
      """
      ComplexFlux.
  
      ComplexFlux is based on the SuperFlux, but adds an additional local group
      delay based tremolo suppression.
  
      Parameters
      ----------
      spectrogram : :class:`Spectrogram` instance
          :class:`Spectrogram` instance.
      diff_frames : int, optional
          Number of frames to calculate the diff to.
      diff_max_bins : int, optional
          Number of bins used for maximum filter.
      temporal_filter : int, optional
          Temporal maximum filtering of the local group delay [frames].
      temporal_origin : int, optional
          Origin of the temporal maximum filter.
  
      Returns
      -------
      complex_flux : numpy array
          ComplexFlux onset detection function.
  
      References
      ----------
      .. [1] Sebastian Böck and Gerhard Widmer,
             "Local group delay based vibrato and tremolo suppression for onset
             detection",
             Proceedings of the 14th International Society for Music Information
             Retrieval Conference (ISMIR), 2013.
  
      """
      # create a mask based on the local group delay information
      # take only absolute values of the local group delay and normalize them
      lgd = np.abs(spectrogram.stft.phase().lgd()) / np.pi
      # maximum filter along the temporal axis
      # TODO: use HPSS instead of simple temporal filtering
      if temporal_filter > 0:
          lgd = maximum_filter(
              lgd, size=[temporal_filter, 1], origin=temporal_origin
          )
      # lgd = uniform_filter(lgd, size=[1, 3])  # better for percussive onsets
      # create the weighting mask
      try:
          # if the magnitude spectrogram was filtered, use the minimum local
          # group delay value of each filterbank (expanded by one frequency
          # bin in both directions) as the mask
          mask = np.zeros_like(spectrogram)
          num_bins = lgd.shape[1]
          for b in range(mask.shape[1]):
              # determine the corner bins for the mask
              corner_bins = np.nonzero(spectrogram.filterbank[:, b])[0]
              # always expand to the next neighbour
              start_bin = corner_bins[0] - 1
              stop_bin = corner_bins[-1] + 2
              # constrain the range
              if start_bin < 0:
                  start_bin = 0
              if stop_bin > num_bins:
                  stop_bin = num_bins
              # set mask
              mask[:, b] = np.amin(lgd[:, start_bin:stop_bin], axis=1)
      except AttributeError:
          # if the spectrogram is not filtered, use a simple minimum filter
          # covering only the current bin and its neighbours
          mask = minimum_filter(lgd, size=[1, 3])
      # sum all positive 1st order max. filtered and weighted differences
      diff = spectrogram.diff(
          diff_frames=diff_frames,
          diff_max_bins=diff_max_bins,
          positive_diffs=True,
      )
      return np.asarray(np.sum(diff * mask, 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 7 for calling a global function with example usage: complex_flux(spectrogram, diff_frames, diff_max_bins, temporal_filter, temporal_origin) and returns: np