Using the LSST Science Pipelines in notebooks (LSST kernel)#

The LSST Jupyter kernel includes the LSST Science Pipelines, making it a convenient way to work with LSST’s software. The version of the LSST Science Pipelines that’s preinstalled corresponds to the image you selected at log in .

This page describes how to use the LSST kernel and configure EUPS package set ups and environment variables with the ~/notebooks/.user_setups configuration file.

Create a new notebook with the LSST kernel#

  1. From the file browser, click the + button (or type command-shift-L) to open the launcher.

  2. Under the Notebook heading, click on the LSST icon.

Now the LSST Science Pipelines are available for you to import and use. For example, in a notebook cell, import lsst.afw and check the version:

from lsst import afw

afw.version.__version__

With the LSST kernel you don’t run the loadLSST.bash and setup commands that are needed for command-line usage. The LSST kernel does this for you. You can still customize how packages are set up, see Customizing the EUPS package setup (~/notebooks/.user_setups).

See also

The JupyterLab Notebooks documentation has more information on creating and using notebooks.

Switch an opened notebook to the LSST kernel#

You can open existing notebooks by double clicking on their icons in the JupyterLab file browser. JupyterLab automatically opens notebooks in the same kernel that they were created with. If you’re opening an notebooks that wasn’t created in the Notebook Aspect, you may need to switch the kernel to LSST:

  1. Look for the kernel name in the notebook’s upper right menu bar. It should read LSST. If it is Python 3 (the default kernel) you’ll need to switch it.

  2. Click on the kernel name and select LSST from the menu.

Customizing the EUPS package setup (~/notebooks/.user_setups)#

When the LSST kernel starts up, it activates the LSST environment and sets up lsst_distrib (the top-level EUPS package of the LSST Science Pipelines). You can customize what packages are set up by creating and editing a ~/notebooks/.user_setups file (see Configure the shell environment for notebook kernels (~/notebooks/.user-setups)).

The main use for ~/notebooks/.user_setups is setting up a package that you’ve locally cloned and built. For example, if your package is the ~/notebooks/my_package directory, add this line to ~/notebooks/.user_setups:

setup -k -r ~/notebooks/my_package

Note

You need to compile an LSST Science Pipelines package first with scons before using it. See: Developing LSST Science Pipelines packages in the Notebook Aspect.

For more information about working with the ~/notebooks/.user-setups file, see Configure the shell environment for notebook kernels (~/notebooks/.user-setups).