code: def residual(pars, x, data=None):
      argu = (x * pars["decay"]) ** 2
      shift = pars["shift"]
      if abs(shift) > pi / 2:
          shift = shift - sign(shift) * pi
      model = pars["amp"] * sin(shift + x / pars["period"]) * exp(-argu)
      if data is None:
          return model
      return model - data
  
imports: import matplotlib.pyplot
  from numpy import exp, linspace, pi, random, sign, sin
  from lmfit import create_params, minimize
  from lmfit.printfuncs import report_fit
label_desc: Use image node_id 1 for calling a global function with example usage: residual(pars, x, data) and returns: unknown, model