Python Code

Links to Python code appears in various locations on this website. One way to copy and 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.

(By the way, I recommend that you use the free community version of PyCharm to edit & run this Python code. It is especially my extensive use of MatPlotLib’s waitforbuttonpress() function that increases the appeal of PyCharm compared with certain 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 January 30, 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

The file G2.zip (updated February 10, 2025) contains the Python code for the linear/nonlinear and static/dynamic finite element code that is particularly helpful in CIVL 509 Nonlinear Structural Analysis.

OpenSees

The file OpenSees.zip (updated July 15, 2024) contains a few input files for running OpenSees via its OpenSeesPy interface.

Ground Motions

The file GM.zip (updated July 15, 2024) contains a few ground-motion related files. At present, this collection is very limited, but new developments related to stochastic ground motion models will be added during 2025.