code: def initial_peak_params(M):
      p = lmfit.Parameters()
  
      # a and b give a linear background
      a = np.mean(y)
      b = 1
  
      # a_max, loc and sd are the amplitude, location and SD of each Gaussian
      # component
      a_max = np.max(y)
      loc = np.mean(x)
      sd = (np.max(x) - np.min(x)) * 0.5
  
      p.add_many(("a", a, True, 0, 10), ("b", b, True, 1, 15))
  
      for i in range(M):
          p.add_many(
              (f"a_max{i}", 0.5 * a_max, True, 10, a_max),
              (f"loc{i}", loc, True, np.min(x), np.max(x)),
              (f"sd{i}", sd, True, 0.1, np.max(x) - np.min(x)),
          )
      return p
  
imports: import matplotlib.pyplot
  import numpy
  import lmfit
label_desc: Use image node_id 3 for calling a global function with example usage: initial_peak_params(M) and returns: p