Authors: Nick Galitzki, Subhajit Ghosh, Vivian Sabla, Elle Shaw
Here are lectures and notebooks prepared for a CMB Analysis Summer School, hosted at the University of Texas at Austin on May 7-10, 2024. Our notebooks and files,
contained in UT_Notebooks, are based on the CMB-S4 CMB Summer School notebooks written by Jeff McMahon and Rene Hlozek (found at https://github.com/jeffmcm1977/CMBAnalysis_SummerSchool).
Before the UT Summer School begins, we ask that all participants install the notebooks and necessary software so we can work out any installation problems outside of our valuable course schedule. We also ask that all participants work through the Day0_FFT_intro_CMB_School.ipynb Jupyter notebook which provides a brief introduction to Fourier Transforms, an integral mathematical concept for understanding the CMB and the work to be done in this school. Please follow the installation instructions below to install all necessary notebooks and software on your local machine.
We have provided a conda environment defined in CMBSchool_environment.yml which provides an easy set up of a virtual environment with all the dependencies installed in order to run the notebooks needed for this summer school. This however requires conda to be installed on your local machine. Instructions for installation on different operating systems can be found here: Conda Installation.
From the command line...
-
Clone this repository with the command
git clone https://github.com/TexMExLab/UTAustin_CMBSummerSchool.gitor manually download the repository to your local machine, and naviagate to the
UTAustin_CMBSummerSchooldirectory. -
Within the
UTAustin_CMBSummerSchooldirectory, create the virtual environment viaconda env create --file CMBSchool_environment.yml -n CMBSchool -
Activate your new environment
conda activate CMBSchool -
Add this environment to your Jupyter kernel
python -m ipykernel install --user --name=CMBSchoolNote: this step may not be necessary, but different machines behave differently and it doesn't hurt.
-
Open the Jupyter notebook
Day0_FFT_intro_CMB_School.ipynbin theUT_Notebooksdirectory and run the cells under the "Necessary packages for UT CMB Summer School" heading. If all the cells evaluate without an error, you've successfully installed everything!- If any package does not properly import, try to install it directly from its source (google is your friend here). For problems importing
CLASS,pyactlike, orcobaya, please reach out to the summer school organizers directly as the installation can be more involved. - Note: open the Jupyter notebooks in whatever way you like, i.e. via the command line by running
jupyter notebookor through a code editor like VSCode. If you have no experience with Jupyter notebooks, please contact the summer school organizers prior to the school.
- If any package does not properly import, try to install it directly from its source (google is your friend here). For problems importing
We will also be using a repo called jbolo, this does not need to be installed, but you do need to download it:
- git clone https://github.com/JohnRuhl/jbolo.git
- For notebooks we use it with on Day 1 (coming soon!), you'll need to import sys and add sys.path.append('/path/to/jbolo/python') to each notebook.
- DOWNLOAD 1 GB atosphere file http://pbfs.physics.berkeley.edu/BoloCalc/ATM/atm_20201217.hdf5
- More detailed instructions exist on that repo if you have issues
If you get stuck on any part of the installation process, please reach out to the summer school organizers for help!
If you run into problems installing pyactlike through the provided conda environment, try a manual installation, described below.
-
Within the
UTAustin_CMBSummerSchooldirectory, clone thepyactlikerepository:git clone https://github.com/ACTCollaboration/pyactlike -
Manually install the code with the commands
cd pyactlike python setup.py install pip install . --user
Similarly CLASS may need to be manually compiled and installed. Detailed instructions can be found on the CLASS Wiki. We outline them below:
-
Within the
UTAustin_CMBSummerSchooldirectory, clone theCLASSrepository:git clone https://github.com/lesgourg/class_public.git class -
Compile the main code
cd class makeThe
makecommand is set to create the class executable, the librarylibclass.a, and the Python wrapperclassywhich is what we will be using. Don't worry if the compilation returns lines a few lines of warning, this is normal. You can test the installation with the command./class explanatory.ini. The first line should start withRunning CLASS version ...and the last line byWriting output files in ....If this worked, you can test that the Python wrapper was also compiled successfully by tryingpython >>> import classy >>> exit()If python does not complain with the
import classycommand, your installation was successful. If unsuccessful you can peruse some of the likely compilation issues on the CLASS Wiki or reach out to one of the Summer School organizers for assistance.
Tips from personal experience: The most typical problem with installing CLASS on a Mac is the C-compiler being used. There is a dedicated section on the CLASS Wiki for fixing this problem.
- Anaconda has issues with installing Class (10 points to whoever can sort that out). Alternative approach that has worked for some is installing WSL, Windows Subsystem for Linux, and installing relevant packages there.
- Install Anaconda https://www.anaconda.com/download
- Open the CMB school notebooks using Jupyter Lab or Jupyter applications on Anaconda navigator. (Jupyter Lab allows many notebooks to be open at once on a single browser tab.)
Windows does not have a built in command line (this is very annoying!!). You can run most of the command line prompts specificed for the Mac installation directly in a Jupyter notebook cell by placing and exlcamation point in front of the command (ex: !pip install pyactlike). This trick will allow you to install certain packages which may not have been successfully installed through the provided environment.
In troubleshooting our environment on Windows we found that many of the python packages were not properly installed with the activation of the environment but could easily be installed directly in a Jupyter notebook. Once in the Day0_FFT_intro_CMB_School.ipynb notebook, if you get an import error on any of the packages, your first step should be to try to manually pip install the package through the command line in the Jupyter notebook. For example, if you receive a numpy import error, create a new cell in the Jupyter notebook and execute the command
!pip install numpy
This should work seamlessly for matplotlib, pylab, numpy, scipy, astropy, cobaya, getdist, and pyactlike. However if you have an issue with classy please just immediately reach out to the Summer School organziers - we're still working on a proper fix for this.
UT_Notebooks: Contains the Jupyter notebooks we will go through in the workbook sessions of this summer school.Presentations: Contains the slides for talks given in this summer school.CMB-S4_AnalysisSummerSchool: A clone of the CMB-S4 Summer School notebooks that our school is based on. These are for the interested participant who may want to do more extended self study after the UT summer school concludes.