code: def get_consistent_numpy_1dhists(
      hist_list, get_bin_labels: bool = False, crop_range: bool = False
  ):
      """Get list of consistent numpy hists for list of sparse (or bin) input histograms
  
      Works for sparse and bin histograms.
      Note: for sparse histograms, all potential bins between low and high are picked up (also unfilled).
  
      Note: a numpy histogram is a union of lists of bin_edges and number of entries
      This gives the full range of bin_centers, including zeros, which is not robust against (extreme) outliers.
      Ideally, use this for plotting of multiple histograms only.
  
      :param list hist_list: list of input histogram objects
      :param bool get_bin_labels: return bin labels as well, default is false.
      :param bool crop_range: return a trimmed version of the histogram, between 5-95% quantiles.
      :return: list of consistent 1d numpy hists for list of sparse input histograms
      """
      # --- basic checks
      if len(hist_list) == 0:
          raise ValueError("Input histogram list has zero length.")
      assert_similar_hists(hist_list)
  
      low_arr = [hist.low for hist in hist_list if hist.low is not None]
      high_arr = [
          hist.high for hist in hist_list if hist.high is not None
      ]
  
      low = min(low_arr) if len(low_arr) > 0 else None
      high = max(high_arr) if len(high_arr) > 0 else None
      # low == None and/or high == None can only happen when all input hists are empty.
  
      if crop_range:
          # crop_range option crops a histogram to reasonable range, e.g. for plotting, giving nice plots.
          # in particular this protects against outliers that distort the view on the core part of the distribution
          # range is quantiles 5-95% + 5% on both sides
          q05_arr = []
          q95_arr = []
          for hist in hist_list:
              bin_centers, values = get_bin_centers(hist)
              bin_entries = np.array([v.entries for v in values])
              qs = quantile(bin_centers, [0.05, 0.95], bin_entries)
              q05_arr.append(qs[0])
              q95_arr.append(qs[1])
          q05 = min(q05_arr) if len(q05_arr) > 0 else np.nan
          q95 = max(q95_arr) if len(q95_arr) > 0 else np.nan
          delta = q95 - q05
          var_min = q05 - (0.06 / 0.9) * delta
          var_max = q95 + (0.06 / 0.9) * delta
          if 0.0 < var_min < 0.2 * delta:
              var_min = 0.0
          elif -0.2 * delta < var_max < 0.0:
              var_max = 0.0
          if (
              not np.isnan(var_min)
              and low is not None
              and var_min > low
          ):
              low = var_min
          if (
              not np.isnan(var_max)
              and high is not None
              and var_max < high
          ):
              high = var_max
  
      # if one of the input histograms is sparse and empty, copy the bin-edges and bin-centers
      # from a filled histogram, and use empty bin-entries array
      # MB 20220601: note this gives the full range of bin_centers, which is not robust against (extreme) outliers
      #              get_consistent_numpy_entries() ignores all empty bins.
      bin_edges = [0.0, 1.0]
      bin_centers = [0.5]
      null_entries = [0.0]
      if low is not None and high is not None:
          for hist in hist_list:
              if hist.low is not None and hist.high is not None:
                  bin_edges = hist.bin_edges(low, high)
                  bin_centers = hist.bin_centers(low, high)
                  null_entries = np.zeros(len(bin_centers))
                  break
  
      nphist_list = []
      for hist in hist_list:
          bin_entries = (
              null_entries
              if (hist.low is None and hist.high is None)
              else hist.bin_entries(low, high)
          )
          nphist_list.append((bin_entries, bin_edges))
  
      if get_bin_labels:
          return nphist_list, bin_centers
      else:
          return nphist_list
  
imports: from __future__ import annotations
  import warnings
  import histogrammar
  import numpy
  from histogrammar.util import get_hist_props
  from popmon.hist.hist_utils import get_bin_centers, is_numeric
  from popmon.stats.numpy import quantile
label_desc: Use image node_id 9 for calling a global function with example usage: get_consistent_numpy_1dhists(hist_list, get_bin_labels, crop_range) and returns: nphist_list,  bin_centers, nphist_list