Python code developed as a graduate student at UC Berkeley.