The aim of this course design is to run all code on ERDA (central computer system for Science Faculty), so make sure that you can do so! However, one should also have Python (3) installed locally, as this is a better way to program in the longer run and on larger projects.
Most modern laptops already have Python installed, so always first check, if that is the case!
If that is somehow not the case, then we recomment using Anaconda, which is a framework for Python that also includes programs such as the jupyter notebook (and the editor called Spyder). It is required for Windows to easily install packages, and we recommend it for macOS and Linux users as well.
Since we will be using Python 3.6, you must install Anaconda. If you have Python 2.X (typically 2.7) installed, we strongly recommend that you upgrade this, since Python 3 is already 10 years old by now.
Python is often used with packages, which enables new (and often extremely useful) features possible in your programs. We will of course make use of packages (the most common ones, and a few specific for statistics), which in this course are mainly:
Anaconda will install its own Python version and a package manager. For them to work properly, Anaconda must add its path to the PATH environmental variable. However, Anaconda will PREPEND its path, meaning its Python version and its packages will supercede any Python installation and packages you already may have. This should not have any ill effects. If you experience issues elsewhere in your system or with your standard Python installation, try first to move the Anaconda path to the back of the PATH environmental variable.
Download and install Anaconda, Python version 3.6, from here.
Windows/macOS: You MUST select "Add Anaconda to my PATH" in the
advanced options page of the installer, if it's not already
checked.
Linux: You must TYPE yes (don't just hit enter!) when asked if you
want to add Anaconda to your path in your startup script.
Instructions for Windows 10 were put together in this document.
Anaconda comes with many common Python packages, including numpy, scipy, matplotlib, scikit-learn, etc.
We just need to install iminuit, which is a powerful and proper fitting tool (superior to numpy's and scipy's), and a helper package, probfit.
Windows: Open a command line (Win+R, type "cmd") and run the code
below one line at a time. Press y when needed.
Linux/macOS: Open your favourite terminal, e.g. bash, and run the
code below one line at a time. Press y when needed.
conda update conda conda install iminuit cd $HOME git clone git://github.com/iminuit/probfit.git cd probfit pip install cython --user pip install . --user
If you use Spyder, you will need to change one thing to run the scripts.
REQUIRED: Go to Tools - Preferences - Python interpreter - click
"Set UMR excluded (not reloaded) modules" - enter "iminuit,
probfit" into the box.
OPTIONAL: Go to Tools - Preferences - IPython console - Graphics -
Graphics backend - set it to "Automatic".
This will make figures open in new windows instead of being embedded
in the ipython console.
You should not follow these steps if you have Anaconda.
If you already have experience with Python and have packages and IDEs installed the way you prefer, these are the packages you will need immediately.
We recommend Python 3.6, though Python 2.7 also partially work (expect you have to do a bit of rewriting in the code).
If you will not be using Anaconda, run the following:
# Python 3.6.x: pip3 install --user --upgrade numpy pip3 install --user --upgrade scipy pip3 install --user --upgrade iminuit pip3 install --user --upgrade matplotlib # probfit must be installed like this: cd $HOME && git clone git://github.com/iminuit/probfit.git && cd probfit && pip3 install cython --user && pip3 install . --user && cd
Verify that everything works by opening Python and importing the above packages.