owned this note
owned this note
Published
Linked with GitHub
# 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`