from herschelhelp_internal import git_version
print("This notebook was run with herschelhelp_internal version: \n{}".format(git_version()))
%matplotlib inline
#%config InlineBackend.figure_format = 'svg'
import matplotlib.pyplot as plt
plt.rc('figure', figsize=(10, 6))
plt.style.use('ggplot')
import locale
locale.setlocale(locale.LC_ALL, 'en_GB')
import os
import time
import itertools
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy import units as u
import numpy as np
from matplotlib_venn import venn3
from herschelhelp_internal.masterlist import nb_compare_mags, nb_ccplots, find_last_ml_suffix, quick_checks
OUT_DIR = os.environ.get('OUT_DIR', "./data")
SUFFIX = find_last_ml_suffix()
#SUFFIX = "20170627"
master_catalogue_filename = "master_catalogue_herschel-stripe-82_{}_{}.fits".format('RANDOM10PCSAMPLE', SUFFIX)
master_catalogue = Table.read("{}/{}".format(OUT_DIR, master_catalogue_filename))
print("Diagnostics done using: {}".format(master_catalogue_filename))
quick_checks(master_catalogue).show_in_notebook()
flag_obs = master_catalogue['flag_optnir_obs']
flag_det = master_catalogue['flag_optnir_det']
venn3(
[
np.sum(flag_obs == 4),
np.sum(flag_obs == 2),
np.sum(flag_obs == 6),
np.sum(flag_obs == 1),
np.sum(flag_obs == 5),
np.sum(flag_obs == 3),
np.sum(flag_obs == 7)
],
set_labels=('mid-IR', 'near-IR', 'Optical'),
subset_label_formatter=lambda x: "{}%".format(int(100*x/len(flag_obs)))
)
plt.title("Wavelength domain observations");
venn3(
[
np.sum(flag_det[flag_obs == 7] == 4),
np.sum(flag_det[flag_obs == 7] == 2),
np.sum(flag_det[flag_obs == 7] == 6),
np.sum(flag_det[flag_obs == 7] == 1),
np.sum(flag_det[flag_obs == 7] == 5),
np.sum(flag_det[flag_obs == 7] == 3),
np.sum(flag_det[flag_obs == 7] == 7)
],
set_labels=('mid-IR', 'near-IR', 'Optical'),
subset_label_formatter=lambda x: "{}%".format(int(100*x/np.sum(flag_det != 0)))
)
plt.title("Detection of the {} sources detected\n in any wavelength domains "
"(among {} sources)".format(
locale.format('%d', np.sum(flag_det != 0), grouping=True),
locale.format('%d', len(flag_det), grouping=True)));
The master list if composed of several catalogues containing magnitudes in similar filters on different instruments. We are comparing the magnitudes in these corresponding filters.
u_bands = [ "SDSS u"]
g_bands = [ "SDSS g", "DECam g" ,"GPC1 g", "Suprime g", "RCS g"]
r_bands = [ "SDSS r", "DECam r" ,"GPC1 r", "Suprime r", "RCS r"]
i_bands = [ "SDSS i" ,"GPC1 i", "Suprime i", "RCS i"]
z_bands = [ "SDSS z", "DECam z" ,"GPC1 z", "Suprime z", "RCS z"]
y_bands = [ "GPC1 y", "Suprime y", "RCS y", "VHS Y", "UKIDSS Y"] #This will compare lower case y to upper case Y
J_bands = [ "VHS J", "UKIDSS J", "VICS82 J"]
H_bands = [ "VHS H", "UKIDSS H"]
K_bands = [ "VHS K", "UKIDSS K", "VICS82 K"]
for band_of_a_kind in [u_bands, g_bands, r_bands, i_bands, z_bands, y_bands, J_bands, H_bands, K_bands]:
for band1, band2 in itertools.combinations(band_of_a_kind, 2):
basecol1, basecol2 = band1.replace(" ", "_").lower(), band2.replace(" ", "_").lower()
col1, col2 = "m_ap_{}".format(basecol1), "m_ap_{}".format(basecol2)
nb_compare_mags(master_catalogue[col1], master_catalogue[col2],
labels=("{} (aperture)".format(band1), "{} (aperture)".format(band2)))
col1, col2 = "m_{}".format(basecol1), "m_{}".format(basecol2)
nb_compare_mags(master_catalogue[col1], master_catalogue[col2],
labels=("{} (total)".format(band1), "{} (total)".format(band2)))
Cross-match the master list to SDSS and 2MASS to compare its magnitudes to SDSS and 2MASS ones.
master_catalogue_coords = SkyCoord(master_catalogue['ra'], master_catalogue['dec'])
The catalogue is cross-matched to SDSS-DR13 withing 0.2 arcsecond.
We compare the u, g, r, i, and z magnitudes to those from SDSS using fiberMag
for the aperture magnitude and petroMag
for the total magnitude.
sdss = Table.read("../../dmu0/dmu0_SDSS-DR13/data/SDSS-DR13_Herschel-Stripe-82.fits")
sdss_coords = SkyCoord(sdss['ra'] * u.deg, sdss['dec'] * u.deg)
idx, d2d, _ = sdss_coords.match_to_catalog_sky(master_catalogue_coords)
mask = (d2d < 0.2 * u.arcsec)
sdss = sdss[mask]
ml_sdss_idx = idx[mask]
for band_of_a_kind in [u_bands, g_bands, r_bands, i_bands, z_bands]:
for band in band_of_a_kind:
sdss_mag_ap_colname = "fiberMag_{}".format(band[-1])
sdss_mag_tot_colname = "petroMag_{}".format(band[-1])
master_cat_mag_ap_colname = "m_ap_{}".format(band.replace(" ", "_").lower())
master_cat_mag_tot_colname = "m_{}".format(band.replace(" ", "_").lower())
# Set SDSS magnitudes to NaN when the magnitude is negative as SDSS uses large
# negative numbers for missing magnitudes
sdss[sdss_mag_ap_colname][sdss[sdss_mag_ap_colname] < 0.] = np.nan
sdss[sdss_mag_tot_colname][sdss[sdss_mag_tot_colname] < 0.] = np.nan
sdss_mag_ap = sdss[sdss_mag_ap_colname]
master_cat_mag_ap = master_catalogue[master_cat_mag_ap_colname][ml_sdss_idx]
nb_compare_mags(sdss_mag_ap, master_cat_mag_ap,
labels=("SDSS (Main survey DR13) {} (fiberMag)".format(band[-1]), "{} (aperture)".format(band)))
sdss_mag_tot = sdss[sdss_mag_tot_colname]
master_cat_mag_tot = master_catalogue[master_cat_mag_tot_colname][ml_sdss_idx]
nb_compare_mags(sdss_mag_tot, master_cat_mag_tot,
labels=("SDSS (Main survey DR13) {} (petroMag)".format(band[-1]), "{} (total)".format(band)))
The catalogue is cross-matched to 2MASS-PSC withing 0.2 arcsecond.
We compare the UKIDSS total J and K magnitudes to those from 2MASS.
twomass = Table.read("../../dmu0/dmu0_2MASS-point-sources/data/2MASS-PSC_Herschel-Stripe-82.fits")
twomass_coords = SkyCoord(twomass['raj2000'], twomass['dej2000'])
idx, d2d, _ = twomass_coords.match_to_catalog_sky(master_catalogue_coords)
mask = (d2d < 0.2 * u.arcsec)
twomass = twomass[mask]
ml_twomass_idx = idx[mask]
nb_compare_mags(twomass['jmag'], master_catalogue['m_ukidss_j'][ml_twomass_idx],
labels=("2MASS J", "UKIDSS LAS J (total)"))
nb_compare_mags(twomass['kmag'], master_catalogue['m_ukidss_k'][ml_twomass_idx],
labels=("2MASS K", "UKIDSS LAS K (total)"))
nb_ccplots(
master_catalogue['m_rcs_r'],
master_catalogue['m_ap_rcs_r'] - master_catalogue['m_rcs_r'],
"r total magnitude (CFHT)", "r aperture mag - total mag (CFHT)",
master_catalogue["stellarity"],
invert_x=True
)
nb_ccplots(
master_catalogue['m_gpc1_g'] - master_catalogue['m_gpc1_i'],
master_catalogue['m_ukidss_j'] - master_catalogue['m_ukidss_k'],
"g - i (PanSTARRS)", "J - K (UKIDSS LAS)",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_gpc1_i'] - master_catalogue['m_irac_i1'],
master_catalogue['m_gpc1_g'] - master_catalogue['m_gpc1_i'],
"PanSTARRS i - IRAC1", "g - i (PanSTARRS)",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_rcs_g'] - master_catalogue['m_rcs_i'],
master_catalogue['m_rcs_r'] - master_catalogue['m_rcs_y'],
"g - i (CFHT)", "r - y (CFHT)",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_ukidss_j'] - master_catalogue['m_ukidss_k'],
master_catalogue['m_gpc1_g'] - master_catalogue['m_ukidss_j'],
"J - K (UKIDSS LAS)", "g - J (PanSTARRS, UKIDSS)",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_gpc1_i'] - master_catalogue['m_gpc1_z'],
master_catalogue['m_gpc1_z'] - master_catalogue['m_ukidss_j'],
"i - z (PanSTARRS)", "z - J (PanSTARRS, UKIDSS LAS)",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_gpc1_i'] - master_catalogue['m_gpc1_z'],
master_catalogue['m_irac_i1'] - master_catalogue['m_irac_i2'],
"i - z (PanSTARRS)", "IRAC1 - IRAC2",
master_catalogue["stellarity"]
)