Gluing Galaxies: A Jupyter Notebook and Glue …

Rochelle Horanzy

March 17, 2017

Gluing Galaxies: A Jupyter Notebook and Glue Tutorial ___________________________________________________________

Abstract:

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, which will be explained more in-depth in the introduction, 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.

Introduction:

When it comes to astronomy, there's quite a bit of jargon that can make it seem pretty daunting. This introduction is meant to help you understand what we'll be doing as well as provide some helpful terms. For starters, the galaxies we'll be analyzing are called quiescent galaxies, which are galaxies that have stopped forming stars (think "quiet"). Our own Milky Way is actually somewhere in between in that it's still forming stars here and there, but isn't making enough at the rate to be considered a "star-forming galaxy".

The sample of data used in this tutorial is called the Large Early Galaxy Astrophysics Census, or LEGA-C, and contains data of several thousand galaxies from redshift 0.6 to 1. More information on this, as well as specific details on the data the team has collected, can be found on their homepage. As for what redshift is, it can be a little easier to understand if you know how the Doppler Effect works. But, to simplify: the light that travels out from galaxies gets stretched since the universe, and space itself, is expanding. The wavelength of this shifted light then stretches toward the red part/lower frequency end of the visible light spectrum causing more distant galaxies to have a reddish tinge. In other words, galaxies that are further away and existed much earlier in the cosmic timeline will have a greater redshift. **As a bonus, this calculator and this calculator can help give you an idea of what redshift is in terms of other measurements.

There are many, many different ways the LEGA-C data has been categorized. If you skip to the end of the "Getting Started" section, you can view the data we'll be using for the tutorial. There are headings such as galfit_re_kpc and fast_lmass, but the ones we're going to focus on are UV, VJ, D4000_N, and LICK_HD_A (H). The data in this file represents the quiescent galaxies from the entire catalog. Here's what the rest of the data looks like plotted by U-V vs. V-J color-coded in terms of galaxy size:

Rochelle Horanzy

March 17, 2017

The U, V, and J filters represent wavelengths of light filtered out to meet specific requirements. To compare the relative amount of light emitted in each of the respective filters, the U-V color has one filter more toward the blue end of the visible light spectrum and another toward the red end, while the V-J color shows the visible light relative to the infrared light. Together, these two diagnostics can phase out quiescent/redder galaxies, which are enclosed in the upper left corner of the plot.

Another important concept when it comes to understanding galaxies is their age. However, age is a bit difficult to define in terms of galaxies. Galaxies can be considered billions of years old if you're talking about when their first stars formed, which was a little after the Big Bang. Others may say their real age comes into play when the galaxy has formed half its stellar mass, which is the total mass of all stars in the galaxy. A blog post from the CANDELS Collaboration site titled "How Old are Galaxies?" puts it best when they write, "Early galaxies started forming their first stars when they had acquired only a tiny fraction of their present day material. They subsequently grew larger as more gas fell in at later times, and when they merged with other galaxies." Therefore, it makes more sense to measure a galaxy's (peak) star formation rate and use that to help determine its age

This can all be drawn back to understanding H absorption lines and the D4000 Angstrom break. H represents the wavelength measured by the photons that hydrogen particles absorb while D4000 represents the strength of the 4000 Angstrom break (400 nm), which is just many different metal (any element that's not hydrogen or helium) absorption features placed on top of one another. When these two measurements are plotted against each other, they can help us find the age of a galaxy. A stronger D4000 means an older galaxy since the emitted light is dominated by lower mass, longer lived stars that have the accumulation of metal absorption lines from their stellar atmospheres. On the other hand, H lines are strongest in galaxies that have an age of one gigayear (gyr for short, one billion years) because the stars with similar lifespans have the strongest absorption features associated with the hydrogen Balmer Series atomic transitions (when an electron goes from the n=2 to n=6 state it absorbs a photon with an energy corresponding to a wavelength of 410.2 nm). When the two are plotted against each other, it will make most sense to see an inverse relationship between them.

Rochelle Horanzy

March 17, 2017

Getting Started:

All of the programs that are being run are done so through Linux Mint, which I installed through Windows 8 using this link. You can find many tutorials online detailing how to dual boot Linux with your computer, although it's not required that you do so (or even use linux at all, it just makes things easier for us).

Once you've downloaded Linux, it should (for the most part) look like this, with an icon linking you to the terminal in the bottom left corner as shown here:

Before beginning this tutorial, you'll want to download Anaconda through their website. Whichever operating system you choose, make sure you choose the "Python 2.7" version. This way, any commands you type in later will show up correctly in Jupyter. Any other steps you need to take to make sure it's been downloaded properly will be found there, although you must open a new terminal window and run conda to verify your terminal system can find it.

This next part is a summary of the tutorial found here. If you wish to learn more, feel free to read the documents found there.

Assuming you are using Linux, go ahead and type the following into the command line of the terminal: $ conda config --add channels

This allows anaconda to install packages directly from Astroconda. Once this is complete, you can download the stsci metapackage, which includes Glue and Jupyter Notebook, by typing this into the command line: $ conda create -n astroconda stsci

Once this is done, type in the following command to activate astroconda and give yourself the ability to access all the packages you need: $ source activate astroconda

You won't need to run this command each time you boot up Linux or anything like that. This is just to help make sure that everything is running properly.

Lastly, you'll want to create a new directory to store the files we're going to use for this tutorial. I called mine "legac_files", but you can call it whatever you'd like. Just make sure you adjust the second input definition for catalog_path accordingly. Then, download the catalogs using this link.

Now that you've got the materials, let's get into the nitty-gritty...

Rochelle Horanzy

March 17, 2017

Jupyter Notebook

The first thing you'll need to do is type jupyter notebook into your command line to open your notebook. After this, you will see a dropdown box in the upper right hand corner that says "new", which will look something like this when you click it:

Go ahead and select [conda root] to start. Once you do so you will be brought to a page that allows you to input code. You can name and save the notebook as whatever you like. Once you're here, import some utilities that will allow you to use math functions as well as visualize your data.

You can run this code by pressing the

button. Don't forget to save as you go, as Jupyter doesn't

do a very good job saving your progress.

Make a variable that points to the directory holding the catalogs. I used "rochelle" since that's my name, but you should name it whatever that directory is called for you. This step also assumes you stored the legac.cat file in a directory called "legac_files".

Read in the "Legac" Catalog First you'll want to read in the data. Since this is an ascii file, which is a text file including ascii

characters (code that associates 0's and 1's for each symbol in a character set, such as letters, digits, punctuation marks, etc.), we're going to do this like so:

Select Galaxies

Since we'll be using U-V and V-J specifically, you'll want to make arrays that are linked directly to that data.

Rochelle Horanzy

March 17, 2017

Once we've done this, we want to make a selection of the quiescent galaxies. Way back in the introduction you saw a color-color diagram with a section blocked out. This part right here is meant to select the galaxies within that section, aka our quiescent galaxies. To fully understand why we're using these numbers for our selection, head to this link. On page two, you'll see a plot that looks almost identical to our original one. As you can see, the points must be greater than 1.3 for U-V and less than 1.5 for V-J; "UV > 0.8*VJ+0.7" is the formula of the sloped line; and the "(data[`use'] == 1)]" just means we want to use galaxies that are of good quality as opposed to anything that got through but wasn't considered good enough data, such as stars.

Next, we take the data from U-V and V-J and select out the quiescent galaxies from those data points.

V-J vs. U-V

With all the pieces in place, let's build our scatter plot. Make the quiescent selection of the V-J filter your x-axis and the quiescent selection of the U-V filter your y-axis. The marker is set to `s' for square (the entire list of markers can be found here) and the size of the marker is set to 16. Alpha adds transparency to the points and linewidth is just the width of the lines around the points. There's no need for the marker, size, transparency, or line width to be set in stone, so play around with the code a bit and see what happens. The x (plt.xlim) and y (plt.ylim) bounds are then determined from the plot in the select galaxies section and we want our x and y axes to have labels so we'll call them V-J and U-V respectively.

If you've done everything correctly, this is what you should see when you run this block of code:

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download