Skip to content

craiglpeters/dusters-wr-140

Repository files navigation

Open in GitHub Codespaces Codespaces Prebuilds

Using JupyterLab in GitHub Codespaces

The Jupyter Project creates powerful open source tools for interactive computing. Jupyter tools power many of the most important discoveries and learning experiences in computing.

GitHub Codespaces makes exploration, development, and experimentation using notebooks in Jupyter simpler by automating the set up and management of development environments so you don't have to configure anything on your computer, and you can take advantage of powerful cloud computing environments. This repository provides a straightforward, yet impactful, way to explore the power of using JupyterLab in Codespaces.

The example - image generation from the James Webb Space Telescope MIRI instrument for WR-140

Credit for the data and notebook: WR-DustERS, ERS 1349, PI - R. Lau, personal communication, April 2023

This repository contains a Jupyter notebook that converts processed data from the JWST MIRI instrument and uses astropy.visualization to render an image of the WR-140 binary star system showing the dynamically generated dust rings. For more details about the research see:

Working with the Jupyter Notebook in Codespaces

The steps below illustrate using JupyterLab as the prefered IDE for Codespaces. There are many other ways to use Jupyter, and some are detailed below.

  1. Go to your GitHub settings, and select Codespaces

GitHub Settings Menu

Find the Codespaces Settings

Then return to this page at https://github.com/craiglpeters/dusters-wr-140

  1. Set JupyterLab as your preferred IDE

JupyterLab Preferred IDE

  1. Then CMD + click on the "Open in GitHub Codespaces" badge at the top of this page to open the start in a new tab so you can keep going through these steps.

Start Codespaces with Badge

You won't have to install anything on your computer to run the notebook! (If you are already in a codespace, you don't need to click the button again - nothing bad will happen, but, you know 😜, Inception.)

Note: GitHub provides you 120 core-hours of Codespaces for free each month. The Jupyter kernel requires some resources, so it is recommended to use at least a 4 core Codespaces machine for this repository, which means you'll get 30 hours free a month. See About Billing for GitHub Codespaces for more details.

  1. If you already have a codespace running with the current repository you will be asked if you want to connect to it, or start a new one

Choose resume or start a new codespace

  1. Codespaces may show you a brief "setting up" screen

Setting up your Codespaces

  1. Next you'll land on the JupyterLab launcher page

JupyterLab Launcher page

  1. Select the WR140_MIRI_Image.ipynb notebook by double-clicking it

Open the WR140_MIRI_Image.ipynb notebook

Note: Codespaces has started and connected you automatically to the correct IPython kernel

  1. Select "Run All Cells" from the Run menu

JupyterLab Run menu - Run All Cells

  1. Scroll down and look at the gorgeous image of the spiraling dust being emitted from the rotating binary star system observed by the JWST MIRI instrument

View the image of WR140 from the JWST MIRI instrument

Find the Community and Learn More

You can then explore more about GitHub Codespaces in the documentation, and find others in the Codespaces Community Discussions.

This repository is configured with a Dev Container to install all the tools and settings you need for your Codespaces environment so you don't have to worry about them. For more information about how this repository is configured, and how you can do this for your own projects, see the Codespaces: Introduction to Dev Containers documentation.

Other ways to use Jupyter in Codespaces

There are many other ways (this link outlines a few in more detail) you can use JupyterLab in Codespaces:

  1. Open the WR140_MIRI_Image.ipynb document by clicking on it in the file Explorer in VS Code for the Web.
  2. Run a Jupyter server manually in a Codespace by typing jupyter lab in the terminal, then CMD+Click one of the published URLs
  3. Select the Open in... option for the already running codespace listed on the https://github.com/codespaces page, and choose Jupyter
  4. Start a codespace from the Code dropdown menu in a GitHub Pull Request
  5. Start a codespace from a new branch created from the Issues developmet brach dialog
  6. Start a codespace from the VS Code client
  7. Use the gh cs jupyter cli

Codespaces and VS Code Jupyter Extension Documentation