code: def fourier_basis(freq):
      """sin and cos Formula for Fourier drift
  
      The Fourier basis consists of sine and cosine waves of given
      frequencies.
  
      Parameters
      ----------
      freq : sequence of float
          Frequencies for the terms in the Fourier basis.
  
      Returns
      -------
      f : Formula
  
      Examples
      --------
      >>> f=fourier_basis([1,2,3])
      >>> f.terms
      array([cos(2*pi*t), sin(2*pi*t), cos(4*pi*t), sin(4*pi*t), cos(6*pi*t),
             sin(6*pi*t)], dtype=object)
      >>> f.mean
      _b0*cos(2*pi*t) + _b1*sin(2*pi*t) + _b2*cos(4*pi*t) + _b3*sin(4*pi*t) + _b4*cos(6*pi*t) + _b5*sin(6*pi*t)
      """
      r = []
      for f in freq:
          r += [
              sympy.cos(2 * sympy.pi * f * T),
              sympy.sin(2 * sympy.pi * f * T),
          ]
      return Formula(r)
  
imports: import itertools
  import numpy
  import sympy
  from scipy.interpolate import interp1d
  from sympy import DiracDelta, Symbol
  from sympy.utilities.lambdify import implemented_function, lambdify
  from nipy.algorithms.statistics.formula.formulae import Formula, Term
label_desc: Use image node_id 3 for calling a global function with example usage: fourier_basis(freq) and returns: Formula