This lesson introduces the foundational concepts of scientific data fitting through the lens of gamma spectroscopy. You'll learn the basics of using tools such as find_peaks, curve_fit, and linregress to extract meaningful insights from experimental data and quantify how well a theoretical model agrees with observations.
The project is structured with a Jupyter Notebook workflow and assumes a basic familiarity with Python. You'll be guided through setting up your environment, understanding the experiment being used as an example, and performing the analysis step by step.
This lesson is broken into the following sections:
A brief overview of what the lesson will cover and the role of data fitting in scientific computing.
Instructions for setting up your Python environment using Jupyterlab or Jupyter Notebook, along with the required libraries.
An introduction to gamma spectroscopy:
-
The three main types of atomic radiation
-
How scintillators, photomultiplier tubes (PMTs), and spectrometers work
-
The steps involved in collecting and preparing spectral data
Starting with plotting the raw data before showing how to isolate the photopeaks. Also describes the Compton continuum and edge as well as backscatter and X-ray escape peaks.
Here you'll learn:
-
What a Gaussian curve is and why it models peaks in spectroscopy
-
How to define single and double Gaussian functions
-
How to use
curve_fitto extract parameters like the peak's center and uncertainty.
With the centers of all the radioactive sources found, you'll
-
Fit a line using
linregressto relate spectrometer channel number to gamma emission energy -
Use the linear fit to estimate the energy of the unknown peaks
-
Compare these energies against known isotopic emission lines to generate candidate matches for the unknown source
Finally, you'll quantify how well each isotopic candidate matches the unknown peaks by:
-
Implementing a chi-squared test with weights based on uncertainty
-
Calculate the reduced chi-squared statistic to evaluate the quality of the candidate isotopes
-
Rank the candidate isotope combinations based on their statistical compatibility
By the end of this lesson, you should be able to:
-
Understand the principles of gamma spectroscopy and its data output
-
Understand how to use
curve_fitto extract parameters and their uncertainties -
Understand how to use
linregressfor calibrating scientific instruments -
Understand how to use chi-squared statistics to compare models and assess fit quality
-
Python 3.11+
-
Jupyter Notebok or JupyterLab
-
Numpy, SciPy, Matplotlib, and Pandas libraries
This lesson is made available under the Creative Commons Attribution 4.0 License