SSBW - Python Tutorial 2: NumPy and Matplotlib modules
Summary
In this interactive tutorial built for a learning management system, students 1) practice using the basic syntax of Python command line and scripts, 2) use the functionality of the NumPy module to create arrays and manipulate them, 3) use arrays to store trigonometric wave functions, 4) use Matplotlib module and pyplot functions to make plots of these functions, and 5) evaluate how changes in wave amplitude, frequency, period, or type influence the results.
Context
Audience
The IRIS Seismology Skill Building Workshop (SSBW), which is a free, online, open-access, large-enrollment, 12-week summer workshop for upper level undergraduates.
Skills and concepts that students must have mastered
This assignment builds on prior experience using a Linux command line environment, Python syntax, variables, and print functions, along with the ability to retrieve relevant information about programming and seismology from internet research or help pages.
How the activity is situated in the course
This is assignment number 26 of 35 in the Seismology Skill Building Workshop (SSBW).
Goals
Content/concepts goals for this activity
Proficiency with Python, NumPy, arrays, Matplotlib, and wave concepts.
Higher order thinking skills goals for this activity
Retrieving relevant information from digital sources to accomplish tasks, using correct programming syntax, evaluating and describing computing output in the context of science concepts.
Other skills goals for this activity
Description and Teaching Materials
Students will:
1. Use NumPy to create and use arrays in Python
2. Calculate the seismic energy release from an array of earthquake magnitudes
3. Create a Python script with NumPy used to store a sin and tan wave function in arrays
4. Use Matplotlib pyplot functions to plot the stored sin and tan waves
5. Manipulate the waves by adjusting script variables for the frequency and amplitude
6. Adjust the plotting parameters to tailor the plot
Teaching Notes and Tips
This assignment was constructed in the Moodle learning management system, and has been exported in the GIFT format. More information about the syntax of this format can be found here: https://docs.moodle.org/en/GIFT_format
Assessment
This assignment is automatically graded by the learning management system. The number of questions of each type used are:
17 multiple choice questions
3 multiple answer question
1 true/false question
8 numeric questions (number and magnitude of earthquakes, sampling interval, rate, frequency)
7 short answer (auto-graded) question
References and Resources
During the Seismology Skill Building Workshop, students are provided with a virtual Linux machine that was tailored to include the software specifically needed to complete the assignments. This software is all freely available on the internet, but interested parties are encouraged to contact the instructor for access to this tailored virtual machine.