code: def _generate_noise_temporal_task(
      stimfunction_tr,
      motion_noise="gaussian",
  ):
      """Generate the signal dependent noise
  
      Create noise specific to the signal, for instance there is variability
      in how the signal manifests on each event
  
      Parameters
      ----------
  
      stimfunction_tr : 1 Dimensional array
          This is the timecourse of the stimuli in this experiment,
          each element represents a TR
  
      motion_noise : str
          What type of noise will you generate? Can be gaussian or rician
  
      Returns
      ----------
  
      noise_task : one dimensional array, float
          Generates the temporal task noise timecourse
  
      """
  
      # Make the noise to be added
      stimfunction_tr = stimfunction_tr != 0
      if motion_noise == "gaussian":
          noise = stimfunction_tr * np.random.normal(
              0, 1, size=stimfunction_tr.shape
          )
      elif motion_noise == "rician":
          noise = stimfunction_tr * stats.rice.rvs(
              0, 1, size=stimfunction_tr.shape
          )
  
      noise_task = stimfunction_tr + noise
  
      # Normalize
      noise_task = stats.zscore(noise_task).flatten()
  
      return noise_task
  
imports: import logging
  from itertools import product
  from statsmodels.tsa.arima.model import ARIMA
  import math
  import numpy
  from numpy.linalg import LinAlgError
  from pkg_resources import resource_stream
  from scipy import stats
  from scipy import signal
  import scipy.ndimage
  import copy
  from scipy import optimize
label_desc: Use image node_id 16 for calling a global function with example usage: _generate_noise_temporal_task(stimfunction_tr, motion_noise) and returns: noise_task