docs: def scenario_damage(fragility_functions, gmvs):
      """
      :param fragility_functions: a list of D - 1 fragility functions
      :param gmvs: an array of E ground motion values
      :returns: an array of (D, E) damage fractions
      """
      lst = [numpy.ones_like(gmvs)]
      for f, ff in enumerate(fragility_functions):  # D - 1 functions
          lst.append(ff(gmvs))
      lst.append(numpy.zeros_like(gmvs))
      # convert a (D + 1, E) array into a (D, E) array
      arr = pairwise_diff(numpy.array(lst))
      arr[arr < 1E-7] = 0  # sanity check
      return arr