Python Code

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.

NOTE: Some of the links above connect to a Dropbox storage. That means you will see a list of all the files in the zip package. Near the top of that page there is a Download link (small arrow pointing down to horizontal line). In the dialog box that appears, there is NO NEED to sign in to Dropbox.  Instead, just click on “Or continue with download only” at the bottom of the dialog box, to quickly download the zip-file to your computer.