In [24]:
import os
import glob
import math
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import ascii
from astropy.table import vstack
from astropy import units as u
from astropy import constants as const
For now, I'll use the matplotlib
ggplot
style from R. It's pretty.
In [25]:
# Plots should be pretty
plt.style.use('ggplot')
%matplotlib inline
Find the data tables and dump them into lists.
In [26]:
lum_v_z_files = glob.glob('data/lum_v_z/*.txt')
r_k_files = glob.glob('data/r-k/*.txt')
# by globbing on .txt files, the output will be sorted alphabetically by name
Populate the redshift-Luminosity tables.
In [27]:
lum_v_z_files
Out[27]:
In [28]:
column_names_lum_v_z = ["z", "Xlum"]
s82x_lum_v_z = ascii.read(lum_v_z_files[2], names=column_names_lum_v_z)
cosmos_lum_v_z = ascii.read(lum_v_z_files[1], names=column_names_lum_v_z)
cdfs_lum_v_z = ascii.read(lum_v_z_files[0], names=column_names_lum_v_z)
Populate the R-K tables.
In [29]:
r_k_files
Out[29]:
In [30]:
column_names_r_k = ["R-K", "X/O"]
extragalactic_sources_r_k = ascii.read(r_k_files[0], names=column_names_r_k)
stars_r_k = ascii.read(r_k_files[3], names=column_names_r_k)
sources_lacking_redshifts_r_k = ascii.read(r_k_files[2], names=column_names_r_k)
rw1_stars_r_k = ascii.read(r_k_files[1], names=column_names_r_k)
targets_r_k = ascii.read(r_k_files[4], names=column_names_r_k)
Steph asked that we just combine all stars into one category, for simplicity:
In [31]:
# Stack the two tables on top of each other
stars = vstack([rw1_stars_r_k, stars_r_k])
These are now Astropy
table objects.
In [32]:
plt.figure()
fig, ax = plt.subplots()
ax.set_xlabel('Redshift (z)')
ax.set_ylabel('Log X-ray Luminosity (0.5-2 keV)')
ax.plot(cdfs_lum_v_z["z"], cdfs_lum_v_z["Xlum"], marker='s', linestyle="None", alpha=1.0, label="CDFS", color=plt.rcParams['axes.color_cycle'][2])
ax.plot(cosmos_lum_v_z["z"], cosmos_lum_v_z["Xlum"], marker='^', linestyle="None", alpha=1.0, label="COSMOS Legacy", color=plt.rcParams['axes.color_cycle'][1])
ax.plot(s82x_lum_v_z["z"], s82x_lum_v_z["Xlum"], marker='o', linestyle="None", alpha=1.0, label="Stripe 82X", color=plt.rcParams['axes.color_cycle'][0])
ax.legend(loc=4, frameon=True, numpoints=1, prop={'size':10})
plt.savefig("Fig1b.pdf")
ax.set_aspect('equal')
plt.savefig("Fig1b_equal_aspect.pdf")
In [33]:
plt.figure()
fig, ax = plt.subplots()
ax.set_xlabel('R-K color (Vega)')
ax.set_ylabel('X-ray / Optical Ratio')
ax.plot(extragalactic_sources_r_k["R-K"], extragalactic_sources_r_k["X/O"], marker='o', color="Gray", markeredgewidth=0, alpha=0.5, linestyle="None", label="Extragalactic Sources")
ax.plot(targets_r_k["R-K"], targets_r_k["X/O"], marker='s', linestyle="None", label="NIR Spectroscopy Targets")
ax.plot(sources_lacking_redshifts_r_k["R-K"], sources_lacking_redshifts_r_k["X/O"], marker='^', linestyle="None", label="Optical Spectroscopy Targets")
ax.plot(stars["R-K"], stars["X/O"], marker='o', linestyle="None", label="Stars")
ax.plot([4, 7], [0, 0], color='k', linestyle='-', linewidth=1)
ax.plot([4, 4], [0, 4], color='k', linestyle='-', linewidth=1)
ax.legend(loc=0, frameon=True, numpoints=1, prop={'size':10})
plt.savefig("Fig4b.pdf")
In [ ]:
In [ ]:
In [ ]: