code: def _double_gamma_hrf(
      response_delay=6,
      undershoot_delay=12,
      response_dispersion=0.9,
      undershoot_dispersion=0.9,
      response_scale=1,
      undershoot_scale=0.035,
      temporal_resolution=100.0,
  ):
      """Create the double gamma HRF with the timecourse evoked activity.
      Default values are based on Glover, 1999 and Walvaert, Durnez,
      Moerkerke, Verdoolaege and Rosseel, 2011
  
      Parameters
      ----------
  
      response_delay : float
          How many seconds until the peak of the HRF
  
      undershoot_delay : float
          How many seconds until the trough of the HRF
  
      response_dispersion : float
          How wide is the rising peak dispersion
  
      undershoot_dispersion : float
          How wide is the undershoot dispersion
  
      response_scale : float
           How big is the response relative to the peak
  
      undershoot_scale :float
          How big is the undershoot relative to the trough
  
      scale_function : bool
          Do you want to scale the function to a range of 1
  
      temporal_resolution : float
          How many elements per second are you modeling for the stimfunction
      Returns
      ----------
  
      hrf : multi dimensional array
          A double gamma HRF to be used for convolution.
  
      """
  
      hrf_length = 30  # How long is the HRF being created
  
      # How many seconds of the HRF will you model?
      hrf = [0] * int(hrf_length * temporal_resolution)
  
      # When is the peak of the two aspects of the HRF
      response_peak = response_delay * response_dispersion
      undershoot_peak = undershoot_delay * undershoot_dispersion
  
      for hrf_counter in list(range(len(hrf) - 1)):
          # Specify the elements of the HRF for both the response and undershoot
          resp_pow = math.pow(
              (hrf_counter / temporal_resolution) / response_peak,
              response_delay,
          )
          resp_exp = math.exp(
              -((hrf_counter / temporal_resolution) - response_peak)
              / response_dispersion
          )
  
          response_model = response_scale * resp_pow * resp_exp
  
          undershoot_pow = math.pow(
              (hrf_counter / temporal_resolution) / undershoot_peak,
              undershoot_delay,
          )
          undershoot_exp = math.exp(
              -(
                  (hrf_counter / temporal_resolution)
                  - undershoot_peak / undershoot_dispersion
              )
          )
  
          undershoot_model = (
              undershoot_scale * undershoot_pow * undershoot_exp
          )
  
          # For this time point find the value of the HRF
          hrf[hrf_counter] = response_model - undershoot_model
  
      return hrf
  
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 7 for calling a global function with example usage: _double_gamma_hrf(response_delay, undershoot_delay, response_dispersion, undershoot_dispersion, response_scale, undershoot_scale, temporal_resolution) and returns: hrf