code: def mex_hat(x, sigma):
      r
  
      x = check_float(x)
      sigma = check_float(sigma)
  
      xs = (x / sigma) ** 2
      val = 2 * (3 * sigma) ** -0.5 * np.pi ** -0.25
  
      return val * (1 - xs) * np.exp(-0.5 * xs)
docs: r"""Mexican hat
  
      This method implements a Mexican hat (or Ricker) wavelet.
  
      Parameters
      ----------
      x : float
          Input data point
      sigma : float
          Standard deviation (filter scale)
  
      Returns
      -------
      float Mexican hat filtered data point
  
      Examples
      --------
      >>> from modopt.signal.filter import mex_hat
      >>> mex_hat(2, 1)
      -0.35213905225713371