Python files
Download these files to follow along with the screencasts or just for your use.
Bootcamp 1
Bootcamp 2
Bootcamp 3
Bootcamp 1
Text-based data files
AtlanticHurricaneHistory.csv (comma delimited) – text file, annual number of Atlantic hurricanes from 1851
ConcentrationData.txt (one entry per record) – text file, set of concentration data
furnacedata.txt (tab delimited) – text file, set of furnace fuel rate and flue gas CO2 vs. time
SaltDensity.csv (comma delimited) – text file, NaCl density vs. wt% and temperature
Python Script Files
array_operations-1.py – divide all elements of an array by a scalar
array_operations-2.py – adding two arrays
array_operations-3.py – vectorizing a polynomial calculation
array_operations-4.py – math module functions do not work with arrays
array_operations-5.py – numpy module functions do work with arrays
ConcentrationHistogram.py – histogram bar chart of concentration data
ContourAnalytical.py – contour plot of analytical function f(x,y)
ContourFilledAnalytical1.py – contour plot of analytical function with color-filled contours
convert_list_to_array.py – use of the array function to convert lists to arrays
eye_function.py – use of the eye function to create an identity matrix
figure_windows_example.py – finished plot of trig functions in two windows
figure_windows_example_starter.py – starter plot of trig functions in two windows
firstplot.py – plot of two y response sets vs. x
firstplot_withcomments.py – plot of two y response sets vs. x with added comments
FormattingExamples.py – illustration of different numeric formats
for_loop_example.py – example of for loop to sum positive elements of an array
functionfunction.py – passing a function name as an argument
functionwithnoarguments.py – example of a user-defined function with no arguments
functionfunctionwithpassthrough.py – passing a function name as an argument and pass-through arguments
functionfunctionwithpassthroughkeywords.py – passing a function name as an argument with keyword pass-through arguments
functionwithkeywordarguments.py – example of a user-defined function with keyword arguments
fuctionwithtwoarguments.py – example of a user-defined function with two arguments
IndexingExamples.py – indexing individual elements of a one-dimensional array
IndexingExamples2.py – using ranges of indexes to reference parts of an array
IndexingExamples3.py – indexing arrays with for loop index variables
iqr.py – function to compute the interquartile range using the percentile function
lambda_example1.py – example of an anonymous lambda function
matmult_example.py – user-defined function for matrix multiplication
matrix_inverse_example.py – example of the inv function for matrix inverse from the linalg module
NaClDensityContourPlot.py – contour plot of NaCl density vs. concentration and temperature
nested_for_loops_example.py – nested for loops to sum the squares of the elements of a 2-dimensional array
percentile1.py – function to compute percentile of a sorted array
percentile2.py – function to sort an array and then compute a percentile
plot_analytical1.py – formatted plot of analytical function f(x)
plot_analytical_start.py – simple plot of analytical function f(x)
plot_glycol_data.py – marker plot for glycol freezing point data
plot_glycol_data_starter.py – starter script for glycol freezing point scatter plot
plot_glycol_datalines.py – lines and markers plot for glycol freezing point scatter plot
random_continue.py – continue statement in a for loop to select only positive random numbers
reshape_examples.py – reshape array examples including the flatten method
reshape_examples1.py – reshape array examples including the reshape method
SaltandMgClDensities.py – plot of salt and MgCl2 densities vs. concentration
SaltandMgClDensities_AxesTicks.py – plot of salt and MgCl2 densities vs. concentration with axes ticks adjusted
scope1.py – illustrates scope limitations of local variables
scope2.py – illustrates local scope of local variables
scope3.py – illustrates global scope of variables in the main script
scope4.py – illustrates the use of the global declaration of a variable
sentinel_break.py – use of a sentinel to terminate user input
sgnsqr_function.py – simple user-defined function to square a number and carry the sign
SimpleListLoop.py – illustrates ho a for loop can be used with a list of values
stack_examples.py – showing how to stack two arrays vertically and horizontally
SurfaceAnalytical.py – shaded surface plot of analytical function f(x,y)
SurfaceMeshAnalytical.py – mesh surface plot of analytical function f(x,y)
transpose_example.py – example of the transpose method for arrays
Twinaxes.py – plot of furnace data with both left and right vertical axes
Twinaxeswithlegend.py – plot of furnace data with both left and right vertical axes and legend
TypeJ_TC.py – computing temperature from thermocouple e.m.f.
TypeJ_TC_with_input_validation.py – adding input validation to thermocouple calculation
VaporPressureH2O.py – log scale plot of H2O vapor pressure vs. temperature
VaporPressureH2O_starter.py – starter script for H2O vapor pressure plot
windpower_ParetoChart.py – Pareto bar chart of wind power data by country
zeros_function.py – use of the zeros function to create an array filled with zeros
Bootcamp 2
Text-based data files
H2SO4VaporPressure.txt (tab delimited) – text file: vapor pressure of concentrated H2SO4 versus temperature
Python Script Files
Absorber.py – six-stage absorber column – solution of linear algebraic equations
goldmin_1.py – user-defined function for Golden Section search to find minimum of humps function
multibatch_reactor.py – solving model for a batch reactor with multiple reactions with solve-Ivp
parasite.py – solving a parasitic ode using solve_ivp from scipy.integrate
polynomialfit.py – using polyfit function from numpy module to fit polynomial to methanol-water density data
SteamEquilibrium.py – solving water-steam equilibrium with the root function from scipy.optimize
TwoPointBC1.py – second attempt at solving 2nd-order ode with brentq to satisfy boundary condition
H2SO4VaporPressure.txt (tab delimited) – text file: vapor pressure of concentrated H2SO4 versus temperature
SaltDensity.csv (comma delimited) – text file: density of NaCl-H2O solutions for different wt% and temperature
Python Script Files
Absorber.py – six-stage absorber column – solution of linear algebraic equations
bisect1.py – function to implement the bisection method
brent1.py – use of the brentq function from the SciPy module
countercurrent_heatexchanger1.py – first attempt at solving countercurrent heat exchanger
countercurrent_heatexchanger2.py – solution of countercurrent heat exchanger with boundary conditions satisfied
goldmin_1.py – user-defined function for Golden Section search to find minimum of humps function
grainbin.py – optimizing grain bin design with constraints using minimize from scipy.optimize
maximize_humps.py – using the minimize_scalar function to find maximum of humps function
minimize_example.py – using the minimize function from scipy.optimize to find the minimum of multivariable function
minimize_humps.py – using the minimize_scalar function from scipy.optimize to find minimum of humps function
multibatch_reactor.py – solving model for a batch reactor with multiple reactions with solve-Ivp
MultilinearRegression.py – using matrix calculations to fit a multilinear model to salt density data
MultilinearRegressionStatsModels.py – using the ssm function from statsmodels.api to fit a multilinear model to salt density data
MultiNewton.py – Newton’s method for multiple nonlinear algebraic equations
NonlinearRegression.py – use of minimize function from scipy.optimize to fit Antoine equation to H2SO4 vapor pressure data
parasite.py – solving a parasitic ode using solve_ivp from scipy.integrate
parasite1.py – solving a parasitic ode with tightened tolerances
plothumps.py – plot of humps function to be used for optimization calculations
polynomial_example.py – use of the roots function from the numpy module to solve a polynomial
polynomial_example2.py – use of the polyval function from the numpy module
polynomialfit.py – using polyfit function from numpy module to fit polynomial to methanol-water density data
quad_example.py – use of the quad function from scipy.integrate for quadrature
root_function_example.py – use of the root function from scipy.optimize to solve nonlinear algebraic equations
simple_linear_set_linalg_solve.py – solving a set of linear algebraic equations using the solve function
SimpleBatch.py – using solve_ivp to solve an ode for a simple batch reactor
SteamEquilibrium.py – solving water-steam equilibrium with the root function from scipy.optimize
trapfunction.py – user-defined function for trapezoidal rule quadrature
trapz_example.py – use of the trapz function from scipy.integrate for quadrature of data
twoODEs.py – use of solve_ivp for two coupled odes
TwoPointBC.py – first attempt at solving 2nd-order ode with split boundary conditions
TwoPointBC1.py – second attempt at solving 2nd-order ode with brentq to satisfy boundary condition
watergas_solve.py – solving the water-gas shift equilibrium
watergasplot.py – plot of water-gas shift equilibrium
Bootcamp 3
Ammonia PBR Case Study
Simplified Model
Ammonia.py – script for the simplified model of the ammonia reactor
Full Model
AmmoniaFull.py – script for the full model of the ammonia reactor
Acetone Cracking PFR Case Study
Simplified Model
AcetonePFR_Simplified.py – script for the simplified model of the acetone reactor
Full Model
AcetonePFR_Full.py – script for the full model of the acetone reactor