MPHY0021 21-22
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • 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
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy 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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # MPHY0021 - Day 4 (28th October 2021) :::info ## :tada: Welcome to the fourth day! :capital_abcd: and :snake: ### Today Today we will look at programmatically working with data files and sources in Python. - Review the homework and answer questions - Continue analysing the earthquakes dataset and create a plot - Review each other's solution and discuss ::: ### :stopwatch: Time keeper - [name=Jenny] :raised_hand: 5' before the end. - 10:00 - 10:50 - 11:05 - 11:55 - 12:05 - 12:55 ### Review from last week - Python syntax and language features - Built-in Python data structures (e.g. lists, dictionaries) - Homework: using comprehensions to iterate over data #### What was discussed during the week :newspaper: - Working with files in Python - Programmatically reading and writing structured data (CSV, YAML, JSON) - Getting data from online sources - Producing plots - Collaboration videos - [New wiki](https://github.com/UCL-MPHY0021-21-22/RSE-Classwork/wiki) to share your favourite tools, tricks and whatever you want (you can see updates on the sidebar in moodle). ### Coursework Will be released this week. Some more information at the end of the lesson! ### Groups :handshake: We will be using the breakout rooms functionality of Zoom. We have the following groups, and each group have its own document. Each week you will be in a randomly allocated group. Once in your breakout-room, find who is chairing that room and open the document linked to that group. :::danger Remember to `rename` yourself by clicking on your zoom name (in the participants list) and change it to: `SGX - Your name` being `X` the number of the group you have been assigned to. If you disconnect and connect again, please rename yourself again. ::: :::warning :question: What was the last programming language you used outside of this course, and for what? ::: > [name=Anastasis]/ he&him&his / - [Group 1: Anastasis](/NwXWn_9kQh-GVJacbCrzjw) - [Group 2: Alessandro](/v5AEw8vPR-Se0T-8QHHdzw) - [Group 3: David](/FzBNEpU0SGehsy6SsYq53Q) - [Group 4: Matthew](/UuvRw_juR1-oSWPqDX1iTQ) - [Group 5: Nisha](/RhQuVZjYTwuiMhcbP0Y_4w) - [Group 6: Nina](/oPQ4-QhDRVKJ3cwHeODdww) - [Group 7: Sarah](/0m09UNt7RKKi1hmSXxJkTA) ### Poll: homework :::info Two quick questions about the homework exercise. Go to [the voting page](https://www.menti.com/t573r94inv)! ::: ### Discussion of homework In your teaching groups from the introduction, discuss the exercises you did before the class. What did you find difficult or useful? What surprised you in other people's solutions? Choose one person from the group to add notes below. - Group 1: - Group 2: - Group 3: - Group 4: - Group 5: - Group 6: - Group 7: ### Poll: Data formats :::info Which data formats have you used and for what? Go to [the voting page](https://www.menti.com/t573r94inv)! ::: ### Exercise: Plotting the quakes dataset :::info For this exercise, we will work with the same data to produce two relevant plots! In smaller groups, discuss what steps you need to take, come up with a plan, and start developing your solution. Classwork repo: [:hash::one::five:](https://github.com/UCL-MPHY0021-21-22/RSE-Classwork/issues/15) If you need help, you can ask for us to drop in, following [these instructions](https://www.youtube.com/watch?v=yIOMPRLQIHA). ::: ### Dicsussion of the plotting exercise Back in your groups from the introduction, discuss the exercise. For example: - Could you reuse your previous work easily? Why/why not? - Did you use any external libraries? - What was the hardest part? Ask about things you were unsure of, and point out anything you found interesting or unexpected. Choose one person from the group to add notes below. - Group 1: - . - . - . - Group 2: - Some people were new to the whole thing of working with python and plotting in matplotlib. Some people just more familiar with MATLAB as tool for doing all their processing data and generating plots that matplotlib is a bit unfamiliar. - Due to different experience, different participation rates - Plotted a histogram (rather than a line plot). Could not get x axis to line up properly. Graphical issues - Sometimes the groups were interrupted too much, as this breaks the flow of working. It would perhaps be better to let groups just get on with it if they know what to do. - Group 3: - stuck plotting the historgram. Numpy and mpl - mpl.histogram, list comprehensions, - . - My group are not finished at the end due to the error of plt, which are not the right version, but the code we write the teacher think is correct. - get stuck; use dir in np and plot, hard to get one array in data and plot in histogram. - Group 4: - Could use a little bit of the homework. But wanted to start on the same page with everyone. - External libraries: Numpy, Pandas, - Hardest part: Getting all the data from the json file, the year, etc. Manipulating the data like average magnitude. - Some contributed more in the group than others. - Group 5: - Need to explain and demonstrate structured data first to those who don't have much experience. - Working from the sample solution, which is a bit of struggling. - Group 6: - Bit of a struggle to plot the data. Not familiar with matplotlib. - Working with other people that helped each other - . - Group 7: - Efficient to work in groups. - Difficulties of amending data structures. - Different libraries are useful, was looking for ways to improve the efficiency. - Getting code online is helpful when trobles occurs. - Dictionariy is hard and important here. ### Homework - Feedback form on Moodle - Optional resources on other data formats, plotting frameworks (links in Moodle!) and databases - Preparation for week 5 # Questions :::info Feel free to add any question below. Remember the syntax: ``` - Example question - [name=student_a] Example answer - [name=TA_1] Example answer ``` ::: - - [name=] - . - [name=...] - . - [name=...] ###### tags: `mphy0021` `teaching` `class`

    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