For Students by Students a Python Programming Manual for Structural Engineering Courses
For Students by Students a Python Programming Manual for Structural Engineering Courses
Kennedy Angel Gomez, California Polytechnic State University, San Luis Obispo
Aaron Dewey, California Polytechnic State University, San Luis Obispo
Abstract
Learning to program is challenging enough for structural engineering students without the
complexity of using a textbook with examples from unfamiliar engineering and scientific fields.
Moreover, the open-source nature of Python means each library has a separate documentation
website to navigate, discern what functions are useful, and how to implement them.
The idea of a senior project to develop a Python manual tailored to structural engineering
students came from the authors’ experiences in three structural analysis/dynamics computing labs
in Cal Poly in San Luis Obispo’s architectural engineering (ARCE) curriculum. The team
recognized the barriers, lack of confidence, and frustration that learners faced with existing
programming resources. To determine the topics necessary to best support students in the labs
and later in structural design industry, two pre-project surveys were conducted with upper class
students and industry practitioners respectively.
This led to a 24-chapter document on Python programming topics, including libraries for
numerical and symbolic mathematics (NumPy, SciPy, SymPy) and creation of tabular and plot
outputs for communicating results in technical reports (Pandas, Matplotlib). The manual includes
explanations, graphics, and examples related to structural engineering for students to follow and
apply to coursework, along with exposure to industry usage. A complete draft of the manual was
implemented in the Fall 2023 offering of the first computing lab. Student comments were
collected throughout the course and formal surveys were conducted at the end of the quarter.
This feedback led to significant revisions of the document that was ultimately published for
public use in December 2023 via Cal Poly @ Digital Commons.
This paper summarizes pre-and-post project survey results, develop process and content of the
Python manual, as well as outcomes of the senior project team that worked to educate and
motivate their peers to program in Python.
Introduction
This paper describes the year-long process of developing a Python manual as an Architectural
Engineering (ARCE) senior project at Cal Poly in San Luis Obispo. The manual’s intent is to
support students as they learn to create programming tools to address various structural analysis
and dynamics problems in three upper division ARCE undergraduate courses. Having recently
completed these courses themselves, the student co-authors recognized barriers of student
success included not having a topic-specific course textbook, given that each Python library has
a separate documentation website and that existing coding textbooks for engineering students can
have examples which in their unfamiliarity generate more confusion.
Through this “for students, by students” resource, the 24 chapters of the manual provides
guidance that focuses on Python libraries that enable numerical and symbolic calculations, as
well as production of data tables and visualizations to communicate results through technical
reports and presentations. The topics for the manual were selected with intention as
programming functionalities that are directly relevant to structural engineering applications. The
tailormade content of this manual was informed by two pre-project surveys of prior students and
industry members, review of the target courses’ curriculum, and of multiple existing
programming textbooks and courses.
The goal with developing the programming manual is to address students’ knowledge gaps, build
confidence, and motivate them to learn how to program in Python. This is intended to provide
benefit past their immediate improved outcomes in the ARCE computing courses to beyond
graduation, enabling them as future structural engineers to leverage programming as a tool in
their careers.
Course Details
The undergraduate Architectural Engineering curriculum at Cal Poly in San Luis Obispo contains
three computing courses ARCE 352-354 taken in sequence at the junior level. These are paired
with the structural analysis lecture courses, that together, provide fundamental knowledge
necessary to proceed to the senior-level seismic analysis course. Table 1 shows each of the
structural analysis lecture classes with their paired computing class and its catalog description.
The lecture class has a 32-person enrollment that is generally three times per week at 50 minutes
a session, while the lab has a 16-person enrollment taking place once a week for nearly three
hours. The lab typically includes at least 1-1.5 hours of coding demonstration or discussion by
the faculty followed by in-class programming by students where they can ask questions of the
instructor and collaborate with one another. Lab assignments are typically due a week after they
are assigned which enables students to seek out external resources, friends, and the instructor
with additional questions. To date, the courses have not had a formal textbook on programming.
Table 1. Structural Analysis Lecture & Labs
ARCE 302 ARCE 352 Analysis of statically
Structural Analysis Structural Computing Analysis indeterminate structures using
virtual work, slope deflection,
the force method and plastic
analysis methods.
ARCE 306 ARCE 353 Analysis of statically
Matrix Analysis of Structures Matrix Structural Computing indeterminate structures by
Analysis direct stiffness method including
continuous beams, plane trusses,
and frames. Introduction to
finite-element methods.
ARCE 412 ARCE 354 Analysis of structures subjected
Dynamics of Framed Structures Numerical Analysis Laboratory to dynamic loads with single-
and multi-degrees of freedom.
Development of techniques for
analysis of structures in
response to time varying loads.
From a programming perspective the students are required to take CSC 231 Programming for
Engineering Students prior to ARCE 352. The catalog description for the CSC 231 course is as
follows: “programming techniques and procedures with applications to engineering problems.
Introduction to numerical methods and simulation.” This is typically taught using MATLAB,
though in Spring 2022 one pilot section was taught specifically for ARCE students in Python.
Project Background
The Cal Poly ARCE department began discussions of switching the teaching of ARCE 352-354
computing course sequence from MATLAB to Python during Fall 2020. Ultimately, the decision
to make the switch was motivated primarily due to the open-source nature of Python that would
make it more accessible to students as they entered the engineering profession while having
similar advanced functionalities of MATLAB. Specifically, the Spyder integrated development
environment (IDE) [1] was selected for instruction, since it has many color-coding,
autocomplete, and debugging features to aid newer learners to programming in Python. The first
offering of one of these classes in Python using Spyder occurred in the Winter 2021 quarter.
The faculty co-author was assigned ARCE 354 in the Spring 2021 quarter immediately following
this Python debut and did not teach it again until a year later in Spring 2022. The challenges in
the transition from MATLAB to Python syntax in Spring 2021 were understandable being that
students had taken all their programming coursework in MATLAB to that point. However there
still seemed to be significant gaps in coding knowledge and confidence in Spring 2022, after
students had already taken ARCE 352-353 in Python. This could be attributed to the fact that:
(1) there was no formalized textbook for the courses that focused on structural engineering
specific applications, to make concepts easier to relate to; and (2) that online resources for this
language are fragmented into separate library documentation websites, which make it more
difficult for a new learner to navigate. It was anticipated (and survey results shown later in this
paper suggest) that students need organized and topic-specific programming support beyond
instructor coding demonstrations and assistance they receive during lab or office hour sessions.
The original concept for the project was motivated by discussions with these students, and its
main objectives were captured in a recruitment email sent by the faculty co-author in July 2022
to those that had just taken the Spring 2022 offering of ARCE 354 with them:
“I am starting on a new project -- Python Manual for Architectural Engineering Students --
to serve as a supplementary document to students in [ARCE courses] which involve using
Python's capabilities specifically to solve structural engineering problems. I am seeking
1-2 students as collaborators for developing the example problem statements, preparing
sample code, and writing explanations. The objective is to help the future ARCE student
have greater access to information and build greater confidence in coding.” A brief topic
overview with twenty items was also included in the message.
The three ARCE student co-authors volunteered to take this on as their senior project and began
work in September 2022 by developing two pre-project surveys for past ARCE 352-254 students
as well as industry professionals. Their other major efforts in Fall 2022 were to conduct a
literature review of: (1) existing MATLAB [2, 3] and Python textbooks to understand content
and formatting of such a resource, (2) material from the CSC 231 pilot course in Python offered
to ARCE students during Spring 2022 to determine the programming knowledge students would
enter the ARCE computing classes with, and (3) past lab assignments from ARCE 352-354 to
identify a more detailed list of topics to address in the manual. To further the team’s knowledge,
one of the student co-authors also enrolled in the CSC 101 Fundamentals of Computer Science
during the Winter 2023 quarter that serves as the introduction to Python for computer science
majors, to glean additional information from this course that would be useful for developing the
manual. Together the students developed the majority of the manual between January and May
2023 with weekly meetings for feedback from the faculty co-author. The completed draft manual
was used for the first time in Fall 2023 in the faculty co-author’s instruction of ARCE 352, which
led to them making significant additions and revisions based on received student feedback.
After this tremendous student effort, the Python manual document was published within the
ARCE senior project report collection in December 2023 on the Cal Poly @ Digital Commons
repository [4] for use by other instructors and students. This resource is being treated as a living
public document managed by the faculty co-author who will continue to recruit student team
members to add topics to address relevant coding questions that arise in classes, ARCE
curriculum changes, and technology advancements impacting structural engineering practice.
Description of Pre-Project Surveys
Student Version
During the Fall 2022 quarter, a survey was distributed to senior and graduate ARCE students on
their programming experience coming into and during their university studies. This target group
would have completed most of, if not all, the ARCE 352-354 computing courses. The goal of the
survey was to establish a baseline of coding experience as well as identify course topics, methods
of instruction, and sources of motivation to integrate into the proposed Python manual.
Of the 28 survey respondents, 22 (79%) were seniors and 6 (21%) were graduate students. To
assess prior experience, students were asked when they were first introduced to programming in
any language: 13 (46%) had before undergraduate and the remainder had during university with
4 (14%) in freshman and 11 (39%) in sophomore years. Of the students with pre-college
exposure the majority was in high school with the JavaScript language through courses such as
Introduction to Coding or AP Computer Science and extracurriculars like Science Olympiad,
robotics club, or a university summer program. Those with their first encounter during university
were via CSC 231 in MATLAB language, the computer science pre-requisite course for ARCE
352. Despite this prior coding experience, 21 (75%) of the students were first introduced to
Python in junior year through ARCE 352.
Figure 1 summarizes responses from a series of 5-point Likert scale questions related to student
confidence on various Python skills from ARCE 352-354. For the survey questions presented in
Figures 1-3, students could select “N/A = I do not recall learning this topic (or using this
library)”, the average response shown in the figures are only for students that provided a ranking.
Figure 1. Pre-Project Student Survey: Confidence on Python Topics
(1 = Very Not Confident, 3 = Neutral, 5 = Very Confident)
Of the Python topics in Figure 1, students indicated a desire that more instruction time in the
coding labs had been spent on: (Priority #1) Interpreting Errors, (Priority #2) Plotting, and (Tied
for Priority #3) For Loops, Nested For Loops, While Loops, and Utilizing Different Libraries.
Figure 2 summarizes responses from a series of 5-point Likert scale questions related to student
confidence on various Python libraries.
Figure 3. Pre-Project Student Survey: Confidence on Coding ARCE 352-354 Topics in Python
(1 = Very Not Confident, 3 = Neutral, 5 = Very Confident)
The conclusion that can be made from Figures 1-3 is that there are a limited number of Python
skills or topics that the students felt a high level of confidence in, based on the average response
being equal to or exceeding 4.00. This leads to the question of how students had been getting
support in coding during these lab courses. Survey responses indicated the most used resource
was conducting an internet search (often leading them to the Python or a library’s documentation
website), followed by reaching out to friends, then seeking out YouTube videos, utilizing faculty
office hours, and lastly finding a textbook to consult (there was no assigned textbooks for these
courses, so these would have been found via a self-search). When asked what resources faculty
could provide in future course offerings to best support student learning, most respondents (93%)
indicated a PDF manual for performing certain skills/tasks in Python. This was a more popular
response than YouTube videos, a game website to practice coding, or a coding discussion forum.
Beyond collecting data on student’s prior programming experience and self-assessment of their
confidence on Python skills/topics in ARCE 352-354, the survey contained several questions to
gauge their perception of what value coding would have in their prospective career as structural
engineers. Of survey respondents, the majority (93%) had completed at least one summer
internship in the architecture, engineering, or construction (AEC) fields. In these positions,
almost all (86%) had utilized some form of programming with Excel being the most prevalent
and used “often/very often”, with a few instances of Python and MATLAB used “sometimes”.
There was a much greater range and higher level of usage when asked about commercial
structural analysis software (in rank order, for 10+ responses: RISA, ENERCALC, Simpson
Strong-Tie, Hilti). When queried about how often they anticipate using their programming skills
during their career in general, and for Python specifically, the average answers for both questions
were in between “rarely/sometimes”. This response is likely impacted by the fact that students do
not perceive their coding skills as transferable to Excel and that the use of languages they have
been taught, Python and MATLAB, being infrequent in industry. Also, there may be some impact
from the fact that on average students indicated that programming is more difficult than their
other engineering classwork which may result in a negative perception around this skill set.
In each of the chapters, examples are ordered by level of difficulty so that students can see a
basic version of the concept being taught and then be introduced to further layers of complexity.
Figure 5 includes three examples from Chapter 18 Plotting Line & Scatterplots.
Basic level, Example 18.1.1: only includes x and y coordinates plotted against each other
Intermediate, Example 18.1.2: adds x/y axes labels and a title
Advanced, Example 18.1.3: changes line and marker style/color, enforces x/y bounds,
adds a text label with arrowhead and leader line to a point of interest on the graph
Typically, the chapters present different versions of what advanced might mean so students begin
to understand the range of functionality that Python has to assist them with coding solutions for
structural engineering problems. Another advanced line plot can be found in Example 18.3.2 of
the manual (not shown here in the interest of space) which produces subplots of shear and
moment diagrams for simply supported and cantilever beam cases using a nested for loop.
The authors find that it is critical to build up student understanding gradually, rather than
presenting the advanced example at the onset as this can be overwhelming and not clear how
each code segment is impacting the output.
(a)
(c)
(b)
Figure 5. Progressive Example Complexity: Line Plot (a) Basic, (b) Intermediate, (c) Advanced
Engineering students are taught to draw figures like free body diagrams as a visual tool to
describe the loads on a structure to help them complete their associated calculations of reactions,
shear, moment, and so forth. This practice of drawing diagrams can and should be extended to
sketching diagrams to understand variable structure and coding logic, prior to writing any code.
An example for understanding variable structure, Figure 6 shows code and a simple figure from
Example 7.2.1 in the manual which illustrates the structure of a list by labelling the index value
of each entry and using an arrow with tail and head to indicate which of those entries’ index
values falls within the selected range to be printed. This logic can be extended to extracting the
correct matrix entries in static condensation that would be relevant for matrix structural analysis
or in structural dynamics type problems.
Figure 6. Code & Graphic for Understanding Variable Structure: Slicing a List
Figure 7. Code & Graphic for Understanding Decision-Making Logic: If, Elif, Else Statement
In both scenarios, the aim is for students to make use of the simple examples from the manual
that model both drawing and coding skills to later apply this approach to more complex
structural engineering programming problems with greater confidence.
There are also general troubleshooting tips, and Chapter 24 Where to Get Help & Additional
Resources provides many other platforms to get further Python information.
Motivation Stations
The most common question when learning new material for students of any age is: “why do I
need to learn this?” Which as they mature as learners transforms into: “what value will I have for
this [Python coding] when I enter my structural engineering career?” The motivation stations that
appear in various locations in the Python manual use the pre-project industry member survey
results and other anecdotes from practitioner applications of programming to answer that
question. The objective is to connect what students are learning in ARCE computing classes with
a potential use on a real-world engineering project. Figure 9 shows an example of a motivation
station that is found in Chapter 14 Accessing Files.
Figure 9. Motivation Station: Reading Files
Supplementary Files
Additional data input files and other support material for the Python manual are available in a
folder under the Supplemental Project Files of the Cal Poly @ Digital Commons entry [4].
Summary of ARCE 352 Student Assessment
At the end of the Fall 2023 quarter, a survey was distributed to students who had just completed
ARCE 352 to gauge their feedback on the course as whole and specifically the Python manual.
This was the first time that the manual, in its complete draft form, had been implemented in the
classroom setting. Feedback provided by students in real-time during the computing lab sections
as well as through this survey were considered in the edits for the final published version.
Comparisons to the Pre-Project Student Survey
Many of the questions are consistent with those in the pre-project student survey (PPSS).
Therefore, the distinctions between those sets of survey results will be discussed first. Note that
ARCE 352 is a first-quarter junior class and so students have much less programming experience
in the academic setting as well as limited exposure to observe the coding of applications or use
of commercial structural analysis software in industry.
For the 17 survey respondents, the proportion of students that had first introduced to any
programming language before undergraduate was nearly half that of the PPSS group at 4 (24%)
and the rest in undergraduate with 1 (6%) in freshman and 12 (71%) in sophomore years in the
CSC 231 course. Most respondents (88%) had taken sections of CSC 231 that used MATLAB,
but the remainder (12%) were in a pilot section using Python. Even with this pilot section that
had not been available to the PPSS students, a greater proportion (82%) of the current students
had not encountered Python until ARCE 352.
Figure 10 compares responses to 5-point Likert scale questions on student confidence for various
Python skills between the PPSS and ARCE 352 students. As before, “N/A” was still an option.
Figure 10. Pre-Project vs. ARCE 352 Student Survey: Confidence on Python Topics
(1 = Very Not Confident, 3 = Neutral, 5 = Very Confident)
In Figure 10, for most Python skills the PPSS students report a higher level of confidence, which
likely results from the fact they have more quarters of coding practice and also have encountered
programming assignments that more frequently use the more complex skills on the list. For
example, many ARCE 353 assignments require setting up and manipulating matrices, and in
ARCE 354 students create multiple functions in a separate file to compute dynamic response due
to various forcing functions. Instances where ARCE 352 students tend to rank higher in
confidence are skills required on nearly every assignment, like setting up lists containing variable
values and printing output to the command window or Excel.
Of the Python topics in Figure 10, students indicated additional focus in the Python manual be
provided for: (Priority #1) Plotting, (Priority #2) Lists, and (Tied for Priority #3) Nested For
Loops, If/Elif/Else Statements, and Utilizing Different Libraries. This shows some variation from
the PPSS students when asked which topics merited extra instruction time.
Figure 11 compares responses from a series of 5-point Likert scale questions related to student
confidence on various Python libraries between the PPSS and ARCE 352 students.
Figure 11. Pre-Project vs. ARCE 352 Student Survey: Confidence on Python Libraries
(1 = Very Not Confident, 3 = Neutral, 5 = Very Confident)
Figure 11 illustrates again that the PPSS students have higher to much higher confidence in many
libraries, except in cases where ARCE 352 had more frequent and recent exposure. Of the
Python libraries in Figure 11, students indicated a desire for added focus in the Python manual
for: (Priority #1) Matplotlib, (Priority #2) Pandas, and (Priority #3) Numpy.
Figure 12 compares responses from series of 5-point Likert scale questions related to student
confidence on implementing ARCE 352 concepts in Python between the PPSS and ARCE 352
students.
Like in the PPSS version, this survey contained industry-related questions. A much lower
proportion (37.5%) of ARCE 352 students had completed a summer internship in the AEC field
and only one had programmed in Excel. Again, there was far greater diversity and frequency of
use of commercial structural analysis software (in rank order: ENERCALC, RISA, Simpson
Strong-Tie, ETABS, etc.). Despite a limited number of these juniors having had internships and
coding in a work setting, they had a slightly higher perception than the PPSS cohort of
programming usage in industry, both in general and Python specifically. This response did not
seem to be as negatively impacted even given these new learners reported enjoying programming
work less, find it more difficult, and put more time in than for their other coursework.
The results indicate an above average rating for the draft Python manual in all categories.
However, the in-person student questions during the Fall 2023 ARCE 352 sessions and office
hours about coding the assignments in general, and specifically on the manual, was far more
informative to the editorial process that took place in three major phases – September,
November, and December 2023. These student comments led to modifications in: