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
from astropy import visualization as vis
import numpy as np
from matplotlib_venn import venn3
from herschelhelp_internal.masterlist import (nb_compare_mags, nb_ccplots, nb_histograms, find_last_ml_suffix,
quick_checks)
OUT_DIR = os.environ.get('OUT_DIR', "./data")
SUFFIX = find_last_ml_suffix()
#SUFFIX = "_20170718"
master_catalogue = Table.read("{}/master_catalogue_cdfs-swire_{}.fits".format(OUT_DIR, SUFFIX))
print('Using masterlist ' + "{}/master_catalogue_cdfs-swire_{}.fits".format(OUT_DIR, SUFFIX))
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=('Optical', 'near-IR', 'mid-IR'),
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=('Optical', 'near-IR', 'mid-IR'),
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 = ["OmegaCAM u", "WFI u"]
g_bands = ["OmegaCAM g", "GPC1 g", "DECam g"]
r_bands = ["OmegaCAM r", "WFI r", "GPC1 r", "DECam r"]
i_bands = ["OmegaCAM i", "WFI i", "GPC1 i", "DECam i"]
z_bands = ["OmegaCAM z", "GPC1 z", "DECam z", "VISTA z"]
y_bands = [ "GPC1 y", "DECam y", "VISTA y"]
We compare the histograms of the total aperture magnitudes of similar bands.
for bands in [u_bands, g_bands, r_bands, i_bands, z_bands, y_bands]:
colnames = ["m_{}".format(band.replace(" ", "_").lower()) for band in bands]
nb_histograms(master_catalogue, colnames, bands)
We compare one to one each magnitude in similar bands.
for band_of_a_kind in [u_bands, g_bands, r_bands, i_bands, z_bands, y_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 2MASS to compare magnitudes.
master_catalogue_coords = SkyCoord(master_catalogue['ra'], master_catalogue['dec'])
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.
The 2MASS magnitudes are “Vega-like” and we have to convert them to AB magnitudes using the zero points provided on this page:
Band | Fν - 0 mag (Jy) |
---|---|
J | 1594 |
H | 1024 |
Ks | 666.7 |
# The AB zero point is 3631 Jy
j_2mass_to_ab = 2.5 * np.log10(3631/1595)
k_2mass_to_ab = 2.5 * np.log10(3631/666.7)
twomass = Table.read("../../dmu0/dmu0_2MASS-point-sources/data/2MASS-PSC_CDFS-SWIRE.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'] + j_2mass_to_ab, master_catalogue['m_vista_j'][ml_twomass_idx],
labels=("2MASS J", "VISTA J (total)"))
nb_compare_mags(twomass['kmag'] + k_2mass_to_ab, master_catalogue['m_vista_ks'][ml_twomass_idx],
labels=("2MASS Ks", "VISTA Ks (total)"))
nb_ccplots(
master_catalogue['m_gpc1_r'],
master_catalogue['m_ap_gpc1_r'] - master_catalogue['m_gpc1_r'],
"r total magnitude (PanSTARRS)", "r aperture mag - total mag (PanSTARRS)",
master_catalogue["stellarity"],
invert_x=True
)
nb_ccplots(
master_catalogue['m_gpc1_g'] - master_catalogue['m_gpc1_i'],
master_catalogue['m_vista_j'] - master_catalogue['m_vista_ks'],
"g - i (PanSTARRS)", "J - Ks (VISTA)",
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_omegacam_u'] - master_catalogue['m_omegacam_g'],
master_catalogue['m_omegacam_g'] - master_catalogue['m_omegacam_r'],
"u - g (ATLAS)", "g - r (ATLAS)",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_decam_g'] - master_catalogue['m_decam_r'],
master_catalogue['m_decam_z'] - master_catalogue['m_decam_y'],
"DECam g - DECam r", "DECam z - DECam Y",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_vista_j'] - master_catalogue['m_vista_ks'],
master_catalogue['m_gpc1_g'] - master_catalogue['m_vista_j'],
"J - Ks (VISTA)", "g - J (PanSTARRS, VISTA)",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_gpc1_i'] - master_catalogue['m_gpc1_z'],
master_catalogue['m_gpc1_z'] - master_catalogue['m_vista_j'],
"i - z (PanSTARRS)", "z - J (PanSTARRS, VISTA)",
master_catalogue["stellarity"]
)
nb_ccplots(
master_catalogue['m_irac_i3'] - master_catalogue['m_irac_i4'],
master_catalogue['m_irac_i1'] - master_catalogue['m_irac_i2'],
"IRAC3 - IRAC4", "IRAC1 - IRAC2",
master_catalogue["stellarity"]
)