Find us on GitHub

University of Notre Dame

Nov 05-06, 2015

8:30 am - 4:00 pm

Instructors: Michael Sarahan, Jiarong Guo

Helpers: TBD

General Information

Software Carpentry's mission is to help scientists and engineers get more research done in less time and with less pain by teaching them basic lab skills for scientific computing. This hands-on workshop will cover basic concepts and tools, including program design, version control, data management, and task automation. Participants will be encouraged to help one another and to apply what they have learned to their own research problems.

For more information on what we teach and why, please see our paper "Best Practices for Scientific Computing".

Who: The course is aimed at graduate students and other researchers. You don't need to have any previous knowledge of the tools that will be presented at the workshop.

Where: Room 202, LaFortune Student Center, Notre Dame University. Get directions with OpenStreetMap or Google Maps.

Requirements: Participants must bring a laptop with a few specific software packages installed (listed below). They are also required to abide by Software Carpentry's Code of Conduct.

Contact: Please mail connell.69@nd.edu for more information.


Schedule

Day 1

09:00 Automating tasks with the Unix shell
10:30 Coffee
12:00 Lunch break
13:00 Introduction to Python
14:30 Coffee
16:00 Wrap-up

Day 2

09:00 Version control with Git
10:30 Coffee
12:00 Lunch break
13:00 More Python
14:30 Coffee
15:00 Wrap-up

Etherpad: http://pad.software-carpentry.org/2015-11-05-ND.
We will use this Etherpad for chatting, taking notes, and sharing URLs and bits of code.


Syllabus

The Unix Shell

  • Files and directories
  • History and tab completion
  • Pipes and redirection
  • Looping over files
  • Creating and running shell scripts
  • Finding things
  • Reference...

Programming in Python

  • Using libraries
  • Working with arrays
  • Reading and plotting data
  • Creating and using functions
  • Loops and conditionals
  • Defensive programming
  • Using Python from the command line
  • Reference...

Version Control with Git

  • Creating a repository
  • Recording changes to files: add, commit, ...
  • Viewing changes: status, diff, ...
  • Ignoring files
  • Working on the web: clone, pull, push, ...
  • Resolving conflicts
  • Open licenses
  • Where to host work, and why
  • Reference...

Setup

To participate in a Software Carpentry workshop, you will need access to the software described below. In addition, you will need an up-to-date web browser.

We maintain a list of common issues that occur during installation as a reference for instructors that may be useful on the Configuration Problems and Solutions wiki page.

The Foundation: Miniconda

Miniconda is a barebones Python-based package manager. Installing this will allow us to rapidly create an environment that is standardized across Windows, Linux, and OS X.

  • Open https://repo.continuum.io/miniconda/ with your web browser.
  • Windows

    1. Download the latest Miniconda installer:
    2. Install Miniconda using all of the defaults for installation except make sure to check Make Anaconda the default Python.

    Mac OS X

    1. Download the Miniconda 3 installer for OS X: https://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh
    2. Install Miniconda using all of the defaults for installation. (Installation requires using the shell. If you aren't comfortable doing the installation yourself stop here and request help at the workshop.)
    3. Open a terminal window.
    4. Type
      bash Miniconda-
      and then press tab. The name of the file you just downloaded should appear.
    5. Press enter. You will follow the text-only prompts. When there is a colon at the bottom of the screen press the down arrow to move down through the text. Type yes and press enter to approve the license. Press enter to approve the default location for the files. Type yes and press enter to prepend Anaconda to your PATH (this makes the Miniconda distribution the default Python).

    Linux

    1. Download the Miniconda 3 installer for Linux:
    2. Install Miniconda 3 using all of the defaults for installation. (Installation requires using the shell. If you aren't comfortable doing the installation yourself stop here and request help at the workshop.)
    3. Open a terminal window.
    4. Type
      bash Miniconda-
      and then press tab. The name of the file you just downloaded should appear.
    5. Press enter. You will follow the text-only prompts. When there is a colon at the bottom of the screen press the down arrow to move down through the text. Type yes and press enter to approve the license. Press enter to approve the default location for the files. Type yes and press enter to prepend Anaconda to your PATH (this makes the Anaconda distribution the default Python).

    Now that you have Miniconda installed, update its components with the following command:

    conda update --all

    Environment installation

    We will employ conda environments to help start everyone off on the same page. Part of what Miniconda came with is a program called conda-env (http://conda.pydata.org/docs/commands/env/conda-env.html). This program takes an environment specification file, and downloads software to create the specified environment. For each platform, we'll need to first download the environment specification file: https://raw.githubusercontent.com/swcarpentry/swc-conda-recipes/master/env_shell_python_git/environment.yml

    If your browser shows you the file instead of offering to download it, please save the file from your browser. Ensure that you do not keep the .txt extension that your browser may try to add.

    Next, open up a terminal to create the environment:

    Windows

    • Windows 7 and above:
      • Open your file explorer.
      • Navigate to the folder where you downloaded the environment.yml file.
      • Click in your address bar, clear all text, and type "cmd"
    • Pre-Windows 7 (XP, anyone?):
      • Click your start button.
      • Select "Run", then type in "cmd" and hit enter.
      • Use the cd command to navigate to the folder where you saved the environment.yml file.
    • type "conda env create" (omit the quotes on your computer) and hit enter.

    Mac OS X

  • Open a terminal
  • Use the cd command to navigate to the folder where you downloaded the environment.yml file.
  • type "conda env create" (omit the quotes on your computer) and hit enter.
  • Linux

  • Open a terminal
  • Use the cd command to navigate to the folder where you downloaded the environment.yml file.
  • type "conda env create" (omit the quotes on your computer) and hit enter.
  • Environment activation

    Windows

    From your start menu, find the Anaconda3 menu folder, and the Git for Windows shortcut therein. This shortcut drops you into an activated environment, where the programs that get run are the programs from our environment. Alternatively, open your command prompt, and type: activate swc-shell-python-git

    Mac OS X

    Open your terminal, and type: source activate swc-shell-python-git

    Linux

    Open your terminal, and type: source activate swc-shell-python-git

    Once you are happily in your environment, please go to this page, which has instructions on how to test that everything was installed correctly.

    Python

    Python is a popular language for scientific computing, and great for general-purpose programming as well. The conda environment we created has already installed Python and a few prerequisites for us. One important note, though: We will teach Python using the IPython notebook, a programming environment that runs in a web browser. For this to work you will need a reasonably up-to-date browser. The current versions of the Chrome, Safari and Firefox browsers are all supported (some older browsers, including Internet Explorer version 9 and below, are not).