code: def _noise_dict_update(noise_dict):
      """
      Update the noise dictionary parameters with default values, in case any
      were missing
  
      Parameters
      ----------
  
      noise_dict : dict
          A dictionary specifying the types of noise in this experiment. The
          noise types interact in important ways. First, autoregressive,
          physiological and task-based noise types are mixed together in
          _generate_temporal_noise. The parameter values for 'auto_reg_sigma',
          'physiological_sigma' and 'task_sigma' describe the proportion of
          mixing of these elements, respectively. However critically, 'SFNR' is
          the parameter that controls how much noise these components contribute
          to the brain. 'auto_reg_rho' and 'ma_rho' set parameters for the
          autoregressive noise being simulated. Second, drift noise is added to
          this, according to the size of 'drift_sigma'. Thirdly, system noise is
          added based on the 'SNR' parameter. Finally, 'fwhm' is used to estimate
          the smoothness of the noise being inserted. If 'matched' is set to
          true, then it will fit the parameters to match the participant as best
          as possible.
  
          Variables defined as follows:
  
          snr [float]: Ratio of MR signal to the spatial noise
          sfnr [float]: Ratio of the MR signal to the temporal noise. This is the
          total variability that the following sigmas 'sum' to:
  
          task_sigma [float]: Size of the variance of task specific noise
          auto_reg_sigma [float]: Size of the variance of autoregressive
          noise. This is an ARMA process where the AR and MA components can be
          separately specified
          physiological_sigma [float]: Size of the variance of physiological
          noise
  
          drift_sigma [float]: Size of the variance of drift noise
  
          auto_reg_rho [list]: The coefficients of the autoregressive
          components you are modeling
          ma_rho [list]:The coefficients of the moving average components you
          are modeling
          max_activity [float]: The max value of the averaged brain in order
          to reference the template
          voxel_size [list]: The mm size of the voxels
          fwhm [float]: The gaussian smoothing kernel size (mm)
          matched [bool]: Specify whether you are fitting the noise parameters
  
          The volumes of brain noise that are generated have smoothness
          specified by 'fwhm'
  
      Returns
      -------
  
      noise_dict : dict
          Updated dictionary
  
      """
      # Create the default dictionary
      default_dict = {
          "task_sigma": 0,
          "drift_sigma": 0,
          "auto_reg_sigma": 1,
          "auto_reg_rho": [0.5],
          "ma_rho": [0.0],
          "physiological_sigma": 0,
          "sfnr": 90,
          "snr": 50,
          "max_activity": 1000,
          "voxel_size": [1.0, 1.0, 1.0],
          "fwhm": 4,
          "matched": 1,
      }
  
      # Check what noise is in the dictionary and add if necessary. Numbers
      # determine relative proportion of noise
      for default_key in default_dict:
          if default_key not in noise_dict:
              noise_dict[default_key] = default_dict[default_key]
  
      return noise_dict
  
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 23 for calling a global function with example usage: _noise_dict_update(noise_dict) and returns: noise_dict