SSBW - Python Tutorial 1: Introduction and Aftershock Rates

Mike Brudzinski, Miami University-Oxford
Author Profile
Initial Publication Date: August 18, 2021


In this interactive tutorial built for a learning management system, students 1) are introduced to the basic syntax of Python command line and scripts, 2) perform calculations regarding earthquake energy and time conversions, 3) use variables and a loop to estimate the Omori law rate of aftershocks over time, and 4) use GMT to make a plot of the output from Python.

Used this activity? Share your experiences and modifications



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, the GMT (Generic Mapping Tools) software, and a willingness 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 25 of 35 in the Seismology Skill Building Workshop (SSBW).


Content/concepts goals for this activity

Proficiency with Python, GMT, earthquake energy, earthquake aftershocks, and Omori's law.

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. Load Python versions 2 and 3 command lines to identify the differences in how print statements are handled 
2. Calculate the energy release from an earthquake magnitude and compare it to equivalent tons of TNT explosion 
3. Learn the different parameters in the Utsu's modified version of the Omori's law for aftershock rate decay 
4. Use variables in Python to set parameters and the Utsu-Omori law equation to calculate the expected rate of aftershocks 
5. Use a while loop in Python to calculate the expected rate of aftershocks at many different times after the main shock 
6. Plot the output values of earthquake rate using GMT and evaluate the pattern


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:


This assignment is automatically graded by the learning management system. The number of questions of each type used are:
20 multiple choice questions
3 multiple answer question
2 matching questions
12 numeric questions (number and magnitude of earthquakes, sampling interval, rate, frequency)
2 short answer (auto-graded) question
1 free response (all accepted) 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.