parameters: (self, compression_bps, bucket_limit, cumsum_weights,
                    histo_min, histo_max, histo_num)
return_statement: return histo_max
docstring: Linearly interpolates a histogram weight for a particular basis point.
  
      Uses clamping methods on `histo_min` and `histo_max` to produce tight
      linear estimates of the histogram weight at a particular basis point.
  
      Args:
        compression_bps: The desired basis point at which to estimate the weight
        bucket_limit: An array of the RHS histogram bucket limits
        cumsum_weights: A cumulative sum of the fraction of weights in each
          histogram bucket, represented in basis points.
        histo_min: The minimum weight observed in the weight histogram
        histo_max: The maximum weight observed in the weight histogram
        histo_num: The number of items in the weight histogram
  
      Returns:
        A linearly interpolated value of the histogram weight estimate.
docstring_summary: Linearly interpolates a histogram weight for a particular basis point.
docstring_tokens: Linearly interpolates a histogram weight for a particular basis point .
function: def _Percentile(self, compression_bps, bucket_limit, cumsum_weights,
                    histo_min, histo_max, histo_num):
      """Linearly interpolates a histogram weight for a particular basis point.
  
      Uses clamping methods on `histo_min` and `histo_max` to produce tight
      linear estimates of the histogram weight at a particular basis point.
  
      Args:
        compression_bps: The desired basis point at which to estimate the weight
        bucket_limit: An array of the RHS histogram bucket limits
        cumsum_weights: A cumulative sum of the fraction of weights in each
          histogram bucket, represented in basis points.
        histo_min: The minimum weight observed in the weight histogram
        histo_max: The maximum weight observed in the weight histogram
        histo_num: The number of items in the weight histogram
  
      Returns:
        A linearly interpolated value of the histogram weight estimate.
      """
      if histo_num == 0:
        return 0
  
      for i, cumsum in enumerate(cumsum_weights):
        if cumsum >= compression_bps:
          cumsum_prev = cumsum_weights[i - 1] if i > 0 else 0
          # Prevent cumsum = 0, cumsum_prev = 0, lerp divide by zero.
          if cumsum == cumsum_prev:
            continue
  
          # Calculate the lower bound of interpolation
          lhs = bucket_limit[i - 1] if (i > 0 and cumsum_prev > 0) else histo_min
          lhs = max(lhs, histo_min)
  
          # Calculate the upper bound of interpolation
          rhs = bucket_limit[i]
          rhs = min(rhs, histo_max)
  
          weight = _Remap(compression_bps, cumsum_prev, cumsum, lhs, rhs)
          return weight
  
      ## We have not exceeded cumsum, so return the max observed.
      return histo_max
function_tokens: def _Percentile ( self , compression_bps , bucket_limit , cumsum_weights , histo_min , histo_max , histo_num ) : if histo_num == 0 : return 0 for i , cumsum in enumerate ( cumsum_weights ) : if cumsum >= compression_bps : cumsum_prev = cumsum_weights [ i - 1 ] if i > 0 else 0 # Prevent cumsum = 0, cumsum_prev = 0, lerp divide by zero. if cumsum == cumsum_prev : continue # Calculate the lower bound of interpolation lhs = bucket_limit [ i - 1 ] if ( i > 0 and cumsum_prev > 0 ) else histo_min lhs = max ( lhs , histo_min ) # Calculate the upper bound of interpolation rhs = bucket_limit [ i ] rhs = min ( rhs , histo_max ) weight = _Remap ( compression_bps , cumsum_prev , cumsum , lhs , rhs ) return weight ## We have not exceeded cumsum, so return the max observed. return histo_max