code: def probability_distribution_mean_covariance(entries_list):
      """Mean normalized histogram and covariance of list of input histograms
  
      :param entries_list: numpy 2D array shape (n_histos, n_bins,) with bin counts of histograms
      :return: mean normalized histogram, covariance probability matrix
      """
      if len(entries_list) == 0:
          raise ValueError("List of input histogram entries is empty.")
  
      entries_list = np.atleast_2d(entries_list)
      n_histos = entries_list.shape[0]
  
      if n_histos == 1:
          # catch potential empty histogram
          if np.sum(entries_list[0]) == 0:
              return entries_list[0], None
          norm_hist_mean = entries_list[0] / np.sum(entries_list[0])
          return norm_hist_mean, None
  
      # At least two histograms from here on ...
      # Normalize the histograms along the bin axis, so that histograms with different number of entries
      # are still comparable
      normed_list = entries_list / (
          np.sum(entries_list, axis=1, dtype=float)[:, np.newaxis]
          + np.finfo(float).eps
      )
  
      # Determine the mean histogram (unbiased)
      norm_hist_mean = np.sum(normed_list, axis=0) / n_histos
  
      # For each histogram determine the second moment (i.e. mean of the product of two bins entries)
      # of all the other histograms
      cross_entries = (
          normed_list[:, :, np.newaxis] * normed_list[:, np.newaxis, :]
      )
      sum2_cross_entries = np.sum(cross_entries, axis=0) / n_histos
  
      # Determine the unbiased covariance matrices between bins for all the histograms.
      # note: use one degree of freedom less because of we're using the evaluated mean as input
      norm_hist_cov = (
          sum2_cross_entries
          - norm_hist_mean[:, np.newaxis]
          * norm_hist_mean[np.newaxis, :]
      ) * (n_histos / (n_histos - 1))
  
      return norm_hist_mean, norm_hist_cov
  
file_path: popmon/popmon/stats/numpy.py
imports: import numpy
  import pandas
label_desc: Use image node_id 5 for calling a global function with example usage: probability_distribution_mean_covariance(entries_list) and returns: norm_hist_mean,  norm_hist_cov, norm_hist_mean,  None, entries_list,  None