Ideal Gas in a Box

I’m teaching Statistical and Thermal Physics this semester using Gould and Tobochnik’s text of the same name. The text comes with Java programs to run simulations to help students (and me!) gain understanding about how systems with large numbers of particles behave. On pages 9-10 of Statistical and Thermal Physics, Gould/Tobochnik describe a simple model […]

Fitting data with SciPy

Here’s a common thing scientists need to do, and it’s easy to accomplish in python. Suppose that you have a data set consisting of temperature vs time data for the cooling of a cup of coffee. We’ll start by importing the needed libraries and defining a fitting function: import numpy as np import matplotlib.pyplot as […]

Mt. Washington Weather analyzed with Pandas, Part 1.

I’m working on a text on computational physics whose primary goal is to create something useful for a one semester introductory course that all our physics majors (and now chemistry majors too) will be required to take. I want students to come away with tools that they’ll use later in their student careers (undergraduate & […]

Miscellaneous Python Links

Here’s a nice link to a pdf file with a summary of matlab, NumPy, and R commands.Very handy for people like me that cannot remember all the various commands one needs to get something done. Also, if you haven’t tried out the new iPython Notebook, you should give it a try; it can mix markup […]

Simple Animated Plot with Matplotlib

Here’s a simple script which is a good starting point for animating a plot using matplotlib’s animation package (which, by their own admission, is really in a beta status as of matplotlib 1.1.0). I find the code needed to perform the animation more cumbersome than I’d like, but importantly, it’s not too cumbersome. In line2 […]

First Post

This is the beginning of the Scientific Python Script Repository. My intention is to create an (a) open-source, (b) high quality & elegant, (c) searchable database of  python scripts (from snippets to more extended projects) useful for scientists aiming to get things done with python. To do this, I’ll have to make strict standards for […]