code: def d2_func(x, y, z):
      '''
      #=================================================
      /poly fit for every SF grid data
      #=================================================
      '''
      X, Y = np.meshgrid(x, y, copy=False)
      X = X.flatten()
      Y = Y.flatten()
      A = np.array([np.ones(len(X)), X, X**2, Y, Y**2, X*Y]).T
      Z = np.array(z)
      B = Z.flatten()
      # print(A.shape,B.shape)
      coeff, r, rank, s = np.linalg.lstsq(A, B, rcond=None)
      return -coeff[5f d2_func(x, y, z):
      '''
      #=================================================
      /poly fit for every SF grid data
      #=================================================
      '''
      X, Y = np.meshgrid(x, y, copy=False)
      X = X.flatten()
      Y = Y.flatten()
      A = np.array([np.ones(len(X)), X, X**2, Y, Y**2, X*Y]).T
      Z = np.array(z)
      B = Z.flatten()
      # print(A.shape,B.shape)
      coeff, r, rank, s = np.linalg.lstsq(A, B, rcond=None)
      return -coeff[5]
docs: #=================================================
      /poly fit for every SF grid data
      #=================================================