Introduction to scientific programming with python. Basic data types, sequences, input/output, and program control flow structures. Evaluation and plotting of mathematical functions and data. Statistical interpretation of data, and fitting of data to models. Introduction to numerical methods including integration, solutions of ordinary differential equations, and linear algebra. Extensive use of the numpy, matplotlib, and scipy packages.
In this class we will also introduce git to submit the labs and final coding project.
We used to recommend installing anaconda python from Anaconda. but this year we are switching to JupyterLab Desktop. This is a separate app that looks like running jupyter in a browser, but is not using your browser. It also comes with python embedded, so there is no more need to install python separately.
Installation will outlines in Homework1 in your ELMS page.
Interactive inside a browser or this year (in 2025) the new JupyterLab Desktop See https://github.com/jupyterlab/jupyterlab-desktop.
a nice figure should go here
Interactive in a special GUI, much like MATLAB. Comes with anaconda3. See https://www.spyder-ide.org/
a nice figure should go here
Google colab is another way, using Google's cloud services, to work with jupyter notebooks. See https://colab.research.google.com
a nice figure should go here
Converting your python code in spyder to/from jupyter notebooks can be done with a cool tool called jupytext. To install:
pip install jupytext
Conversion between a notebook (.ipynb) file to a spyder (.py) file:
jupytext --to ipynb test.py
jupytext --to py test.ipynb
There are also ways in spyder to automatically keep your spyder python file synchronized to a notebook.
Here are some places to find Open Source codes in Physics and Astronomy
-
Astrophysics Source Code Library (ASCL) : https://ascl.net
-
Journal for Open Source Software (JOSS): https://joss.theoj.org/
-
Zenodo : https://zenodo.org/
more details in code_project.md
Also some self-guided and OS agnostic lessons on:
- Unix shell (even on Windows) : https://swcarpentry.github.io/shell-novice/
- Python : https://swcarpentry.github.io/python-novice-inflammation/
- Git : https://swcarpentry.github.io/git-novice/
The spyder tool we are using has excellent help on python: both syntax and API. But if you want something in parallel to always have online:
- Zeal (for Linux and Windows)
- Dash (for Mac) - free alternatives are: dasht and devbook