Skip to content

Commit

Permalink
markdown source builds
Browse files Browse the repository at this point in the history
Auto-generated via {sandpaper}
Source  : 17d172e
Branch  : main
Author  : Indraneel Chakraborty <[email protected]>
Time    : 2024-06-25 05:22:38 +0000
Message : Merge pull request swcarpentry#1083 from swcarpentry/update/workflows

Update Workflows to Version 0.16.5
  • Loading branch information
actions-user committed Jul 30, 2024
1 parent 26338e0 commit 3365dbe
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 100 deletions.
3 changes: 0 additions & 3 deletions 02-numpy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion 04-lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions 05-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions 06-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:

Expand Down
8 changes: 4 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -60,10 +60,10 @@ contact: '[email protected]'
# 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
Expand Down
16 changes: 2 additions & 14 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**.
Expand Down Expand Up @@ -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.



Expand Down
14 changes: 7 additions & 7 deletions md5sum.txt
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
79 changes: 17 additions & 62 deletions setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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 <kbd>Windows Logo Key</kbd>\+<kbd>R</kbd>, entering `cmd`, and hitting
Expand All @@ -145,7 +100,7 @@ cd /D %userprofile%\Desktop\swc-python\data

::::::::::::::::: spoiler

### Unix shell
## Unix shell

```bash
jupyter notebook
Expand All @@ -156,7 +111,7 @@ jupyter notebook

::::::::::::::::: spoiler

### Command Prompt (Windows)
## Command Prompt (Windows)

```source
python -m notebook
Expand All @@ -172,7 +127,7 @@ from the drop-down menu:

  <!-- vertical spacer -->

### 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
Expand All @@ -187,7 +142,7 @@ ipython

  <!-- vertical spacer -->

### Option C: plain-vanilla Python interpreter
## Option C: plain-vanilla Python interpreter

To launch a plain-vanilla Python interpreter, execute:

Expand Down

0 comments on commit 3365dbe

Please sign in to comment.