We will be using Jupyter Notebooks with IPython extensively in this course. It would probably be best to have these things running on your local machine, if possible. The Stanford Unix compute system is also available to students, although we can't say how well Jupyter notebooks work remotely. An alternative, which we have not attempted at this writing, might be to import notebooks to Google Colaboratory and work with them in the cloud. Suffice to say that if you have computing issues, we will figure them out somehow.
Assuming you will be using a system that you have administrative access to, the first thing you will need is Python (versions >= 3). Note that the Python included as part of MacOS doesn't count - it is highly restricted due to being part of the OS, so you will want to install a separate copy if you are using a Mac.
The fastest way to get up and running is with Miniconda. This provides a user-specific installation, so there is no possibility of conflicts or permissions issues with the system you are working on. If you're tempted to go for full-blown Anaconda instead... please think twice. I haven't ever tried and can't help if something goes wrong, and have heard stories about things going wrong.
If you already have a Python installation, you can of course try to use it, installing any additional packages needed (below). We're not aware of any particular reason why the required packages should cause problems. That said, depending on what packages you're carrying around at what versions, it can happen. Falling back on a clean installation (or environment) is always an option.
... then you have a steep learning curve ahead of you, even though there will be a lot of example code to learn from. We recommend checking out the Python tutorial. Everyone can no doubt also appreciate the documentation for the Python standard library, NumPy and SciPy.
Once you have Python and either the conda
or pip
package manager (which you almost certainly will for no additional effort), you should be able to install and run either JupyterLab or classic Jupyter Notebook following these instructions. (Note for enrolled students: the classic Jupyter Notebook interface is preferred, as allows images to be directly embedded in your notebook solutions; see the demo.)
2023 note: I ended up with package conflicts when installing Jupyter through conda
, which they apparently do not recommend currently. Installing through pip
worked fine.
You'll need a number of python packages in this course. The shopping list is given in the requirements.txt file, which to the best of our knowledge reflects which packages are available through conda
(which should be used preferentially) as opposed to pip
. You will need to add conda-forge
to the default list of channels to get everything. For example,
conda install -c conda-forge astropy dynesty emcee matplotlib numpy pandas pygtc scipy statsmodels
or, to install these into a new environment,
conda create -n p366 -c conda-forge astropy dynesty emcee matplotlib numpy pandas pygtc scipy statsmodels
followed by (after activating the correct environment, if applicable),
pip install cashstatistic incredible jupyterlab lrgs
If it's at all helpful, here is my conda
environment for the class as of 2023.