class_docstr: Running mean calculator.
  
  This class can be used to calculate the mean of elements from a
  list, tuple, iterable or any other data source. The mean is
  calculated on the fly without explicitly summing the values,
  so it can be used for data sets with arbitrary item count. Also
  capable of returning the standard deviation (also calculated on
  the fly)
docstr: RunningMean(items=None, n=0.0, mean=0.0, sd=0.0)
  
  Initializes the running mean calculator.
  
  There are two possible ways to initialize the calculator.
  First, one can provide an iterable of items; alternatively,
  one can specify the number of items, the mean and the
  standard deviation if we want to continue an interrupted
  calculation.
  
  @param items: the items that are used to initialize the
    running mean calcuator. If C{items} is given, C{n},
    C{mean} and C{sd} must be zeros.
  @param n: the initial number of elements already processed.
    If this is given, C{items} must be C{None}.
  @param mean: the initial mean. If this is given, C{items}
    must be C{None}.
  @param sd: the initial standard deviation. If this is given,
    C{items} must be C{None}.
docstr_tok: ["RunningMean","(","items=None",",","n=0.0",",","mean=0.0",",","sd=0.0",")","Initializes","the","running","mean","calculator",".","There","are","two","possible","ways","to","initialize","the","calculator",".","First",",","one","can","provide","an","iterable","of","items",";","alternatively",",","one","can","specify","the","number","of","items",",","the","mean","and","the","standard","deviation","if","we","want","to","continue","an","interrupted","calculation",".","@","param","items",":","the","items","that","are","used","to","initialize","the","running","mean","calcuator",".","If","C","{","items","}","is","given",",","C","{","n","}",",","C","{","mean","}","and","C","{","sd","}","must","be","zeros",".","@","param","n",":","the","initial","number","of","elements","already","processed",".","If","this","is","given",",","C","{","items","}","must","be","C","{","None","}",".","@","param","mean",":","the","initial","mean",".","If","this","is","given",",","C","{","items","}","must","be","C","{","None","}",".","@","param","sd",":","the","initial","standard","deviation",".","If","this","is","given",",","C","{","items","}","must","be","C","{","None","}","."]
code: def __init__(self, items=None, n=0.0, mean=0.0, sd=0.0):
      """RunningMean(items=None, n=0.0, mean=0.0, sd=0.0)
  
      Initializes the running mean calculator.
  
      There are two possible ways to initialize the calculator.
      First, one can provide an iterable of items; alternatively,
      one can specify the number of items, the mean and the
      standard deviation if we want to continue an interrupted
      calculation.
  
      @param items: the items that are used to initialize the
        running mean calcuator. If C{items} is given, C{n},
        C{mean} and C{sd} must be zeros.
      @param n: the initial number of elements already processed.
        If this is given, C{items} must be C{None}.
      @param mean: the initial mean. If this is given, C{items}
        must be C{None}.
      @param sd: the initial standard deviation. If this is given,
        C{items} must be C{None}."""
      if items is not None:
          if n != 0 or mean != 0 or sd != 0:
              raise ValueError(
                  "n, mean and sd must be zeros if items is not None"
              )
          self.clear()
          self.add_many(items)
      else:
          self._nitems = float(n)
          self._mean = float(mean)
          if n > 1:
              self._sqdiff = float(sd) ** 2 * float(n - 1)
              self._sd = float(sd)
          else:
              self._sqdiff = 0.0
              self._sd = 0.0
  
imports: import math
label_desc: Use image node_id 1 to create a new RunningMean object  with example: obj = RunningMean(items, n, mean, sd)