docs: def kde_gauss(events_x, events_y, xout=None, yout=None):
      """ Gaussian Kernel Density Estimation
  
      Parameters
      ----------
      events_x, events_y: 1D ndarray
          The input points for kernel density estimation. Input
          is flattened automatically.
      xout, yout: ndarray
          The coordinates at which the KDE should be computed.
          If set to none, input coordinates are used.
  
      Returns
      -------
      density: ndarray, same shape as `xout`
          The KDE for the points in (xout, yout)
  
      See Also
      --------
      `scipy.stats.gaussian_kde`
      """
      valid_combi = ((xout is None and yout is None) or
                     (xout is not None and yout is not None)
                     )
      if not valid_combi:
          raise ValueError("Both `xout` and `yout` must be (un)set.")
  
      if yout is None and yout is None:
          xout = events_x
          yout = events_y
  
      try:
          estimator = gaussian_kde([events_x.flatten(), events_y.flatten()])
          density = estimator.evaluate([xout.flatten(), yout.flatten()])
      except np.linalg.LinAlgError:
          # LinAlgError occurs when matrix to solve is singular (issue #117)
          density = np.zeros(xout.shape)*np.nan
      return density.reshape(xout.shape)