code: def create_cosine_drift(high_pass, frame_times):
      """Create a cosine drift matrix with frequencies or equal to high_pass.
  
      Parameters
      ----------
      high_pass : float
          Cut frequency of the high-pass filter in Hz
  
      frame_times : array of shape (n_scans,)
          The sampling times in seconds
  
      Returns
      -------
      cosine_drift : array of shape(n_scans, n_drifts)
          Cosine drifts plus a constant regressor at cosine_drift[:, -1]
  
      References
      ----------
      http://en.wikipedia.org/wiki/Discrete_cosine_transform DCT-II
  
      """
      n_frames = len(frame_times)
      n_times = np.arange(n_frames)
      dt = (frame_times[-1] - frame_times[0]) / (n_frames - 1)
      if high_pass * dt >= 0.5:
          warn(
              "High-pass filter will span all accessible frequencies "
              "and saturate the design matrix. "
              "You may want to reduce the high_pass value."
              f"The provided value is {high_pass} Hz"
          )
      order = np.minimum(
          n_frames - 1, int(np.floor(2 * n_frames * high_pass * dt))
      )
      cosine_drift = np.zeros((n_frames, order + 1))
      normalizer = np.sqrt(2.0 / n_frames)
  
      for k in range(1, order + 1):
          cosine_drift[:, k - 1] = normalizer * np.cos(
              (np.pi / n_frames) * (n_times + 0.5) * k
          )
  
      cosine_drift[:, -1] = 1.0
      return cosine_drift
  
file_path: nilearn/nilearn/glm/first_level/design_matrix.py
imports: import sys
  from warnings import warn
  import numpy
  import pandas
  from nilearn._utils import fill_doc
  from nilearn.glm._utils import full_rank
  from nilearn.glm.first_level.experimental_paradigm import check_events, handle_modulation_of_duplicate_events
  from nilearn.glm.first_level.hemodynamic_models import compute_regressor, orthogonalize
label_desc: Use image node_id 2 for calling a global function with example usage: create_cosine_drift(high_pass, frame_times) and returns: cosine_drift