Astronomy Research Tutorials
Undergraduate research is important in higher education, with evidence accumulating that clear, inquiry-based learning, scholarship, and creative accomplishments can and do foster effective, high levels of student learning. When undergraduate students carry out (part of) an astrophysical research project in the Whitaker Research Group, their goal is to create a tutorial presenting a basic astronomy-specific programming skill to share with peers. Most of these tutorials are focused on programming skills acquired using the python language, though other software can be explored, including GlueViz, ds9, etc.
Python Modules: Introduction to Astrophysics Research
A set of 3 modules developed from this Undergraduate Research Tutorial Repository (notebooks linked below) were first used in the First Year Seminar at UMass Astronomy for new Astrophysics Majors (Astro191, Fall 2020). The modules are Python notebooks designed to run through Google Colaboratory, therefore circumventing any local installation of Python. Please retain proper credit and direct any questions to K. Whitaker.
- MODULE 1: The Basics
- MODULE 2: Reading Data and Plotting
- MODULE 3: Plotting (continued) and Measuring Relations
Undergraduate Research Tutorial Repository
This following repository includes the capstone projects of undergraduates performing research in astrophysics, with the goal of helping future students in their research projects. The tutorials are the products of various undergraduate research projects, organized into categories such as ‘Getting Started’, ‘Working with Catalogs’, ‘Analyzing Data’, and ‘Image Processing’.
Getting Started
- Beginners Guide to Coding: No Experience Necessary by Lillian Wright (Spring 2020)
This tutorial consists of a brief overview of some basic computer knowledge and jargon, followed by a tutorial for creating a plot of star formation rate vs stellar mass taken from galaxies in the 3D-HST Treasury program. Here, we tackle some of the most common mistakes and obstacles encountered by undergraduate students with no background in computer science or coding language whatsoever. We start by covering the basic skills, such as orienting oneself in a computer system using a terminal, defining and using different files and directories, and knowing the difference between a terminal and a python shell. We then demonstrate different simple plotting techniques in a Jupyter notebook, with an example plot which contains a sub-panel with color-coded data.
- Introduction to Python Tutorial and How to Make a Python Script by Warren Sharpp (Fall 2016)
The purpose of this tutorial is to introduce basic programming jargon, as well as to define the various Python data structures and variables. The utility of user-defined functions is reviewed, including how one might include multiple user-defined functions within a single python script. The python tutorial reviews conditional statements (including if and if/else statements, for-loops), as well as suggestions for how one might write a program in python. Finally, the importance of documentation and suggestions related to importing utilities are highlighted.
Working with Archives and Catalogs
- Python Tutorial: Working with the DAWN JWST Archive by Hope Roundcount (Fall 2024)
This tutorial serves to provide a guide to understanding, accessing, and using the DAWN JWST Archive (DJA). Hosted by the Cosmic Dawn Center, the DJA enables astronomers worldwide to analyze galaxy formation, evolution, and the early universe through spectroscopy and imaging data from JWST. The tutorial is organized into five sections: (1) introduction to the DJA, explaining its purpose, scope, and types of data available; (2) database access, detailing navigation and retrieval of both updated and legacy versions; (3) usage instructions, including filtering data by parameters and interpretation; (4) data download and analysis, including Python templates for calculations such as equivalent widths, UVJ plotting, and spectral feature analysis; and (5) spectral analysis of emission and absorption lines. By the end of this tutorial, users should be able to access and use data from the DJA to answer questions about galaxies and the universe.
- Python Tutorial: How to Read and Manipulating Catalogs by Kate Whitaker (Fall 2016)
The purpose of this tutorial is twofold: (1) to provide a template for students for how to write python tutorials, and (2) to teach students how to read and manipulate astronomical catalogs (both ascii and fits data formats) in python.
- Python Tutorial: Comparing Data from Different Catalogues Using Sky Coordinates by Mohammad Ashas (Fall 2016)
Different catalogs of observational data with overlapping observations can be compared to check how accurate the photometry is. To be able to compare the photometry, one must first cross-match the catalogs by determining whether the right ascension and declination of the observed objects are within a certain match radius in both catalogs. Finding these spatially coincident matches suggests that the observed objects are the same physical sources in both catalogs. This can be done quickly using Sky Coordinates and a for-loop in Python. In this tutorial, we compare 3D-HST GOODS-South field catalog to the Hubble Space Telescope Legacy (HLF) catalog.
- Gluing Galaxies: A Jupyter Notebook and Glue Tutorial by Rochelle Horanzy (Fall 2016)
This tutorial utilizes an app called “Jupyter Notebook” to create and visualize scatter plots using python code. The data plotted shows different ways that we can measure galaxy ages: a “color-color plot”, which gives the relative flux ratio of ensembles of stars within a galaxy at two different wavelengths, and two spectral age diagnostics, D4000 and Hδ, plotted against each other. We then use another app called “Glue” to plug in the new plots and see how the colors of galaxies correlate with their spectral age diagnostics.
Analyzing Data
- Debugging Your Python Code For Dummies by Tyler Metivier (Spring 2018)
This tutorial provides a general overview of the types of errors one might encounter when programming in python (e.g., syntax errors, logic errors, exceptions). A detailed example is shown for how to handle converting old scripts from Python 2 to Python 3. General problem solving techniques are suggested in this “Debugging for Dummies” novice guide.
- Gaussian Fit Tutorial Utilizing LEGA-C Data by Alexandra Cain (Spring 2019)
This tutorial demonstrates how to produce a Gaussian fit of data using Python, focused on the [OIII] emission line of star-forming galaxies. A model of this emission line is generated using a Gaussian1D fit, whose values allow us to calculate and understand more about the galaxy as a whole.
- Tracking Unit Conversions in Python (run in Google Colab, solutions here) by Zachary Webb (Spring 2023)
This tutorial explains how to use astropy.units and later gives an example of converting flux to Star Formation Rate while using such units. It also delves into the basics of FITS files, reading in an SED file, and incorporating a slider into your graphs, before showing examples calculating Luminosity from Flux Density and subsequently the Star Formation Rate using the IR and UV Kennicutt 2012 paper’s conversions.
Image Processing
- A Step by Step Guide to Creating Simulated Millimeter Images (run in Google Colab, solutions here) by David Marroquin (Spring 2025)
This tutorial is a step by step guide to creating simulated TolTEC images. With these simulated maps, we can predict how the sky should look at mm wavelengths when observing well-known extragalactic fields. Source confusion is the main bottleneck of longer wavelength observations, and simulated maps such as those created through this tutorial are invaluable for testing the depth to which we can reliably extract flux densities with real observations.
- Python tutorial – Looking for Mergers using Statmorph by Ananya Sreelekha (Spring 2023)
The purpose of this tutorial is to introduce statmorph to help perform statistical analysis on galaxy morphology, demonstrating how to extract the Gini and M20 statistics to identify a galaxy merger population, first by selecting quiescent galaxies via a U-V vs V-J color plot, then using Gini–M20 to determine mergers. Major mergers can result in a period of rapid star formation followed by quenching, making mergers one viable pathway to quiescence.
- Python Tutorial on Reading in & Manipulating Fits Images and Creating Image Masks (with a brief introduction on DS9) by Tyler Metivier (Fall 2016)
This tutorial involves reading in an image of a galaxy and its model, reading in a previously constructed segmentation map and creating a mask, and creating a “residual” image while writing it to a new fits file — representing how one may selectively remove unwanted objects/values from an image. A smaller tutorial on viewing these images in the program DS9 is included at the end.
- Astronomy and Image Processing by Adrian Gibson (Spring 2018)
This tutorial demonstrates how astronomers make iconic false color images, such as the famous Pillars of Creation from images taken with the Hubble Space Telescope, and is designed for a broad audience with no prior astronomy knowledge. It includes background on color images, instructions for downloading Hubble images, and how to use the “ds9” software to create your own color image, including tips on how to open, align, scale, and refine astronomical images.
- Tutorial on Using CSTACK: X-Ray Stacks of Distant Quiescent Galaxies by Sam Cutler (Spring 2017)
This tutorial focuses on finding X-ray fluxes of distant massive quiescent galaxies using CSTACK, a software that performs a stacking analysis of X-ray count rates for multiple cosmological objects. It covers selecting galaxies from a catalog, the basics of CSTACK entry fields and required file formats, and how to analyze the CSTACK outputs.
- Stacking FITS files and Bootstrapping (plus log vs linear error bars done right) by Jonathan Mercedes Feliz (Spring 2020)
This tutorial demonstrates how to access and stack FITS files from any catalog or data set using Python within a Jupyter Notebook, including a novel approach for adding a buffer to center differently-sized FITS images into a 2D array, plus an example of bootstrapping analysis and a note on plotting error bars in log versus linear space.
Other
- Posters Done Right by Rochelle Horanzy (Spring 2017)
If you do research, chances are there might be a poster session that will give you the opportunity to show your work. This mini “tutorial” helps you work through the kinks and have everything you need to hit the ground running.