def d(percent)
      raise RangeError, "Argument 'percent' must be in the range [0-100]." if percent.to_f < 0 or percent.to_f > 100
      d_index = ((@doses.length - 1) * (1 - percent.to_f * 0.01)).round
      return @doses[d_index]
    end
def d(percent)
      raise RangeError, "Argument 'percent' must be in the range [0-100]." if percent.to_f < 0 or percent.to_f > 100
      d_index = ((@doses.length - 1) * (1 - percent.to_f * 0.01)).round
      return @doses[d_index]
    end
Calculates the dose that at least the specified
 percentage of the volume receives.

 @param [#to_f] percent a percentage (number in the range 0-100)
 @return [Float] the corresponding dose (in units of Gy)
 @example Calculate the near minimum dose (e.g. up to 2 % of the volume receives a dose less than this):
   near_min = ptv_distribution.d(98)
 @example Calculate the near maximum dose (e.g. at most 2 % of the volume receives a dose higher than this):
   near_max = ptv_distribution.d(2)