code: def ks_test(hist_1, hist_2):
      """KS-test for two histograms with different number of entries
  
      Copyright ROOT:
      Formulas translated from c++ to python, but formulas otherwise not modified.
      Reference: link: https://root.cern.ch/doc/master/classTH1.html#TH1:KolmogorovTest
      GNU license: https://root.cern.ch/license
      All modifications copyright INGA WB.
  
      :param hist_1: 1D array with bin counts of the histogram_1
      :param hist_2: 1D array with bin counts of the histogram_2
  
      :return: ks_score: Kolmogorov-Smirnov Test score
      :rtype: float
      """
      if len(hist_1) == 0 or len(hist_2) == 0:
          raise ValueError("Input histogram(s) has zero size.")
      if len(hist_1) != len(hist_2):
          raise ValueError("Input histograms have unequal size.")
  
      sum_1 = np.sum(hist_1)
      sum_2 = np.sum(hist_2)
      if sum_1 == 0 or sum_2 == 0:
          return np.nan
  
      normalized_cumsum_1 = np.cumsum(hist_1) / sum_1
      normalized_cumsum_2 = np.cumsum(hist_2) / sum_2
  
      d = np.abs(normalized_cumsum_1 - normalized_cumsum_2)
  
      return np.max(d) * np.sqrt(sum_1 * sum_2 / (sum_1 + sum_2))
  
file_path: popmon/popmon/analysis/comparison/comparisons.py
imports: import numpy
  from scipy import stats
  from popmon.base.registry import Registry
label_desc: Use image node_id 5 for calling a global function with example usage: ks_test(hist_1, hist_2) and returns: unknown, np