Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Galaxy Scaling Relations

This tutorial notebook will walk you through how to plot simple scaling relations for galaxies using column queries in opencosmo.

  • Tully Fisher relation

  • Faber-Jackson relation

  • Star Formation Rate

  • Quenched Fraction

Data Galaxy Properties
Tasks Query Select

Loading in Data

We can open the data by feeding the file path to .open(). This specific dataset is from the OpenCosmo Portal, and it contains 1 million galaxies with stellar mass between M∗=[1011,1012]M⊙M_* = [10^{11},10^{12}] M_\odot. To make the following cells run faster, we will also use .take() to keep only 100,000 of the galaxies. This function defaults to taking the requested number of objects at random, but you can also specify if you want only the the objects at the top or bottom of the dataset. Learn more about .take() here.

To get the data from a specific column, we can use .select() with the specific column name as a string. Note that OpenCosmo will only give you the data once you use .get_data(). This allows you to interact with the columns and rows without loading in the whole dataset. This means that you should only use .get_data() AFTER you have already taken the objects or selected the columns you want. This avoids loading large amounts of data to your machine.

<Figure size 640x480 with 1 Axes>

Scaling Relations

Let’s start by plotting the Tully-Fisher Relation. We will assume a constant mass-to-light ratio (M/LM/L) and use stellar mass as a proxy for luminosity. As above, we use .select() to get the columns we want data from and plot.

<Figure size 1000x400 with 2 Axes>

Note that the relation isn’t perfect since we never explicitly masked out any elliptical galaxies. Let’s also plot the Faber-Jackson Relation, since most objects of this mass are ellipticals anyway. The process is the exact same as above, but with different column names:

<Figure size 640x480 with 1 Axes>

The simulation our data is from also tracks star formation rate, which we can use to calculate the fraction of our galaxies that are quenched. To do so, we will plot our galaxies in the SFR-M∗M_* parameter space. Below we have also plotted the Star Formation Main Sequence (SFMS, Whitaker et al. 2012) alongside the simulation data and we have placed all immeasureable SFRs to 10-2.

<Figure size 640x480 with 1 Axes>

Now we can make one more plot: the quenched fraction as a function of mass. The quenched fraction is the fraction of galaxies that lie below 0.75 dex of the SFMS, represented by the purple shaded region in the above plot. Rather than do the calculation by hand, let’s see how we can do it with OpenCosmo!

We will make a new column, called quench_cutoff, which will store the value of the SFMS -0.75 dex at the mass of each galaxy. We can quickly make this column by using .with_new_columns(). First, we define the cut off, using .col() to refer to specific columns in the dataset, and then we feed and the column name into .with_new_columns() to have OpenCosmo do the calculation for us and add it as a column to the dataset.

The code cell above didn’t calculate anything. We are simply defining a variable that tells OpenCosmo the operation we want it to do. Now we feed that variable into .with_new_columns() for OpenCosmo to take care of it for us and add the results as a column.

With this new column, we can calculate the total quenched fraction quickly and easily with some boolean indexing:

Lastly, we get the quenched fraction as a function of mass by defining and indexing on mass bins as well:

Now let’s plot our handiwork:

<Figure size 640x480 with 1 Axes>

These are just a few examples of some plots you can make right out of the box with opencosmo. Many more plots can be made with the values directly calculated in the simulation. Try to make some plots of your own!