< Preface | Contents | Python fundamentals >
All modern biomechanics relies on a computer in some part of their scientific workflow. Some only use computers as word processing devices. Others may use computers that collect and analyze data.
This course introduces ways to harness computers to accomplish and automate most aspect of research.
This is not a pure biomechanics course nor a pure programming course. This course is about what happens when those two worlds collide. This course is about computational biomechanics.
Developers use Python to work on small, personal projects all the way up to some of the largest internet companies in the world:
Python is the fastest-growing, the four most popular and is the second most loved programming language.
import pandas as pd
import altair as alt
%load_ext lab_black
df = pd.read_csv("../data/google-trends.csv", parse_dates=["Date"]).melt(
id_vars="Date", var_name="Language", value_name="Interest"
)
alt.Chart(df).mark_line().encode(
alt.X("Date", title=None), alt.Y("Interest"), alt.Color("Language")
).properties(title="Google Trends interest over time")
alt.Chart(df.query('Language == "Matlab"')).mark_rect().encode(
alt.X("month(Date)"), alt.Y("year(Date)"), alt.Color("Interest"),
).properties(title="Matlab is seasonal")
This great popularity has three advantages for you:
MATLAB is proprietary, closed-source software. For most people, a licence to use MATLAB is quite expensive, which means that if you have code in MATLAB, then only people who can afford a licence will be able to run it. Plus, users are charged for each additional toolbox they want to install to extend the basic functionality of MATLAB. Aside from the cost, the MATLAB language is developed exclusively by Mathworks. If Mathworks were ever to go out of business, then MATLAB would no longer be able to be developed and might eventually stop functioning.
Your Academic Matlab setup will cost your employer (or you) USD 17,840 / user / year ($\approx$ CAD 23,500) once graduated.
Product | Cost/user/year |
---|---|
Bioinformatics | 400 |
Control System | 400 |
Curve fitting | 400 |
Data acquisition | 400 |
Image Processing Toolbox | 400 |
Instrument Control Toolbox | 400 |
Parallel Computing Toolbox | 400 |
Signal Processing Toolbox | 400 |
Statistics and Machine Learning Toolbox | 400 |
Symbolic Math Toolbox | 400 |
Global Optimization Toolbox | 400 |
System Identification Toolbox | 400 |
Optimization Toolbox | 500 |
Simulink Control Design | 500 |
Deep Learning Toolbox | 500 |
Partial Differential Equation Toolbox | 500 |
Wavelet Toolbox | 500 |
DSP System | 540 |
Computer Vision Toolbox | 540 |
Econometrics Toolbox | 740 |
Financial Toolbox | 740 |
MATLAB Compiler | 800 |
MATLAB Compiler SDK | 800 |
Matlab | 860 |
Simscape | 860 |
Simscape Multibody | 860 |
Stateflow | 1200 |
Simulink | 1300 |
SimBiology | 1300 |
TOTAL | 17,840 |
In science using open-source software has some pretty big benefits.
Paul Romer, the 2018 Nobel Laureate in Economics, is a recent convert to Python. By his estimation, switching to open-source software in general, and Python in particular, brought greater integrity and accountability to his research. This was because all of the code could be shared and run by any interested reader.
For all of these reasons, and many more, Python is an excellent choice to replace MATLAB as your programming language of choice.
We recommend Miniconda to use python and manage libraries.
Miniconda is a Python distribution that comes with Conda, which we will then use to install everything we need. If you have not done so already, please download and install Miniconda or use Binder to avoid installation troubleshoot.
We recommend:
Jupyter lab for analysis
PyCharm for software development (writing complex functions, packages, etc.)
conda install jupyterlab -c conda-forge # install jupyter lab
cd tutorials # go into tutorials directory
conda env create # install dependencies
conda activate tutorials # activate the course environment
jupyter lab # open jupyter lab
< Preface | Contents | Python fundamentals >