class_docstr: Aubio Temporal analyzer
class_docstr_tok: ["Aubio","Temporal","analyzer"]
code: def post_process(self):
      # ---------------------------------
      #  Onsets: Event (time, "Onset")
      # ---------------------------------
      onsets = self.new_result(data_mode="label", time_mode="event")
      onsets.id_metadata.id += "." + "onset"
      onsets.id_metadata.name += " " + "Onset"
      onsets.id_metadata.unit = "s"
      onsets.data_object.time = self.onsets
      onsets.data_object.label = np.ones(len(self.onsets))
      onsets.data_object.label_metadata.label = {1: "Onset"}
  
      self.add_result(onsets)
  
      # ---------------------------------
      #  Onset Rate: Segment (time, duration, value)
      # ---------------------------------
      onsetrate = self.new_result(
          data_mode="value", time_mode="segment"
      )
      onsetrate.id_metadata.id += "." + "onset_rate"
      onsetrate.id_metadata.name = " " + "Onset Rate"
      onsetrate.id_metadata.unit = "bpm"
      if len(self.onsets) > 1:
          periods = np.diff(self.onsets)
          periods = np.append(periods, periods[-1])
          onsetrate.data_object.time = self.onsets
          onsetrate.data_object.duration = periods
          onsetrate.data_object.value = 60.0 / periods
      else:
          onsetrate.data_object.value = []
          onsetrate.data_object.time = []
  
      self.add_result(onsetrate)
  
      # ---------------------------------
      #  Beats: Event (time, "Beat")
      # ---------------------------------
      beats = self.new_result(data_mode="label", time_mode="event")
      beats.id_metadata.id += "." + "beat"
      beats.id_metadata.name += " " + "Beats"
      beats.id_metadata.unit = "s"
      beats.data_object.time = self.beats
      beats.data_object.label = np.ones(len(self.beats))
      beats.data_object.label_metadata.label = {1: "Beat"}
  
      self.add_result(beats)
  
      # ---------------------------------
      #  Beat confidences: Event (time, value)
      # ---------------------------------
      beat_confidences = self.new_result(
          data_mode="value", time_mode="event"
      )
      beat_confidences.id_metadata.id += "." + "beat_confidence"
      beat_confidences.id_metadata.name += " " + "Beat confidences"
      beat_confidences.id_metadata.unit = None
      beat_confidences.data_object.time = self.beats
      beat_confidences.data_object.value = self.beat_confidences
  
      self.add_result(beat_confidences)
  
      # ---------------------------------
      #  BPM: Segment (time, duration, value)
      # ---------------------------------
      bpm = self.new_result(data_mode="value", time_mode="segment")
      bpm.id_metadata.id += "." + "bpm"
      bpm.id_metadata.name += " " + "bpm"
      bpm.id_metadata.unit = "bpm"
      if len(self.beats) > 1:
          periods = np.diff(self.beats)
          periods = np.append(periods, periods[-1])
          bpm.data_object.time = self.beats
          bpm.data_object.duration = periods
          bpm.data_object.value = 60.0 / periods
      else:
          bpm.data_object.value = []
  
      self.add_result(bpm)
  
file_path: TimeSide/timeside/plugins/analyzer/externals/aubio_temporal.py
imports: from __future__ import absolute_import
  from timeside.core import implements, interfacedoc
  from timeside.core.analyzer import Analyzer
  from timeside.core.api import IAnalyzer
  from timeside.core.preprocessors import downmix_to_mono, frames_adapter
  from aubio import onset, tempo
  import numpy
label_desc: Use image node_id 8 for calling the AubioTemporal obj's underlying member method code with example usage: obj.post_process() without return types