code: def funk(p, x, y):
      
      alpha=p[0]
      beta=p[1]
      dev=0
      for i in range(len(x)):
        dev=dev+((y[i]-(alpha*math.tanh(beta*x[i])))**2)
      rms=math.sqrt(old_div(dev,float(len(y))))
      return rms
docs: Function misfit evaluation for best-fit tanh curve
      f(x[:]) = alpha*tanh(beta*x[:])
          alpha = params[0]
          beta = params[1]
      funk(params) = sqrt(sum((y[:] - f(x[:]))**2)/len(y[:]))
      Output is RMS misfit
        x=xx[0][:]
        y=xx[1][:]q