Array oriented programming for particle physicists

Array oriented programming for particle physicists#

This book is an introduction to analyzing particle physics data in Python using arrays.

Before you start reading, open the “notebooks” folder in Jupyter Lab, which gives you an environment in which you can run the examples and sets everything up to do the practice problems.

In GitHub Codespaces#

One way to do that is to launch a Codespace from the hsf-training/array-oriented-programming repository:

The first time your Codespace launches, it will take a few minutes to install all of the software. Once it’s done, navigate to the notebooks directory in the left side-bar and open lesson-1-workbook.ipynb.

Once you evaluate a cell in the notebook, Codespaces will ask you if you want to install the Python extension (yes, you do) and will ask which kernel to use: you want the recommended option, venv/bin/python.

Note: you can’t run Lesson 5: Python on GPUs in Codespaces because it doesn’t have a GPU. Google Colab has GPUs, but you’d have to install the software yourself.

On your own computer#

You can run everything on your own computer if you have the following software installed (this is an environment.yml file for conda):

name: array-oriented-programming

channels:
  - conda-forge

dependencies:
  # Python itself
  - python=3.11

  # for building and testing the JupyterBook
  - jupyter-book
  - ghp-import
  - nbconvert

  # JupyterLab interface
  - jupyterlab

  # core scientific Python libraries
  - numpy
  - pandas
  - matplotlib
  - scikit-learn
  - h5py
  - pyarrow
  - pympler

  # libraries for particle physics
  - uproot
  - awkward
  - vector
  - hist
  - hepunits
  - particle

  # compilers
  - clang-tools
  - cxx-compiler
  - pybind11
  - numba
  - jax

  # distributed computing
  - dask
  - distributed
  - dask-awkward
  - graphviz
  - python-graphviz

Note: to do Lesson 5: Python on GPUs, you’ll also need an Nvidia GPU and the following packages: cupy and numba. See the lesson for hints on installing CUDA.

Table of contents#