code: def residual(pars, x, data=None):
      """Model a decaying sine wave and subtract data."""
      vals = pars.valuesdict()
      amp = vals["amp"]
      per = vals["period"]
      shift = vals["shift"]
      decay = vals["decay"]
  
      if abs(shift) > pi / 2:
          shift = shift - sign(shift) * pi
      model = amp * sin(shift + x / per) * exp(-x * x * decay * decay)
      if data is None:
          return model
      return model - data
  
label_desc: Use image node_id 1 for calling a global function with example usage: residual(pars, x, data) and returns: unknown, model