title: How do you fit measured emission line data with Gaussian function in Python? (Atomic Spectroscopy)
body: <p>For a physics lab project, I am measuring various emission lines from various elements. High intensity peaks occur at certain wavelengths. My goal is to fit a Gaussian function in python in order to find at which wavelength the intensity is peaking. </p>
  
  <p>I have already tried using the norm function from the scipy.stats library. Below is the code and the graph that is produced.</p>
  
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  from scipy.stats import norm
  import matplotlib.pyplot as plt
  
  mean, std = norm.fit(he3888_1[:,0])
  plt.plot(he3888_1[:,0], he3888_1[:,1], color='r')
  x = np.linspace(min(he3888_1[:,0]), max(he3888_1[:,0]), 100)
  y = norm.pdf(x, mean, std)
  plt.plot(x, y)
  plt.xlabel("Wavelength (Angstroms)")
  plt.ylabel("Intensity")
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qDztb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qDztb.png" alt="resulting plot"></a>
  Could this be because the intensity is low for a relatively long period prior to it?</p>