Python Resources

Last Updated: August 18, 2026

The Python reference pages used in this course live on the Physics Labs Python site, shared across the undergraduate lab courses. Everything below opens there.

Start here

Page What it covers
Setup & Installation Installing Python, VS Code, and the drivers for the DAQ, VISA instruments, and motors used in this course. The lab laptops already have all of it
Python Basics The language itself — values, functions, loops, imports
Workflows Notebooks vs. scripts, and when to reach for each
Working Effectively Writing calculations as reusable functions and keeping raw data separate from analysis

Analyzing data

Page What it covers
Arrays and Plotting NumPy arrays, reading and writing data files, Matplotlib figures — Gaussian Beams Week 1
Curve Fitting scipy.optimize.curve_fit, uncertainties, residuals, χ² — Gaussian Beams Week 2
Error Propagation Propagating uncertainties by hand and with the uncertainties package — Gaussian Beams Week 3
Fourier Analysis Power spectra with rfft, frequency resolution, windowing, aliasing — Michelson Week 2

Controlling instruments

Page What it covers
DAQ Devices (NI-DAQmx) Reading voltages off the USB-6009, finite and continuous acquisition
VISA Instrument Control Oscilloscopes, function generators, and power supplies over pyvisa
Motor Control Driving the Thorlabs stage via the Kinesis SDK