code: def find_ab_params(spread, min_dist):
      
  
      def curve(x, a, b):
          return 1.0 / (1.0 + a * x ** (2 * b))
  
      xv = np.linspace(0, spread * 3, 300)
      yv = np.zeros(xv.shape)
      yv[xv < min_dist] = 1.0
      yv[xv >= min_dist] = np.exp(-(xv[xv >= min_dist] - min_dist) / spread)
      params, covar = curve_fit(curve, xv, yv)
      return params[0], params[1]
docs: Fit a, b params for the differentiable curve used in lower
      dimensional fuzzy simplicial complex construction. We want the
      smooth curve (from a pre-defined family with simple gradient) that
      best matches an offset exponential decay.