class_docstr: Generic histogram class for real numbers
  
  Example:
  
      >>> h = Histogram(5)     # Initializing, bin width = 5
      >>> h << [2,3,2,7,8,5,5,0,7,9]     # Adding more items
      >>> print(h)
      N = 10, mean +- sd: 4.8000 +- 2.9740
      [ 0,  5): **** (4)
      [ 5, 10): ****** (6)
docstr: Returns the bin index corresponding to the given number.
  
  @param num: the number for which the bin is being sought
  @param create: whether to create a new bin if no bin exists yet.
  @return: the index of the bin or C{None} if no bin exists yet and
    {create} is C{False}.
docstr_tok: ["Returns","the","bin","index","corresponding","to","the","given","number",".","@","param","num",":","the","number","for","which","the","bin","is","being","sought","@","param","create",":","whether","to","create","a","new","bin","if","no","bin","exists","yet",".","@","return",":","the","index","of","the","bin","or","C","{","None","}","if","no","bin","exists","yet","and","{","create","}","is","C","{","False","}","."]
code: def _get_bin(self, num, create=False):
      """Returns the bin index corresponding to the given number.
  
      @param num: the number for which the bin is being sought
      @param create: whether to create a new bin if no bin exists yet.
      @return: the index of the bin or C{None} if no bin exists yet and
        {create} is C{False}."""
      if len(self._bins) == 0:
          if not create:
              result = None
          else:
              self._min = int(num / self._bin_width) * self._bin_width
              self._max = self._min + self._bin_width
              self._bins = [0]
              result = 0
          return result
  
      if num >= self._min:
          binidx = int((num - self._min) / self._bin_width)
          if binidx < len(self._bins):
              return binidx
          if not create:
              return None
          extra_bins = binidx - len(self._bins) + 1
          self._bins.extend([0] * extra_bins)
          self._max = self._min + len(self._bins) * self._bin_width
          return binidx
  
      if not create:
          return None
  
      extra_bins = int(math.ceil((self._min - num) / self._bin_width))
      self._bins[0:0] = [0] * extra_bins
      self._min -= extra_bins * self._bin_width
      self._max = self._min + len(self._bins) * self._bin_width
      return 0
  
imports: import math
label_desc: Use image node_id 2 for calling the Histogram obj's underlying member method code with example usage: obj._get_bin(num, create) and returns: int, result, binidx, None, binidx, None