code: def _generate_noise_temporal_task(stimfunction_tr,
                                    motion_noise='gaussian',
                                    ):
      
  
      # 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
docs: 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