NIH Bldg. 10 Library

May 8-9, 2017

9:00am-5:00pm

Instructors: Steve Bond, John Didion, David McGaughey

Helpers: Vinai Roopchansingh, Zhi Liu

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 manuscript "Best Practices for Scientific Computing".

Who: The course is aimed at students and researchers at the NIH who want to begin unlocking some of the computational tools that will allow them to manipulate their data more powerfully and with greater flexibility. This workshop if for a beginner audience, so you don't need to have any previous knowledge of the tools that will be presented.

Where: The workshop will take place in the glass walled training room at the rear of the NIH library in Bldg. 10.

Requirements: Participants must bring a laptop with a Mac, Linux, or Windows operating sytem (not a tablet, Chromebook, etc.). Several specific software packages must be installed prior to the workshop (listed below). If you do not have installation privileges on the hardware you will be bringing, please contact your system administrator at least a week beforehand. All participants are also required to abide by Software Carpentry's Code of Conduct.

Contacts:


Schedule

Surveys

Please be sure to complete these surveys before and after the workshop.

Pre-workshop Survey

Post-workshop Survey

Day 1

08:45 Automating tasks with the Unix shell
10:30 Coffee
12:00 Lunch
13:00 Building programs with Python 1/2
14:30 Coffee
16:00 Wrap-up

Day 2

08:45 Building programs with Python 2/2
10:30 Coffee
12:00 Lunch
13:00 Version control with Git
14:30 Coffee
16:00 Wrap-up

Etherpad: http://pad.software-carpentry.org/quRReVQHn6.
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

  • Setting up your programming environment
  • Variables and Assignment
  • Understanding data types and conversions
  • Reading and plotting data
  • Creating and using functions
  • Loops and conditionals
  • Defensive programming
  • 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.

Python

Python is a popular language for general-purpose programming that has been widely adopted for scientific computing. Unfortunately, installing all of its scientific packages individually can be difficult, so we will be relying on an all-in-one installer called Anaconda.

For all instructions below, please ensure you install Python version 3

Windows

  1. Open https://conda.io/miniconda.html with your web browser.
  2. Download the Python 3 installer for Windows.
  3. Install Python 3 using all of the defaults for installation. Make sure the Register Anaconda as my default Python checkbox is selected before clicking 'Install'.

Mac OS X

  1. Open https://conda.io/miniconda.html with your web browser.
  2. Download the Python 3 installer for OS X.
  3. Install Python 3 using all of the defaults for installation.

Linux

  1. Open https://conda.io/miniconda.html with your web browser.
  2. Download the Python 3 installer for Linux.
  3. Install Python 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.)
  4. Open a terminal window.
  5. Type
    bash Miniconda3-
    and then press tab. The name of the file you just downloaded should appear.
  6. 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).

The Bash Shell, Jupyter, and Git

Windows

  1. Open a command prompt
    • Open Start Menu
    • type cmd
    • press [Enter]
  2. Type the following lines into the command prompt window one at a time exactly as shown, hitting [Enter] after each one.
    conda create -n bash m2-base git jupyter pandas tornado=4.4 console_shortcut
    
    activate bash
    
    conda install -c swc nano
    Continue to press [Enter] at any prompts and wait for the 'C:\' to return after each command before progressing (the first step can take many minutes and look like it's stuck, so please be patient).
  3. You should now be able to find a new folder in your Start menu called 'Anaconda'. Inside the folder will be two 'Anaconda Prompt' programs. Choose the one that doesn't say '(bash)'
  4. Activate the correct conda environment by typing:
    activate bash

Optionally, Cmder is a (much) nicer terminal environment for Windows.

Mac OS X

The default shell in all versions of Mac OS X is Bash.

  1. Open the Terminal (found in /Applications/Utilities).
  2. Type the following into the command prompt window exactly as shown:
    conda install git jupyter pandas

Optionally, iTerm2 is a more feature-rich terminal environment that is a little easier on the eyes.

Linux

The default shell is usually Bash, but if your machine is set up differently you can run it by opening a terminal and typing bash.

  1. Open the Terminal
  2. Type the following into the command prompt window exactly as shown:
    conda install git jupyter pandas

GitHub

You will need an account at github.com for the Git lesson. Basic GitHub accounts are free, so please create one if you haven't already. You should also consider what personal information you'd like to reveal. For example, you may want to review these instructions for keeping your email address private.

Text Editors

It's nice to write code in a text editor that has been optimized for it, with features like syntax highlighting and autocomplete. For this workshop we will be using a stripped-down editor called Nano that is already on your system and can be run directly from the shell environment. Below are a few free options that you might find more feature-rich once you become comfortable with the basic material. These are optional!
Also note, the default text editor on Mac OS X and Linux is usually set to something called Vim, which is not famous for being intuitive. if you accidentally find yourself stuck in it, try typing the escape key, followed by :q! (colon, lower-case 'q', exclamation mark), then hitting [Return] to get back to the shell.