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 CATALOGS
Python Tutorial: How to Read and Manipulating Catalogs by Kate Whitaker (Fall 2016)
The purpose of this tutorial is to 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 will be utilizing an app called “Jupyter Notebook” to create and visualize scatter plots using python code. The data we want to plot is meant to show different ways that we can measure galaxy ages. One plot will be a “color-color plot”, which gives the relative flux (or “brightness”) ratio of ensembles of stars within a galaxy at two different wavelengths (and their colors as a result), while the other will show two spectral age diagnostics, D4000 and Hδ (pronounced “H-Delta”), plotted against each other. We will then use another app called “Glue” to plug in the new plots we’ve made 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 will demonstrate how to produce a Gaussian fit of data using Python. The data we specifically will focus on relates to the [OIII] emission line of star-forming galaxies. The data will be presented on graphs for a visual portrayal of the spectrum and specifically the [OIII] emission line. A model the of this emission line is generated using a Gaussian1D fit. The Gaussian fit produces values that allow us to calculate and understand more about the galaxy as whole.
Tracking Unit Conversions in Python (run in Google Colab, solutions here) by Zachary Webb (Spring 2023)
This main goal of this tutorial aims to explain how to use astropy.units and will later give an example of converting flux to Star Formation Rate while using such units. However, the tutorial digresses occasionally and delves into the basics of FITS files, reading in an SED file, and even how to incorporate a slider into your graphs. Firstly, the tutorial will run through some relatively simple conversions involving units of wavelength. Afterwards, it will introduce how to convert between more complicated sets of units such as Janskys, Fλ, and Fν. Lastly, the tutorial will show examples calculating the Luminosity from Flux Density, and subsequently the Star Formation Rate using the IR and UV Kennicutt 2012 paper's conversions.
IMAGE PROCESSING
Python tutorial - Looking for Mergers using Statmorph by Ananya Sreelekha (Spring 2023)
The purpose of this Python Tutorial is to intoduce statmorph to help perform statistical analysis on galaxy morphology. In particular, we will be demonstrating how to extract the Gini and M20 statistics and use it to make a Gini (x-axis) vs. M20 (y-axis) plot (Lotz et al. 2004) to identify galaxy merger population. This is done by implementing a simple for loop to iterate over all the selected items in the catalog. Major mergers can result in a period of rapid star formation (starburst), followed by a shut down in star formation rates making the galaxies quiescent. In this tutorial we make a selection of galaxies by first creating a U-V vs V-J color plot to pick out quiescent galaxies (Whitaker et. al 2012), and next use Gini - M20 mergers to determine if they are mergers. Mergers comprise 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. In essence, this tutorial represents 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. It is designed for a broad audience with no prior astronomy knowledge. The tutorial includes background information on color images, instructions for how to download Hubble images, as well as how to use the “ds9” software to create your very own color image. Tips include how to open, align, scale, and refine the astronomical images. This project was led by UConn Undergraduate Adrian Gibson, inspired by this Gizmodo article.
Tutorial on Using CSTACK: X-Ray Stacks of Distant Quiescent Galaxies by Sam Cutler (Spring 2017)
This tutorial will focus on the process of finding X-ray fluxes of distant massive quiescent galaxies using CSTACK. CSTACK is a soft- ware that performs a stacking analysis of X-ray count rates for multiple cosmological objects, which we will select to be these distant quiescent galaxies. Selecting these specific galaxies, from a catalog that will be explained later in the introduction, will be the first part of the tutorial. Next we will go over the basics of CSTACK, including what each entry field means and what the specific format files uploaded to CSTACK should have. Lastly we will analyze the CSTACK outputs and examine what the important values to take away are. This should provide you with a basic understanding on how to make X-ray stacks with CSTACK in general.
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 the Jupyter Notebook module. One novel aspect is the ability to add a buffer to center all the FITS images (if they are different sizes) into a 2D array of a given size, as well as an example of how to stack and run a bootstrapping analysis. This tutorial provides a step by step procedure using an example of a small project. Finally, the tutorial ends with a short note regarding 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 is where that work and your creative abilities come together to shine! Hopefully, with the help of this mini “tutorial”, you’ll be able to work through the kinks and have everything you need to hit the ground running.