code: def fourier_series(self, pars, x, order):
          
  
          sum = pars[0]
          for i in range(order):
              sum += pars[i * 2 + 1] * np.sin(2 * np.pi * (i + 1) * x) \
                     + pars[i * 2 + 2] * np.cos(2 * np.pi * (i + 1) * x)
  
          return sum
docs: Function to fit Fourier Series.
  
          Parameters
          ----------
          x : array_like
              An array of date divided by period. It doesn't need to be sorted.
          pars :  array_like
              Fourier series parameters.
          order : int
              An order of Fourier series.