docs: def fit(self, SF, x_range, y_range, matrix_z):
          '''
          #=================================================
          /the main fitting process
          /xx,yy,zz = Hb,Ha,p
          /p is the FORC distribution
          /m0,n0 is the index of values on Ha = Hb
          /then loop m0 and n0
          /based on smooth factor(SF)
          /select data grid from the matrix_z for curve fitting
          #=================================================
          '''
          xx, yy, zz = [], [], []
          m0, n0 = [], []
          for m, n in itertools.product(np.arange(0, len(x_range), step=SF), np.arange(0, len(y_range), step=SF)):
              if x_range[m] > y_range[n]:  # Ha nearly equal Hb
                  m0.append(m)
                  n0.append(n)
  
          aa, bb, cc = [], [], []
          for m, n in zip(m0, n0):
              s = 0
              try:
                  grid_data = []
                  a_ = x_range[m+s]
                  b_ = y_range[n-s]
                  for i, j in itertools.product(np.arange(3*SF+1), np.arange(3*SF+1)):
                      try:
                          grid_data.append(
                              [x_range[m+s+i], y_range[n-s-j], matrix_z.item(n-s-j, m+s+i)])
                      except:
                          try:
                              for i, j in itertools.product(np.arange(3), np.arange(3)):
                                  grid_data.append(
                                      [x_range[m+i], y_range[n-j], matrix_z.item(n-j, m+i)])
                          except:
                              pass
                  # print(grid_data)
                  '''
                  #=================================================
                  /when SF = n
                  /data grid as (2*n+1)x(2*n+1)
                  /grid_list: convert grid to list
                  /every grid produce on FORC distritution p
                  /the poly fitting use d2_func
                  #=================================================
                  '''
                  x, y, z = grid_list(grid_data)
                  try:
                      p = d2_func(x, y, z)
                      # print(p)
                      xx.append((a_-b_)/2)
                      yy.append((a_+b_)/2)
                      zz.append(p)
                  except Exception as e:
                      # print(e)
                      pass
              except:
                  pass
  
          '''
          #=================================================
          /the data will be save as pandas dataframe
          /all the data with nan values will be delete be dropna()
          #=================================================
          '''
          # print(zz)
          df = pd.DataFrame({'x': xx, 'y': yy, 'z': zz})
          #df = df.replace(0,np.nan)
          df = df.dropna()
          '''
          #=================================================
          /due to the space near Bc = zero
          /the Bi values when Bc <0.003 will be mirrored to -Bc
          #=================================================
          '''
          df_negative = df[(df.x < 0.03)].copy()
          df_negative.x = df_negative.x*-1
          df = df.append(df_negative)
          df = df.drop_duplicates(['x', 'y'])
          df = df.sort_values('x')
          # plt.scatter(df.x,df.y,c=df.z)
          # plt.show()
          '''
          #=================================================
          /reset the Bc and Bi range by X,Y
          /use linear interpolate to obtain FORC distribution
          #=================================================
          '''
          xrange = [0, int((np.max(df.x)+0.05)*10)/10]
          yrange = [int((np.min(df.y)-0.05)*10)/10,
                    int((np.max(df.y)+0.05)*10)/10]
          X = np.linspace(xrange[0], xrange[1], 200)
          Y = np.linspace(yrange[0], yrange[1], 200)
          self.yi, self.xi = np.mgrid[yrange[0]:yrange[1]:200j, xrange[0]:xrange[1]:200j]
  
          #self.xi,self.yi = np.mgrid[0:0.2:400j,-0.15:0.15:400j]
          z = df.z/np.max(df.z)
          z = np.asarray(z.tolist())
          self.zi = griddata((df.x, df.y), z, (self.xi, self.yi), method='cubic')