nodes: 0, module; 1, function_definition; 2, function_name:fourier_series; 3, parameters; 4, block; 5, identifier:self; 6, identifier:pars; 7, identifier:x; 8, identifier:order; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, comment:"""
          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.
          """; 14, assignment; 15, identifier:i; 16, call; 17, block; 18, identifier:sum; 19, identifier:sum; 20, subscript; 21, identifier:range; 22, argument_list; 23, expression_statement; 24, identifier:pars; 25, integer:0; 26, identifier:order; 27, augmented_assignment; 28, identifier:sum; 29, binary_operator:pars[i * 2 + 1] * np.sin(2 * np.pi * (i + 1) * x) \
                     + pars[i * 2 + 2] * np.cos(2 * np.pi * (i + 1) * x); 30, binary_operator:pars[i * 2 + 1] * np.sin(2 * np.pi * (i + 1) * x); 31, line_continuation:\; 32, binary_operator:pars[i * 2 + 2] * np.cos(2 * np.pi * (i + 1) * x); 33, subscript; 34, call; 35, subscript; 36, call; 37, identifier:pars; 38, binary_operator:i * 2 + 1; 39, attribute; 40, argument_list; 41, identifier:pars; 42, binary_operator:i * 2 + 2; 43, attribute; 44, argument_list; 45, binary_operator:i * 2; 46, integer:1; 47, identifier:np; 48, identifier:sin; 49, binary_operator:2 * np.pi * (i + 1) * x; 50, binary_operator:i * 2; 51, integer:2; 52, identifier:np; 53, identifier:cos; 54, binary_operator:2 * np.pi * (i + 1) * x; 55, identifier:i; 56, integer:2; 57, binary_operator:2 * np.pi * (i + 1); 58, identifier:x; 59, identifier:i; 60, integer:2; 61, binary_operator:2 * np.pi * (i + 1); 62, identifier:x; 63, binary_operator:2 * np.pi; 64, parenthesized_expression; 65, binary_operator:2 * np.pi; 66, parenthesized_expression; 67, integer:2; 68, attribute; 69, binary_operator:i + 1; 70, integer:2; 71, attribute; 72, binary_operator:i + 1; 73, identifier:np; 74, identifier:pi; 75, identifier:i; 76, integer:1; 77, identifier:np; 78, identifier:pi; 79, identifier:i; 80, integer:1
code: def fourier_series(self, pars, x, order):
          """
          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.
          """
  
          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