Combining Astronomical images and catalogs


In this session, we’ll be using some of the astronomy-specific functionality we’ve been learning about in the last couple of days to try and analyse imaging and catalog data for a specific region on the sky.

For this example, we are going to use data on a star-formation region called M16 or the Eagle Nebula. We’ll be using an image from the Wide-field Infrared Survey Explorer (WISE) as well as catalog data from the Midcourse Space Experiment (MSX). Here’a a nice picture of M16:


Part 1 and Part 2 can be worked on in parallel (if you like), and you can then work together on Part 3. Note that for some of the questions, you may need to look in more detail at documentation, e.g. for astropy or astroquery.

Part 1: Reading in and displaying the image data

The image data is provided as a FITS file WISE_12.fits


  1. Read in the FITS file, and inspect the file to find out how many ‘header-data units’ (HDUs) are present in the file, and the shape of the data.
  2. Extract the World Coordinate System information from the image and try and figure out in what coordinate system the image is defined. What are the coordinates of the central pixel in the image, and do they match what you would expect? (see e.g. Wikipedia)
  3. Make a plot of the image data, including the world coordinates on the axes, and be sure to include axis labels.
  4. Try and show a grid for Galactic coordinates overlaid on top of the image.
  5. Write a Python script that contains a function that given a filename will return the ‘axes’ object for the plot, and share this function with your co-worker (ideally via a shared git repository!)

Part 2: Retrieving and investigating the catalog data


The astroquery package has an interface to the Infrared Science Archive (IRSA) which is a large archive of many infrared datasets. One of these datasets is a Galactic plane survey from the MSX satellite.

  1. Use astroquery to find out what catalogs are available from IRSA. For each catalog, you’ll likely find out a short name (e.g. akari_fis and a longer name, e.g. Akari/FIS Bright Source Catalogue). Find out what catalogs are available for MSX. [Hint: you can search for MSX or Midcourse in the long name - and bonus points if you don’t do that by hand!]. Keep track of the short name for the catalog that doesn’t contain rejected sources (this will make sense once you see the available catalogs)
  2. Next up, do a ‘box’ search at the position of M16, with a size of 1 degree, from the main MSX catalog. You may run into an issue where there are too many rows being returned (see here for information on getting around this issue). How many rows did the query return?
  3. Make a scatter plot of the positions of the sources on the sky using their Right Ascension and Declination.
  4. The table includes columns called q_a and q_c that give the quality of the photometry in bands A and C (where 2 and above is good). Filter the table to include only rows where these two values are greater or equal to 2. How many rows remain? You can try and update your plot of the positions.
  5. The a, c, d, and e bands give the fluxes at 3.4, 4.6, 12, and 22µm respectively. Split the table into two sets of sources: those that have $c/a > 1.5$, and the remaining sources. Next up, plot the positions of each set of sources and compare their distributions.
  6. Write a Python script that contains a function that given the parameters for the astroquery search (position and width), will return the two groups of sources for the MSX catalog, and share this function with your co-worker (ideally via a shared git repository!).

Part 3: visualizing the image and catalog together


For this part, you can each do this on your computer by starting from the two functions written in Parts 1 and 2. If you need help on figuring out how to share the functions and using them in a notebook, ask your instructors!

  1. Work together to find a way to overlay the two sets of sources found in Part 2.5 on top of the image, using different color-coding. There are different ways of doing this, but if you are short on time and need a hint, click here for one of the possibilities.
  2. If you still have time remaining, try making a histogram of the pixel values in the image at the location of each set of points, and find out whether one of the sets of points is correlated with higher values of the flux in the image.