West Virginia University

May 30, 2018

9:00 am - 5:00 pm

Instructors: Chitrak Gupta, Nihan Pol

Helpers: Niel Infante

General Information

WVU Research Computing (RC) department offers support for computational research at WVU. This workshop is intended to be a follow-up to the introductory workshops conducted through Software Carpentry (SWC) at WVU in the past years. The aim of this workshop is to cover topics in Python at a higher level than that covered in the SWC Python workshops. We also plan to cover topics that were not covered in the SWC workshops due to time restrictions

Where: WVU Downtown Library, Room L104. Get directions with OpenStreetMap or Google Maps.

When: May 30, 2018. Add to your Google Calendar.

Requirements: These are the topics that anyone attending the workshop should be familiar with. Even if you do not meet these pre-requisites, we encourage you to attend the workshop. We will present the topics of the workshop in such a way that relative new-comers should be comfortable writing scripts in Python at the end of the day. The pre-requisites assume knowledge of:

1. Python syntax
2. Pythonic variables and variable assignment
3. Importing libraries in Python
4. Basic command line/shell scripting (highly optional, will be used sparingly, if at all)

Files: The pandas tutorial is split into 3 sections. In the first part, we will use the SN7577 data downloaded from this website. For the the last pandas tutorial, we will use the SAFI_results.csv file available for download here. Details of the SAFI project and description of the data is provided here.

Contact: Please email chgupta@mix.wvu.edu or nspol@mix.wvu.edu for more information.


Schedule

Day 1

09:00 Introduction to jupyter notebook
09:15 Introduction to data frames
09:40 Accessing data in data frames
10:05 Summarizing data
10:30 Coffee
10:45 Review of loops and conditional statements
11:15 Handling exceptions
11:30 Review of numpy arrays
12:00 Lunch
13:00 Functions, variables and errors
13:45 Plotting in python
14:30 Common topics: Sorting and glob module.
14:45 Regular expressions
15:15 Coffee
15:30 User-defined topics?
16:30 Wrap up
15:00 END

Data Intro

  • Jupyter notebook
  • Data frames in python
  • Loops and conditional statements
  • Numpy arrays
  • Defining functions
  • Local vs. global variables
  • Error analysis
  • Plotting in python
  • Common topics: Sorting and glob module
  • Regular expressions
  • User-defined topics

Setup

To participate in this 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 research computing, and great for general-purpose programming as well. Installing all of its research packages individually can be a bit difficult, so we recommend Anaconda, an all-in-one installer.

Regardless of how you choose to install it, please make sure you install Python version 3.x (e.g., 3.6 is fine).

We will teach Python using the Jupyter 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).

Windows

Video Tutorial
  1. Open https://www.anaconda.com/download/#windows with your web browser.
  2. Download the Python 3 installer for Windows.
  3. Install Python 3 using all of the defaults for installation except make sure to check Make Anaconda the default Python.

macOS

Video Tutorial
  1. Open https://www.anaconda.com/download/#macos 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://www.anaconda.com/download/#linux with your web browser.
  2. Download the Python 3 installer for Linux.
    (The 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 Anaconda3-
    and then press tab. The name of the file you just downloaded should appear. If it does not, navigate to the folder where you downloaded the file, for example with:
    cd Downloads
    Then, try again.
  5. Press enter. You will follow the text-only prompts. To move through the text, press the space key. 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).
  6. Close the terminal window.

We were aided in this work by the training and other support offered by the Software Carpentry project.