docs: def _calc_ML(sampler, modelidx=0, e_range=None, e_npoints=100):
      """Get ML model from blob or compute them from chain and sampler.modelfn
      """
  
      ML, MLp, MLerr, ML_model = find_ML(sampler, modelidx)
  
      if e_range is not None:
          # prepare bogus data for calculation
          e_range = validate_array(
              "e_range", u.Quantity(e_range), physical_type="energy"
          )
          e_unit = e_range.unit
          energy = (
              np.logspace(
                  np.log10(e_range[0].value),
                  np.log10(e_range[1].value),
                  e_npoints,
              )
              * e_unit
          )
          data = {
              "energy": energy,
              "flux": np.zeros(energy.shape) * sampler.data["flux"].unit,
          }
          modelout = sampler.modelfn(MLp, data)
  
          if isinstance(modelout, np.ndarray):
              blob = modelout
          else:
              blob = modelout[modelidx]
  
          if isinstance(blob, u.Quantity):
              modelx = data["energy"].copy()
              model_ML = blob.copy()
          elif len(blob) == 2:
              modelx = blob[0].copy()
              model_ML = blob[1].copy()
          else:
              raise TypeError("Model {0} has wrong blob format".format(modelidx))
  
          ML_model = (modelx, model_ML)
  
      return ML, MLp, MLerr, ML_model