Python with Monty

Sssso you want to know more stuff about Python? Well, Monty's here to help show you a few tricks that just might be helpful for working on Physics-related things.

Got an idea for another lab-related tutorial? Tell Monty!

Images & Plots

Want to highlight a part of a figure? Need to put an arrow or some text somewhere? This should get you started.

Want to plot the expected contributions of different gammas within a spectrum? We can show you how to get the data and how to make a (basic) simulation of radiation detection via PMT.

Fitting Data

This tutorial covers how to fit two overlapping Gaussians using Scipy.

This tutorial covers how to fit a two-dimensional Gaussian to a dataset by modifying our existing fitting code.

Loading Files

Need to pull certain bits of data from a file? Want to process multiple files together? We've got you covered!

Parsing Data

There are times when you only need a subset from your data that's relevant to you. This tutorial shows you how to better pick out the parts you need.

Communicating with Test and Measurement Equipment

While scopes are very useful tools, it can be a pain to get waveform data transferred to a computer. Other times, it can be useful to change many settings at once or sweep through an array of parameters. Thankfully, many scopes, function generators, and benchtop meters have computer compatible interfaces. One common standard is known as Virtual Instrument Software Architecture (VISA), and a set of instructions common to our scopes are known as the Standard Commands for Programmable Instruments (SCPI).

=== Connecting to a Tektronix scope ===

Before anything else, you have to establish a connection to the device you're working with in a language it understands. This can be tricky as the specific steps needed will depend on your computer and you may need to search around to troubleshoot things if they don't work as expected. The following code has been tried on a few machines, but is not guaranteed to work with your device.