code: def _find_append_zero_crossings(x, y):
      r
      # Find and append crossings to the data
      crossings = find_intersections(x[1:], y[1:], np.zeros_like(y[1:]) * y.units)
      x = concatenate((x, crossings[0]))
      y = concatenate((y, crossings[1]))
  
      # Resort so that data are in order
      sort_idx = np.argsort(x)
      x = x[sort_idx]
      y = y[sort_idx]
  
      # Remove duplicate data points if there are any
      keep_idx = np.ediff1d(x, to_end=[1]) > 0
      x = x[keep_idx]
      y = y[keep_idx]
      return x, y
docs: r"""
      Find and interpolate zero crossings.
  
      Estimate the zero crossings of an x,y series and add estimated crossings to series,
      returning a sorted array with no duplicate values.
  
      Parameters
      ----------
      x : `pint.Quantity`
          x values of data
      y : `pint.Quantity`
          y values of data
  
      Returns
      -------
      x : `pint.Quantity`
          x values of data
      y : `pint.Quantity`
          y values of data