Links to Python code appears in various locations on this website. One way to use the code is to scroll down the page that displays it, and click View Raw in the lower-right corner. Thereafter, copy & paste the code into your Python editor. The page you are now viewing offers a more efficient way to download more code at once. Below you find several compressed zip-files, each with a collection of files posted on this website. I gently recommend that you use the free community version of PyCharm to edit & run this Python code. It is especially my use of MatPlotLib’s waitforbuttonpress() function that increases the appeal of PyCharm compared to other environments. See this video, also linked on the Basics page, to get started with Python and PyCharm.
Structural
The file Struct.zip (updated February 13, 2025) contains a collection of Python code for cross-section analysis, linear static structural analysis, plastic capacity analysis, and dynamics.
Reliability & Optimization
The file RelOpt.zip (updated December 29, 2025) contains a collection of Python code for reliability and optimization analysis. The reason why the files from those two categories are in one batch is that FOSM and FORM reliability analysis employs optimization algorithms. This batch of code is particularly relevant for CIVL 518 Reliability and Structural Safety.
G2 & Recorded/Synthetic Ground Motions
The file G2.zip (updated January 2, 2026) contains the core G2 files PLUS examples and ground motion files.
OpenSees
The file OpenSees.zip (updated July 15, 2024) contains a few input files for running OpenSees via its OpenSeesPy interface. See the OpenSees and OpenSeesPy websites, and the neat Portwood Digital site, for lots of additional information & examples.