This repository contains all lectures from the course Scientific programming in Python that is part of the Cognitive Science program at the University Osnabrück. Each lecture is accompanied by a Jupyter notebook that explains each topic with a combination of code and text. You can view the notebooks directly on GitHub or run them locally and play with the code. If you do not want to install anything, click on the Binder logo above to run all the notebooks in a ready to use environment in the cloud.
All lecture recordings from 2018 and 2019 can be viewed on Youtube and on the Opencast platform (which is available only to students of the University of Osnabrück).
Lecture | YouTube 2018 | Youtube 2019 | Opencast 2018 | Opencast 2019 |
---|---|---|---|---|
Introduction | View | Part 1, Part 2 | View | Part 1, Part 2 |
Basic Python | View | Part 1, Part 2 | View | Part 1, Part 2 |
Advanced Python | View | Part 1, Part 2 | View | Part 1, Part 2 |
Numpy | View | Part 1, Part 2 | View | Part 1, Part 2 |
Matplotlib | View | Part 1, Part 2 | View | Part 1, Part 2 |
Basic Pandas | View | Part 1, Part 2 | View | Part 1, Part 2 |
Pandas: Cleaning Data | View | Part 1, Part 2 | View | Part 1, Part 2 |
Pandas: Analyzing Data & Time Series | View | Part 1, Part 2 | View | Part 1, Part 2 |
Debugging in Pycharm | View | View | ||
Statistical Visualization (ggplot, seaborn) | View | Part 1, Part 2 | View | Part 1, Part 2 |
Statistical Modeling (statsmodels) | View | Part 1, Part 2 | View | Part 1, Part 2 |
Experiments (expyriment) | View | Part 1, Part 2 | View | Part 1, Part 2 |
Study: A to Z, Scikit-Learn, Parallelism | View | View | ||
Interactive Visualization (Widgets, Altair) | View | View | ||
Data Exploration, Performance-Optimization | View | View |
To view the Jupyter Notebooks corresponding to the videos of the respective years, access this repository's state from 2018 or 2019, respectively. To access the videos in the better Opencast-player, make sure you're logged into Myuos before clicking the link.
Create a virtual Python environment, name e.g. scientific, for example using conda
.
$ conda env create -f environment.yml
Activate the environment
$ conda activate scientific
you might see some error like your shell has not been set up to use conda activate
. Follow the instructions given in your shell to make it work.
then start JupyterLab
$ jupyter lab
JupyterLab should open in your browser. From there you can navigate to the notebooks and interact with them.
Before committing changes, run the whole notebook from top to bottom using (for fish
)
$ env RUNALL=1 jupyter nbconvert --execute --allow-errors --inplace lecture.ipynb
for bash
$ export RUNALL=1 jupyter nbconvert --execute --allow-errors --inplace lecture.ipynb
To make new interactive exercises install jupyter-solutions and set up as teacher, by setting
c.JupyterLabRmotrSolutions.role = "teacher"
in the repositories jupyter_notebook_config.py
.
Only use markdown headers to structure the lectures. Numbering will be automatically handled by the jupyterlab-toc extension. Also use markdown to talk about the content of the lecture and the next cells. Use comments only if you want to highlight something in a specific line of code. If you write comments, write them in full sentences.
Use nbdime
to make working with notebooks and git easier
pip install nbdime
nbdime config-git --enable
- Some parts of this lecture base on Jake VanderPlas' Python Data Science Handbook, which is a very good source for Scientific Python.
- Thanks to Auss Abbood for making 2018's videos YouTube ready!