code: def _compute_f4(self, C, mag, rrup):
          
          fhw_m = 0
          fhw_r = np.zeros_like(rrup)
  
          if mag <= 5.5:
              fhw_m = 0
          elif 5.5 < mag < 6.5:
              fhw_m = mag - 5.5
          else:
              fhw_m = 1
  
          idx = (rrup > 4) & (rrup <= 8)
          fhw_r[idx] = C['a9'] * (rrup[idx] - 4.) / 4.
  
          idx = (rrup > 8) & (rrup <=18)
          fhw_r[idx] = C['a9']
  
          idx = (rrup > 18) & (rrup <= 24)
          fhw_r[idx] = C['a9'] * (1 - (rrup[idx] - 18.) / 7.)
  
          return fhw_m * fhw_r
docs: Compute f4 term (eq. 7, 8, and 9, page 106)