General coding advice - adam-coogan/GRAPPA_Student_Seminar_2019 GitHub Wiki

Python

The code should be written in python. If you're new to python, try looking at some of the links in these notes. Inevitably, you'll need to install and use the numerical and scientific libraries NumPy and SciPy and the plotting library Matplotlib.

Note that there are some differences between python2 and python3 (see here for a more detailed discussion). Try to stick to python3.

Git and GitHub

Git is a version control system that allows people to collaborate and merge their work more easily. In simple terms, you use git to keep track of changes in your code/files and to make sure that projects don't get too messy when multiple people work on them.

Projects in git are stored in repositories (like this one). We'll be storing these repositories (or 'repos') publicly on GitHub. It's probably best to make an account on GitHub (for free) so that you can manage your repos more easily.

Git can be used from the command line or using desktop applications (e.g. GitHub Desktop). There are a number of ways to learn about using git and github:

Jupyter

Jupyter notebooks are a way of combining code in python (or a couple of other languages) with plain text, LaTeX and in-line figures, so that you can present your code, calculations and research in an easily-readable format. You will need to install jupyter notebooks to make use of them.

Jupyter is great, because it allows people to view your code, plots and explanations all together. You can even present Jupyter notebooks directly in a web-browser using nbviewer - see e.g. this notebook. You can even let people edit and run your notebooks using Binder - use this notebook to uncover gravitational waves (just be patient while it loads).

Jupyter is also useful because it lets you do 'exploratory' coding. You write some code, plot some results to see what's happening and then explore from there. Don't be afraid to make plenty of plots to ensure you've checked and understand what your code does and the physical problem you're solving. You may find it useful to have 'scratch' notebooks for exploring and checking things, as well as 'clean' notebooks for presenting everything nicely.

Finally, a piece of advice: we recommend running Cell -> All Output -> Clear on your jupyter notebooks before you commit them to the github repo. The problem is that notebook outputs contain a lot of information in the form of text + figures and sometimes all this information doesn't play nicely with version control systems like git. To start with, at least, we recommend getting rid of the output before commiting to the repository. For a more detailed discussion, see e.g. this blog post. You may also want to work in separate notebooks and combine your code later.