dpshelio
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# RSLondon Software Carpentry 2020-11-25/27 :::success ## General information This collaborative document (hackmd) is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents. :closed_book: Users are expected to follow [our code of conduct](https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html). :bookmark_tabs: The [Workshop webpage](https://rslondon.github.io/2020-11-25-rslondon/) contains the installations instructions for the software that we will use during the next three days. :video_camera: Zoom links for each day will be shared via e-mail. ::: :::info ## Guides to tools we will use - [How to use HackMD in this workshop](/kbCGdFg5RI6ocDQnwiDRRA) - [How to use Zoom in this workshop](/xoZm0uaHTpS9Dwee6YLyfg) ::: :::warning ## Pre-workshop Questionnaire - Please fill in the [Pre-workshop survey](https://carpentries.typeform.com/to/wi32rS?slug=2020-11-25-rslondon) before the workshop ::: :::warning ## Sessions | | Wed 25 | Thu 26 | Fri 27| | ----- | ------ | ------ | ----- | | 10'00 | [Command line](#The-Unix-Command-line---Chris-Cave-Ayland) | | | | 14'00 | [Version control with Git](#Version-Control-with-Git---Iain-Barrass) | [Python 1/2](#Python---day-1---Iain-Stenson) | [Python 2/2](#Python---day-2---Tom-Dowrick) | ::: ## :wave: Roll call + Check in - name / [Additional info, e.g. email / pronoun / social media handle / favorite [emoji](https://gist.github.com/rxaviers/7360908)] / GitHub name (👨‍🏫 - instructor; 🧚 - helpers; ) - 🧚 Jeremy Cohen (organiser/helper), he/him, Imperial College London, :email: [jeremy.cohen@imperial.ac.uk](mailto:jeremy.cohen@imperial.ac.uk), :cat: [@jcohen02](https://github.com/jcohen02) - 🧚 Iain Stenson (helper), Research Software Engineer at QMUL. - 🧚 Alessandro Felder (helper), RSE at UCL, he/him, - , :coffee: , [@alessandrofelder](https://github.com/alessandrofelder) . - 🧚 Jay DesLauriers (Helper), Researcher at University of Westminster - 🧚 Jazz Mack Smith (Helper), Imperial College London - 🧚 Markus Löning (Helper) / PhD student at UCL / he/him / GitHub: [@mloning](https://github.com/mloning) - 🧚 Tom Bradford (Helper), IT Admin at QMUL - 🧚 Tony Yang (Helper), PhD Candidate at Imperial, @tonyyzy - 🧚 Anastasis Georgoulas (helper), Research Software Engineer at UCL, he/him, - , :sweat_smile:, [@ageorgou](https://github.com/ageorgou) - 🧚 Jamie Quinn (helper), Research Software Engineer at UCL, he/him, - , :violin:, [@jamiejquinn](https://github.com/jamiejquinn) **Breakout groups for Thursday (Python 1):** - Tom Bradford and Jay DesLauriers (helpers). Room 4 - Niyi Ogunbiyi, PhD student at University of Westminister [@etioro](https://github.com/etioro) - Jason Pott, (attendant), Phd student at QMUL C4TS Blizzard [@jasonpott](https://github.com/jasonpott) - Gerard Hernandez (attendant), Postdoctoral Researcher at QMUL, [@AlanTheCat](https://github.com/AlanTheCat) - Zeena Radwan - Phd student at University of Westminister. - Marta Ferreira - PhD student at QMUL - Oliver van Zwanenberg, PhD student at University of Westminister [@OlivervZ11](https://github.com/OlivervZ11) - Charlotte - Sara - Charlotte Lindsay - PhD student at QMUL C4TS - Jazz Mack Smith and Tony Yang (helpers). Room 5 - Floriane Tissot, (attendant), Postdoc at Imperial College, 👩🏻‍🔬, [@Flokhi](https://github.com/Flokhi) - Farzan Ramzan (attendant), Postdoc @ Imperial - Patrick White github: patpatpatpatpatpat - Leandro Perao (attendant), PhD Student at ICL, he/him, :coffee:, [@alpha85](https://github.com/alpha085) - Yufei Wang, PhD student at Queen Mary University of London - Fernando - Kaiming - Hai-Van - Lucie Studena (attendant), PhD student at ICL, [@tomca12](https://github.com/tomca12) - Markus Löning and Alessandro Felder (helpers). Room 6 - Georgina Mills (attendant), Research Assistant at UCL, @GeorgieMills - Santosh Atanur (attendant), Postdoc at Imperial College London [@santoshatanur](https://github.com/santoshatanur) - Matt Wisdom (attendant), Research Assistant at UCL, [@mwisdom04](https://github.com/mwisdom04) - Melanie Hare, UCL MSc - john gumbley - ucl masters planetary science - Alex Vaideanu (attendant), Postdoc at UCL, [@alexvaideanu](https://github.com/alexvaideanu) - Will Scotton (attendant). PhD Student at UCL [@williamscotton](https://github.com/williamscotton) - Jasleen Gandhi, Masters UCC, [@jasleengandhi](https://github.com/jasleengandhi) - Ana Krelling (attendant), PhD in physical oceanograhy, she/her, [@apkrelling](https://github.com/apkrelling) - Sara Lise Underhay, PhD student in geophysics <br/> <br/> <hr/> <br/> <br/> **Breakout groups for Friday ([Python 2](https://swcarpentry.github.io/python-novice-inflammation/05-lists/index.html)):** - Jay DesLauriers and Iain Stenson (helpers). Room 1 - Niyi Ogunbiyi, PhD student at University of Westminister [@etioro](https://github.com/etioro) - Jason Pott, (attendant), Phd student at QMUL C4TS Blizzard [@jasonpott](https://github.com/jasonpott) - Gerard Hernandez (attendant), Postdoctoral Researcher at QMUL, [@AlanTheCat](https://github.com/AlanTheCat) - Zeena Radwan - Phd student at University of Westminister. - Marta Ferreira - PhD student at QMUL - Oliver van Zwanenberg, PhD student at University of Westminister [@OlivervZ11](https://github.com/OlivervZ11) - Sara - Charlotte Lindsay - PhD student at QMUL C4TS - David Perez-Suarez and Anthony Thomas (helpers). Room 2 - Floriane Tissot, (attendant), Postdoc at Imperial College, 👩🏻‍🔬, [@Flokhi](https://github.com/Flokhi) - Farzan Ramzan (attendant), Postdoc @ Imperial - Patrick White github: patpatpatpatpatpat - Leandro Perao (attendant), PhD Student at ICL, he/him, :coffee:, [@alpha85](https://github.com/alpha085) - Yufei Wang, PhD student at Queen Mary University of London - Hai-Van - Lucie Studena (attendant), PhD student at ICL, [@tomca12](https://github.com/tomca12) - Anastasis Georgoulas and Tony Yang (helpers). Room 3 - Georgina Mills (attendant), Research Assistant at UCL, @GeorgieMills - Santosh Atanur (attendant), Postdoc at Imperial College London [@santoshatanur](https://github.com/santoshatanur) - Matt Wisdom (attendant), Research Assistant at UCL, [@mwisdom04](https://github.com/mwisdom04) - Areti Papadopoulu - Alex Vaideanu (attendant), Postdoc at UCL, [@alexvaideanu](https://github.com/alexvaideanu) - Will Scotton (attendant). PhD Student at UCL [@williamscotton](https://github.com/williamscotton) - Jasleen Gandhi, Masters UCC, [@jasleengandhi](https://github.com/jasleengandhi) - Ana Krelling (attendant), PhD in physical oceanograhy, she/her, [@apkrelling](https://github.com/apkrelling) - Sara Lise Underhay, PhD student in geophysics **New attendees - please add your name below:** # The Unix Command line - Chris Cave-Ayland * To prepare for the session please: * Download [lesson data files](http://swcarpentry.github.io/shell-novice/data/data-shell.zip) - copy it to your Desktop and extract it * Open [Vevox](https://vevox.app/m#/122904871) for quizzes ## :pencil: Notes (for everyone to add them together 😉) - `ls` shows the files - `ls -F` shows also a trailing slash for the directories (useful if you've haven't got them already in a different colour). `-F` is an "option". - `ls -F /` shows what's under the `/` directory. - `ls --help` shows us how to use it! (a bit cryptic though) - `[OPTION]...` You can provide options, - `[]` means they are optional, the ` - ...` mean that you can provide more than one option. - `[FILE]...` we can ask for a location or many as we want and they are optional. - There are short and long versions: `-a` = `--all` - `man ls` is similar to the help output. You need to press <kbd>q</kbd> to exit. The output is clear out from the screen. - Options and everything in the shell is case sensitive! `-s` and `-S` are different things. - `pwd` print working directory; first `/` in the output is called the root directory, the base of all the directories. - `cd Desktop` moves your location to the Desktop directory - `~` is a short for `/home/username`, your Home :house: - Paths: - absolute: refers from the root, eg., `/home/user/Desktop/data-shell` - relative: refers from the point you are in, if we are in Desktop: `data-shell` - `..`: refers to the parent directory - `.`: refers to the current directory - `nano` open a text editor within the shell. <kbd>ctrl</kbd>+<kbd>x</kbd> to exit. - `cp` copies (and renames if needed) something into somewhere `cp quotes.txt thesis/quotations.txt` - `cp -r` to copy a directory - `rm` to delete (remove) files. :warning: there's not a recycle bin :wastebasket: !! so be careful - `rm -r` will allow you to delete directories - `rm -i` will ask you for confirmation before deleting stuff. - `wc` count characters, words and lines - `>` is use to redirect the output of a command into a file - `cat` to display files on the screen - `sort` to sort a file, `-n` to sort numerically. - `head` shows the first few lines of the file, `-n 1` will only show the first line. - `tail` like `head` but for the end of the file - `|` (pipe) is use to redirect the output of one command as input for the next (`wc -l *pdb | sort -n | head -n 1` will give the file with the smaller number of lines named `...pdb` ) - for loops, to repeat an action over multiple files. ```bash $ for filename in basilisk.dat minotaur.dat unicorn.dat > do > head -n 2 $filename | tail -n 1 > done ``` - scripts, files that we put the commands we want to run in sequence. Normally called as `some_meaningful_name.sh`. - if used `$@` within the script, it will read all the arguments you pass from the command line. example: ```bash for filename in "$@" do head -n 15 "$filename" | tail -n 5 done ``` - `history` shows you all the commands you've run. - <kbd>tab</kbd> will try to autocomplete the files and directory names. - <kbd>ctrl</kbd>+<kbd>c</kbd> is used to cancel what you are running. ## :question: Questions about Unix command line Here you can post any question you have while we are going through this document. Please, use a new bullet point for each question and sub-bullet points for their answers. For example writing like this: ``` - Example question - [name=student_a] Example answer - [name=TA_1] Example answer ``` produces the following result: - Example question - [name=student_a] Example answer - [name=TA_1] Example answer - What's the difference between git bash and git cmd? - [name=Iain S] Git CMD is just like regular Windows command prompt with the git command. Git Bash emulates a bash environment on windows. It lets you use all git features in command line plus most of standard unix commands. - Is the sorting (when using `ls`) displayed in vertical or horizontal order? - [name=David] it's displayed in columns so left column first, then go through the second column. - What if I wanted only the name itself without the first bit of the line (CLASSIFICATION:)? - [name=Jeremy] : This question was in relation to the example shown for working with loops. We looked at an example that would print the "CLASSIFICATION" lines from the files in the `creatures` directory: `for filename in *.dat; do head -n 2 $filename | tail -n 1; done` As highlighted in the Zoom chat, this is beyond the scope of today's session so we haven't covered the additional commands that can help with this. As with many command line tasks, there are a few different ways to achieve this. Some options might be the use of the `cut` command or `awk` command. `awk` can be particularly confusing to work with but it's worth checking out the man page nonetheless. - Another way, with `cut`, `-d` for delimeter and `-f` for the field you want to show: ```bash head "$1" -n 2 | tail -n 1 | cut -d':' -f2 ``` ## :pencil: Feedback Tell us at least one good thing and something we could improve by leaving feedback as post-its [on this interactive board](https://ideaboardz.com/for/SWC%20Feedback/3545691). # Version Control with Git - Iain Barrass ## :pencil: Notes Software Carpentry lesson material for GitHub Remotes: http://swcarpentry.github.io/git-novice/07-github/index.html ## :question: Questions about Git - Example question - [name=student_a] Example answer - [name=TA_1] Example answer ## :pencil: Feedback Tell us at least one good thing and something we could improve by leaving feedback as post-its [on this interactive board](https://ideaboardz.com/for/SWC%20Feedback/3545691). # Python - day 1 - Iain Stenson ## :pencil: Notes Download [python-novice-inflammation-data.zip](https://swcarpentry.github.io/python-novice-inflammation/data/python-novice-inflammation-data.zip). ## :question: Questions about Python 1/2 - Example question - [name=student_a] Example answer - [name=TA_1] Example answer ## Exercises ### Exercise Session 1 You can find tips or answers to most exercises in the [lesson notes](https://swcarpentry.github.io/python-novice-inflammation/03-matplotlib/index.html). #### 1. What values do the variables mass and age have after each of the following statements? Test your answer by executing the lines. ```python mass = 47.5 age = 122 mass = mass * 2.0 age = age - 20 ``` #### 2. What does the following program print out? ```python first, second = 'Grace', 'Hopper' third, fourth = second, first print(third, fourth) ``` ### Exercise Session 2 A section of an array is called a slice. We can take slices of character strings as well: ```python element = 'oxygen' print('first three characters:', element[0:3]) print('last three characters:', element[3:6]) ``` 1. What is the value of element[:4]? What about element[4:]? Or element[:]? 1. What is element[-1]? What is element[-2]? 1. Given those answers, explain what element[1:-1] does. 1. How can we rewrite the slice for getting the last three characters of element, so that it works even if we assign a different string to element? Test your solution with the following strings: carpentry, clone, hi. ### Exercise Session 3 Why do all of our plots stop just short of the upper end of our graph? Can we adjust the y limit of our graph so that it looks better? ```python some_plot.set_ylim(min, max) ``` Can you create your own graph of the standard deviation using ```python np.std() ``` ### Exercise Session 4 #### 1. Python has a built-in function called `range` that generates a sequence of numbers. `range` can accept 1, 2, or 3 parameters. If one parameter is given, range generates a sequence of that length, starting at zero and incrementing by 1. For example, `range(3)` produces the numbers 0, 1, 2. If two parameters are given, range starts at the first and ends just before the second, incrementing by one. For example, `range(2, 5)` produces 2, 3, 4. If `range` is given 3 parameters, it starts at the first one, ends just before the second one, and increments by the third one. For example, `range(3, 10, 2)` produces 3, 5, 7, 9. Using `range`, write a loop that prints the first 3 natural numbers: ```python 1 2 3 ``` #### 2. Given the following loop, how many times is `print` called? 3, 4, 5, or 6 times? ```python word = 'oxygen' for char in word: print(char) ``` #### 3. Exponentiation is built into Python and is done with `**`. ```python print(5 ** 3) # prints 125 ``` Can you calculate 5 to the power 3 using multiplication (`*`) and loops instead of the `**` operator? ## :pencil: Feedback Tell us at least one good thing and something we could improve by leaving feedback as post-its [on this interactive board](https://ideaboardz.com/for/SWC%20Feedback/3545691). Good things - Things to improve - At the very start of the day, the instructions to download the data and start a jupyter notebook is very simple, but the instructor went way too fast. I suspect that if we had gone a little slower, fewer people would have needed to go into breakout rooms. <span style="color:green"><- Thanks, we'll take that on board.</span> # Python - day 2 - Tom Dowrick ## :pencil: Notes Use a for-loop to convert the string "hello" into a list of letters: ```python= string = "hello" #add your code ['h', 'e', 'l', 'l', 'o'] # To create an empty list my_list = [] ``` ### Exercise 2 Plot the difference between the average inflammations reported in the first and second datasets (stored in inflammation-01.csv and inflammation-02.csv, correspondingly), i.e., the difference between the leftmost plots of the first two figures. Don't need to use for loops. ### Exercise 3 ```python= if 4 > 5: print('A') elif 4 == 5: print('B') elif 4 < 5: print('C') ``` What would be printed if you run this code? ### Exercise 4 Write a function that takes a string, and returns the first and last character. ```python= string = "hello" def my_func(string): # ...... return something x = my_func(string) # x = "ho" ``` ### Exercise 5 Write a command line application that takes a string and two numbers, and outputs those two characters from the string. e.g. hello 1 3 hl ## :question: Questions about Python 2/2 - Example question - [name=student_a] Example answer - [name=TA_1] Example answer ## :pencil: Feedback Tell us at least one good thing and something we could improve by leaving feedback as post-its [on this interactive board](https://ideaboardz.com/for/SWC%20Feedback/3545691). ###### tags: `swc` `teaching` `live-notes`

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully