class_docstr: Buffer for processors which need context to do their processing.
  
  Parameters
  ----------
  buffer_size : int or tuple
      Size of the buffer (time steps, [additional dimensions]).
  init : numpy array, optional
      Init the buffer with this array.
  init_value : float, optional
      If only `buffer_size` is given but no `init`, use this value to
      initialise the buffer.
  
  Notes
  -----
  If `buffer_size` (or the first item thereof in case of tuple) is 1,
  only the un-buffered current value is returned.
  
  If context is needed, `buffer_size` must be set to >1.
  E.g. SpectrogramDifference needs a context of two frames to be able to
  compute the difference between two consecutive frames.
class_docstr_tok: ["Buffer","for","processors","which","need","context","to","do","their","processing",".","Parameters","--","--","--","--","--","buffer_size",":","int","or","tuple","Size","of","the","buffer","(","time","steps",",","[","additional","dimensions","]",")",".","init",":","numpy","array",",","optional","Init","the","buffer","with","this","array",".","init_value",":","float",",","optional","If","only","`","buffer_size","`","is","given","but","no","`","init","`",",","use","this","value","to","initialise","the","buffer",".","Notes","--","--","-","If","`","buffer_size","`","(","or","the","first","item","thereof","in","case","of","tuple",")","is","1",",","only","the","un-buffered","current","value","is","returned",".","If","context","is","needed",",","`","buffer_size","`","must","be","set","to",">","1",".","E.g",".","SpectrogramDifference","needs","a","context","of","two","frames","to","be","able","to","compute","the","difference","between","two","consecutive","frames","."]
docstr: Buffer the data.
  
  Parameters
  ----------
  data : numpy array or subclass thereof
      Data to be buffered.
  
  Returns
  -------
  numpy array or subclass thereof
      Data with buffered context.
  
  Notes
  -----
  If the length of data is the same as the buffer's length, the data of
  the buffer is completely overwritten by new data. If it exceeds the
  length, only the latest 'buffer_length' items of data are used.
code: def process(self, data, **kwargs):
      """
      Buffer the data.
  
      Parameters
      ----------
      data : numpy array or subclass thereof
          Data to be buffered.
  
      Returns
      -------
      numpy array or subclass thereof
          Data with buffered context.
  
      Notes
      -----
      If the length of data is the same as the buffer's length, the data of
      the buffer is completely overwritten by new data. If it exceeds the
      length, only the latest 'buffer_length' items of data are used.
  
      """
      # expected minimum number of dimensions
      ndmin = len(self.buffer_size)
      # cast the data to have that many dimensions
      if data.ndim < ndmin:
          data = np.array(data, copy=False, subok=True, ndmin=ndmin)
      # length of the data
      data_length = len(data)
      # if length of data exceeds buffer length simply replace buffer data
      if data_length >= self.buffer_length:
          self.data = data[-self.buffer_length :]
      else:
          # roll buffer by `data_length`, i.e. move data to the 'left'
          self.data = np.roll(self.data, -data_length, axis=0)
          # overwrite 'right' part with new data
          self.data[-data_length:] = data
      # return the complete buffer
      return self.data
  
imports: from __future__ import absolute_import, division, print_function
  import argparse
  import itertools
  import multiprocessing
  import os
  import sys
  from collections.abc import MutableSequence
  import numpy
  from .utils import integer_types
label_desc: Use image node_id 4 for calling the BufferProcessor obj's underlying member method code with example usage: obj.process(data) and returns: self