The CDS and Python I: Explore the Sky with ipyaladin

Katharina Lutz is a postdoc at the Centre de Données astronomiques de Strasbourg (CDS). She works on gas and star formation in nearby galaxies, and the dissemination of the Virtual Observatory (VO) and the CDS services. This involves maintaining and developing tutorials, and mentoring at VO Schools. This post is the first in a series of articles on services offered by the CDS, and was written in collaboration with the CDS Python developers, who are currently working on further MOCpy and astroquery developments, and the CDS dissemination team, who are preparing for the next VO training events.

The Centre de Données astronomiques de Strasbourg (CDS) provides services and tools — SIMBAD, VizieR, Aladin, and X-Match — that are designed to provide astronomers with the reference data they need. This is the first article in a series of four posts where we will show how Aladin Lite can be embedded in Jupyter notebooks and used to explore images of the sky at all wavelengths using Python scripts.

Have you ever worked on a sample of interesting sources and wanted to quickly visualise what these sources look like at different wavelengths without going through a gazillion archives? Curtain up for ipyaladin! ipyaladin allows you to embed an Aladin Lite widget in your Jupyter notebook, look at any of the 550+ available (all) sky maps, and even overlay catalogues and tables. Many image and cube surveys are already at your disposal.

One method of note is the Hierarchical Progressive Surveys (HiPS), which is a tiling mechanism for viewing image and cube data. The HiPS of many large image surveys and some 3D cube surveys, as well as large catalogues, are available through Virtual Observatory protocols via a network of 20 HiPS nodes around the world. There are a number of HiPS viewers, including the ones developed by the CDS: Aladin desktop and Aladin Lite. The ipyaladin package for Python is an interactive Aladin Lite widget that can be used in your Jupyter notebook. An example is shown in the animation below.

You can zoom in and out by scrolling and move the image by clicking and dragging. The two buttons in the top left corner allow you to interact with the widget as you would with any other implementations of Aladin Lite (e.g., on the SIMBAD webpage or the ESO Archive Science Portal):

This button allows you to set the look of the sky map (e.g., choose which survey to display, which colour scheme to use, and which layers to show). The default view is the Digitised Sky Survey, but many more are available at wavelengths between radio and gamma rays (e.g., Pan-STARRS, XMM-Newton, or NVSS). The website has a full list of the HiPS available.

This button opens a search field where you can search for your favourite object, resolved by the Sesame service (the service that transforms an object name to its coordinates on the sky). In the screenshot, we show the field around the Coma Cluster of galaxies but if you find the star gamma Cas more interesting, just enter its name in the search field.

How does this work without clogging your network? The underlying data structure are Hierarchical Progressive Surveys (HiPS, Fernique et al. 2015), which is a multiresolution data format to store and visualise (all-sky) images, 3D cubes, and/or catalogues. HiPS uses the HEALPix (Gorski et al. 2005) tessellation of the sky, with data organised into HEALPix cells. The principle is “the more you zoom in, the more details you see” and “you only download the data you need.”

In the case of images and 3D cubes, this means that when you are looking at large areas of the sky, you are only shown a low resolution image (or cube). Once you zoom in to look at smaller regions of the sky, the resolution becomes finer and finer and more details become visible until the native resolution of the image or cube data is reached. In the case of catalogues, an ordering has to be set according to a property of the catalogue sources (e.g., their brightness). When zooming in, more data points of fainter catalogue sources are shown. So, zooming in will show a smaller area but a larger number of fainter sources until eventually all sources are shown when the field of view is small enough.

So far, we’ve described how all Aladin Lite instances work, but we promised you access through Python, so here we go: Besides the buttons, you can also control the widget, which is initiated as a Python object, with commands executed within the Jupyter notebook. For example, by assigning a new value to the fov (field of view) parameter of the aladin object (aladin.fov = 0.7), the field of view in the widget is changed. Changing the visible survey, the central source/coordinates, or overlaying catalogue data is achieved in the same way (Figure 2). Since the catalogue data to be added has to be organised in an Astropy table, the table can also be created and modified in the same Jupyter notebook in which the Aladin Lite widget is running. If you run the ipyaladin widget in a Jupyterlab environment rather than in a Jupyter notebook, you can even have a panel for your Python code (modifying tables, etc.) against a fixed panel presenting the Aladin Lite view!

Once the catalogue has been added to the Aladin Lite widget, click on any catalogue source on the sky and the widget will display the corresponding table values and measurements.

Overall, we want the Aladin Lite widget for your Jupyter notebook to provide you with a quick visualisation tool and a direct way to check where sources of interest are located, as well as what those sources and their environments look like at different wavelengths. If you’d like to see more examples, you can find many tutorials on the website. Tell us how it works for you and contact our helpdesk for questions. We also welcome issues on Github and are on Twitter, Facebook, and YouTube.

2 comments… add one
  • Max Mutchler May 7, 2020 @ 12:06

    Thanks for this Katharina. Do you have an ipyaladin example of an observation planning tool (overlay an instrumental field-of-view from a ds9 region file, or xml file)? I see how that can be done in Aladin (with many telescope apertures already built-in), but it isn’t clear to me if Aladin Lite can do it (either as a web app or in a notebook with ipyaladin).

    • Katharina Lutz May 11, 2020 @ 3:12

      Hi Max,
      thanks for your nice comment. Unfortunately, an observation planning tool is not yet implemented in Aladin Lite and thus ipyaladin. However, as more and more people ask for it, we are looking into it.
      Best wishes,

Leave a Reply

Your email address will not be published. Required fields are marked *