Assorted Computational Tutorials

Linux

The following linux tutorials are specific to the setup here in the UNC Chapel Hill Physics & Astronomy Department. They can be done by yourself but work best with a partner.
  1. Getting Started (laptop): To use the dept linux machines from your laptop, you must have an X11 server and an ssh client installed. Here are some free options:
    • Windows users: Follow the directions at this link to install X-Win32, and also install putty from here.
    • Mac users: Install XQuartz from here. An ssh client should be installed by default on OS X.
    Once you're able to log into a linux machine remotely (e.g., compute.castle.unc.edu) then you can complete this tutorial.

  2. Getting Started (dept linux box): This tutorial is intended to be completed directly on any department linux workstation.

  3. Shell scripting: If you are already comfortable with linux (including the peculiarities of the afs file system used here in UNC P&A) then you may wish to learn about linux shell scripting. To do so, type the following at the linux command line in the directory where you'd like to keep the tutorial:
    cp -r /afs/physics/users/s/sheila/public/reu/bashScripting .
    cd bashScripting
    soffice bashScripting.doc &
    Then read the document. (This tutorial is courtesy of UNC alum Zane Beckwith.)

Python

Python is both a programming (scripting) language and a command-line data analysis environment.
  1. Getting Started (laptop): To install the user-friendly Anaconda python interface on your laptop and learn to load, manipulate, and plot data, complete this tutorial.

  2. Getting Started (dept linux box): Most dept linux machines can provide the functionality of Anaconda with a combination of emacs and ipython (interactive python). If you prefer vi to emacs that's fine -- the point is to use a plain ascii equal-space-font editor, because python is sensitive to white space.
    a. type "emacs &" at the linux command line and do the built-in emacs tutorial
    b. open an xterm and type "ipython" at the linux command line to enter interactive python
    c. perform the Anaconda tutorial from #1 above using emacs as your editor window and the xterm as your console -- note that to run code in a file called filename.py you would type "run filename" in ipython
    d. to get ipython to behave just like Anaconda python, you may need to type the following either at the ipython prompt or at the top of your python codes:
    import numpy as np
    import matplotlib as mpl
    import matplotlib.pyplot as plt
    import scipy as sp
    import pylab
    pylab.ion()

  3. Programming: There are many python programming tutorials online. As a starting point, here are some companion notes to the tutorial at learnpython.org.

Computational Methods & Tools

  1. Latex: It's a great idea to get comfortable with LaTeX by typing up your problem sets with it -- your grader will be very happy! For later work in research Bibtex can be very handy too. I don't have a favorite tutorial -- a quick google search turned up this handy Wikibooks link and this combined latex-bibtex reference.
  2. Monte Carlo Methods: You will need some basic python skills to complete this tutorial.
  3. Code Management: This document from UNC Math Professor Laura Miller provides a guide to resources including tutorials for commenting, organizing, versioning, and sharing code.