From 3365dbef581b2935bdf1610194c47a27f2416ca1 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 30 Jul 2024 01:35:03 +0000 Subject: [PATCH] markdown source builds Auto-generated via {sandpaper} Source : 17d172eca0748d112fecd4bf76b8fe0b53e95026 Branch : main Author : Indraneel Chakraborty <64887729+ineelhere@users.noreply.github.com> Time : 2024-06-25 05:22:38 +0000 Message : Merge pull request #1083 from swcarpentry/update/workflows Update Workflows to Version 0.16.5 --- 02-numpy.md | 3 -- 04-lists.md | 9 +++++- 05-loop.md | 6 ++++ 06-files.md | 9 ------ config.yaml | 8 +++--- index.md | 16 ++--------- md5sum.txt | 14 +++++----- setup.md | 79 ++++++++++++----------------------------------------- 8 files changed, 44 insertions(+), 100 deletions(-) diff --git a/02-numpy.md b/02-numpy.md index 4630d61b2..21db9cc36 100644 --- a/02-numpy.md +++ b/02-numpy.md @@ -26,9 +26,6 @@ specialized tools built up from these basic units live in [libraries](../learners/reference.md#library) that can be called upon when needed. -Now that we have looked at some basic concepts like lists and loops, lets look at -digging into some of the data we have been provided! - ## Loading data into Python To begin processing the clinical trial inflammation data, we need to load it into Python. diff --git a/04-lists.md b/04-lists.md index 4238f8e50..b356b7471 100644 --- a/04-lists.md +++ b/04-lists.md @@ -21,7 +21,14 @@ exercises: 15 :::::::::::::::::::::::::::::::::::::::::::::::::: -We have been provided with a directory of inflammation data file to process, in the form of csv files. +In the previous episode, we analyzed a single file of clinical trial inflammation data. However, +after finding some peculiar and potentially suspicious trends in the trial data we ask +Dr. Maverick if they have performed any other clinical trials. Surprisingly, they say that they +have and provide us with 11 more CSV files for a further 11 clinical trials they have undertaken +since the initial trial. + +Our goal now is to process all the inflammation data we have, which means that we still have +eleven more files to go! The natural first step is to collect the names of all the files that we have to process. In Python, a list is a way to store multiple values together. In this episode, we will learn how to store diff --git a/05-loop.md b/05-loop.md index 7536ebd84..53455e96a 100644 --- a/05-loop.md +++ b/05-loop.md @@ -19,6 +19,12 @@ exercises: 0 :::::::::::::::::::::::::::::::::::::::::::::::::: +In the episode about visualizing data, +we wrote Python code that plots values of interest from our first +inflammation dataset (`inflammation-01.csv`), which revealed some suspicious features in it. + +![](fig/03-loop_2_0.png){alt="Line graphs showing average, maximum and minimum inflammation across all patients over a 40-dayperiod."} + We have a dozen data sets right now and potentially more on the way if Dr. Maverick can keep up their surprisingly fast clinical trial rate. We want to create plots for all of our data sets with a single statement. To do that, we'll have to teach the computer how to diff --git a/06-files.md b/06-files.md index db0e30c8f..4d8b3af83 100644 --- a/06-files.md +++ b/06-files.md @@ -17,13 +17,6 @@ exercises: 0 :::::::::::::::::::::::::::::::::::::::::::::::::: -At the start of this course, we looked at lists and loops; then we moved -on to using numpy arrays to look at the inflammation data in more depth, -and using matplotlib to visualise the data. -How can we combine these different topics to process *all* the data? - -## Finding multiple files - As a final piece to processing our inflammation data, we need a way to get a list of all the files in our `data` directory whose names start with `inflammation-` and end with `.csv`. The following library will help us to achieve this: @@ -56,8 +49,6 @@ to do something with each filename in turn. In our case, the "something" we want to do is generate a set of plots for each file in our inflammation dataset. -## Plotting multiple datasets - If we want to start by analyzing just the first three files in alphabetical order, we can use the `sorted` built-in function to generate a new sorted list from the `glob.glob` output: diff --git a/config.yaml b/config.yaml index 25c03d8fa..4113b93ac 100644 --- a/config.yaml +++ b/config.yaml @@ -11,10 +11,10 @@ carpentry: 'swc' # Overall title for pages. -title: 'SWD1a: Introduction to Python' +title: 'Programming with Python' # Date the lesson was created (YYYY-MM-DD, this is empty by default) -created: '2024-07-29' +created: '2014-11-25' # Comma-separated list of keywords for the lesson keywords: 'software, data, lesson, The Carpentries' @@ -60,10 +60,10 @@ contact: 'team@carpentries.org' # Order of episodes in your lesson episodes: - 01-intro.md -- 04-lists.md -- 05-loop.md - 02-numpy.md - 03-matplotlib.md +- 04-lists.md +- 05-loop.md - 06-files.md - 07-cond.md - 08-func.md diff --git a/index.md b/index.md index eca9663af..7922dc985 100644 --- a/index.md +++ b/index.md @@ -3,17 +3,6 @@ permalink: index.html site: sandpaper::sandpaper_site --- -## Welcome to SWD1a: Introduction to Python - -This website contains materials from [The Carpentries](https://carpentries.org/), with -some small modifications to tailor it to our needs for *SWD1a: Introduction to Python* -here at the University of Leeds. - -Please refer to your course hackpad for additional links, topics, and discussion -points specific to your course. - -## The format of this workshop - The best way to learn how to program is to do something useful, so this introduction to Python is built around a common scientific task: **data analysis**. @@ -81,9 +70,8 @@ recommend if possible. ### Getting Started -To get started, follow the directions on the [Setup](learners/setup.md) page to open up Google colab. -After the course, you can follow the intructions here to install a Python interpreter locally on your -machine. +To get started, follow the directions on the [Setup](learners/setup.md) page to download data +and install a Python interpreter. diff --git a/md5sum.txt b/md5sum.txt index 7e47d9a59..d9deca95c 100644 --- a/md5sum.txt +++ b/md5sum.txt @@ -1,14 +1,14 @@ "file" "checksum" "built" "date" "CODE_OF_CONDUCT.md" "c93c83c630db2fe2462240bf72552548" "site/built/CODE_OF_CONDUCT.md" "2023-04-21" "LICENSE.md" "b24ebbb41b14ca25cf6b8216dda83e5f" "site/built/LICENSE.md" "2023-04-21" -"config.yaml" "5b711d9fbfab8cdc110c59781fbe8979" "site/built/config.yaml" "2024-07-29" -"index.md" "4359fa12d117c67d11ce1c48eaacb4a5" "site/built/index.md" "2024-07-29" +"config.yaml" "651e83c85f369ffb595f341f331ded7d" "site/built/config.yaml" "2024-07-30" +"index.md" "da8fda99fa46f56798dc90573766b75a" "site/built/index.md" "2024-07-30" "episodes/01-intro.md" "6193d753b39a08e6b99b70715dff3da9" "site/built/01-intro.md" "2023-04-21" -"episodes/04-lists.md" "9fb24a2aba919b1b747625cdee163616" "site/built/04-lists.md" "2024-07-29" -"episodes/05-loop.md" "f42ab0283e80c5fa2d63efc85b0457c1" "site/built/05-loop.md" "2024-07-29" -"episodes/02-numpy.md" "133ce13cb97c59d24dd1c895c10d2485" "site/built/02-numpy.md" "2024-07-29" +"episodes/02-numpy.md" "1b9c4000cea628f84024abab49012a06" "site/built/02-numpy.md" "2024-07-30" "episodes/03-matplotlib.md" "3bb8e6088285f01152e2e24da6f36fbc" "site/built/03-matplotlib.md" "2024-07-29" -"episodes/06-files.md" "640d953db91256030517559450b43147" "site/built/06-files.md" "2024-07-29" +"episodes/04-lists.md" "d1768916dafc023eeb2f3838932b6289" "site/built/04-lists.md" "2024-07-30" +"episodes/05-loop.md" "2803f30bd8bf21ca00e0196829a583cf" "site/built/05-loop.md" "2024-07-30" +"episodes/06-files.md" "eda3d2e5ff2a23f37048631427cb4f48" "site/built/06-files.md" "2024-07-30" "episodes/07-cond.md" "e2e4b672a3cc52150cc74b4296f16531" "site/built/07-cond.md" "2024-07-29" "episodes/08-func.md" "ca1da7a3d21d6b8dee6a1e52d35e8d84" "site/built/08-func.md" "2024-07-29" "episodes/09-errors.md" "9eb44385622246a7b9e5e51ab0057c81" "site/built/09-errors.md" "2023-04-21" @@ -20,5 +20,5 @@ "instructors/instructor-notes.md" "a492a732a51a4f3601b440636aa569f5" "site/built/instructor-notes.md" "2023-04-21" "learners/discuss.md" "0472061d33c7331f16f8e8aeb1ba72cd" "site/built/discuss.md" "2023-04-21" "learners/reference.md" "51f620bc89bfec7583ee64932ad84729" "site/built/reference.md" "2024-07-29" -"learners/setup.md" "3af3b1332929787a3221a6214d6846a8" "site/built/setup.md" "2024-07-29" +"learners/setup.md" "1c1270e5a9934be95250683be8b2bfbc" "site/built/setup.md" "2024-07-30" "profiles/learner-profiles.md" "60b93493cf1da06dfd63255d73854461" "site/built/learner-profiles.md" "2023-04-21" diff --git a/setup.md b/setup.md index c86830d81..bae8c6956 100644 --- a/setup.md +++ b/setup.md @@ -8,48 +8,18 @@ This lesson is designed to be run on a personal computer. All of the software and data used in this lesson are freely available online, and instructions on how to obtain them are provided below. -## Get Python +## Install Python In this lesson, we will be using Python 3 with some of its most popular scientific libraries. -We are going to be using [Google Colab](https://colab.google/), a hosted Jupyter Notebook service -that requires no setup to use and provides free access to computing resources, -including GPUs and TPUs. - -To get started, you just need to log in with a Google account and click ["New Notebook"](https://colab.new/). +Although one can install a plain-vanilla Python and all required libraries by hand, +we recommend installing [Anaconda][anaconda-website], +a Python distribution that comes with everything we need for the lesson. +Detailed installation instructions for various operating systems can be found +on The Carpentries [template website for workshops][anaconda-instructions] +and in [Anaconda documentation][anaconda-install]. ## Obtain lesson materials -There a few different ways of loading in the data. - -### 1. Download it directly in Colab - -In Colab, you can access the terminal of the remote machine by using `!` in front of Linux -bash commands. This means you can use the Linux command `wget` to download files from the internet. - -**Note: the file storage space on the remote machine you are using in Google Colab is not persistent: -the files and folders you upload/save will not still be there when you next log in. Please download -your work if you want to save it.** - -#### Download files - -```python= -# Download 2 files and store in the swc-python folder -!wget -P swc-python https://swcarpentry.github.io/python-novice-inflammation/data/python-novice-inflammation-data.zip -!wget -P swc-python https://swcarpentry.github.io/python-novice-inflammation/files/code/python-novice-inflammation-code.zip -``` - -#### Unzip files - -```python= -# Extract .zip files inside the folder swc-python/ -!unzip /content/swc-python/python-novice-inflammation-code.zip -d /content/swc-python/ -!unzip /content/swc-python/python-novice-inflammation-data.zip -d /content/swc-python/ -``` - -### 2. Manual download - -You can download the files and code directly to your machine: - 1. Download [python-novice-inflammation-data.zip][zipfile1] and [python-novice-inflammation-code.zip][zipfile2]. 2. Create a folder called `swc-python` on your Desktop. @@ -59,36 +29,21 @@ You can download the files and code directly to your machine: You should see two folders called `data` and `code` in the `swc-python` directory on your Desktop. -You can then use the files dialogue in the right hand panel of Colab to upload these files. - -## After this course: install Python - -When you are working on research coding, you will want to use Python from your local -machine. Here are some instructions for you to follow *after* this course, to set -up Python on your machine. - -Although one can install a plain-vanilla Python and all required libraries by hand, -we recommend installing [Anaconda][anaconda-website], -a Python distribution that comes with everything we need for the lesson. -Detailed installation instructions for various operating systems can be found -on The Carpentries [template website for workshops][anaconda-instructions] -and in [Anaconda documentation][anaconda-install]. - -### Launch Python interface +## Launch Python interface To start working with Python, we need to launch a program that will interpret and execute our Python commands. Below we list several options. If you don't have a preference, proceed with the top option in the list that is available on your machine. Otherwise, you may use any interface you like. -### Option A: Jupyter Notebook +## Option A: Jupyter Notebook A Jupyter Notebook provides a browser-based interface for working with Python. If you installed Anaconda, you can launch a notebook in two ways: ::::::::::::::::: spoiler -### Anaconda Navigator +## Anaconda Navigator 1. Launch Anaconda Navigator. It might ask you if you'd like to send anonymized usage information to Anaconda developers: @@ -109,13 +64,13 @@ If you installed Anaconda, you can launch a notebook in two ways: ::::::::::::::::: spoiler -### Command line (Terminal) +## Command line (Terminal) 1\. Navigate to the `data` directory: ::::::::::::::::: spoiler -### Unix shell +## Unix shell If you're using a Unix shell application, such as Terminal app in macOS, Console or Terminal in Linux, or [Git Bash][gitbash] on Windows, execute the following command: @@ -128,7 +83,7 @@ cd ~/Desktop/swc-python/data ::::::::::::::::: spoiler -### Command Prompt (Windows) +## Command Prompt (Windows) On Windows, you can use its native Command Prompt program. The easiest way to start it up is pressing Windows Logo Key\+R, entering `cmd`, and hitting @@ -145,7 +100,7 @@ cd /D %userprofile%\Desktop\swc-python\data ::::::::::::::::: spoiler -### Unix shell +## Unix shell ```bash jupyter notebook @@ -156,7 +111,7 @@ jupyter notebook ::::::::::::::::: spoiler -### Command Prompt (Windows) +## Command Prompt (Windows) ```source python -m notebook @@ -172,7 +127,7 @@ from the drop-down menu:   -### Option B: IPython interpreter +## Option B: IPython interpreter IPython is an alternative solution situated somewhere in between the plain-vanilla Python interpreter and Jupyter Notebook. It provides an interactive command-line based interpreter with @@ -187,7 +142,7 @@ ipython   -### Option C: plain-vanilla Python interpreter +## Option C: plain-vanilla Python interpreter To launch a plain-vanilla Python interpreter, execute: