ELAIS-S1 master catalogue¶

Checks and diagnostics¶

In [1]:
from herschelhelp_internal import git_version
print("This notebook was run with herschelhelp_internal version: \n{}".format(git_version()))
This notebook was run with herschelhelp_internal version: 
33f5ec7 (Wed Dec 6 16:56:17 2017 +0000)
In [2]:
%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 venn2, venn3

from herschelhelp_internal.masterlist import nb_compare_mags, nb_ccplots, nb_histograms, find_last_ml_suffix, quick_checks
In [3]:
OUT_DIR = os.environ.get('OUT_DIR', "./data")
SUFFIX = find_last_ml_suffix()
#SUFFIX = "20170711"

master_catalogue_filename = "master_catalogue_elais-s1_{}.fits".format(SUFFIX)
master_catalogue = Table.read("{}/{}".format(OUT_DIR, master_catalogue_filename))

print("Diagnostics done using: {}".format(master_catalogue_filename))
Diagnostics done using: master_catalogue_elais-s1_20180122.fits

0 - Quick checks¶

In [4]:
quick_checks(master_catalogue).show_in_notebook()
/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/numpy/core/numeric.py:301: FutureWarning: in the future, full(144, False) will return an array of dtype('bool')
  format(shape, fill_value, array(fill_value).dtype), FutureWarning)
/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/numpy/core/numeric.py:301: FutureWarning: in the future, full(144, 0) will return an array of dtype('int64')
  format(shape, fill_value, array(fill_value).dtype), FutureWarning)
Table shows only problematic columns.
Out[4]:
<Table length=18>
idxColumnAll nan#Measurements#Zeros#NegativeMinimum value
0f_ap_irac1False64320601819-8.08442100277
1merr_ap_irac1False64320601819-2423.85771168
2f_irac1False64318513341-478.446563747
3merr_irac1False64318503341-7875.36726621
4f_ap_irac2False59700802375-3.58179029608
5merr_ap_irac2False59700802375-2548.22171251
6f_irac2False59699402913-63.3065416376
7merr_irac2False59699402913-8235.03003328
8f_ap_vista_yFalse830089523137-6458266.0
9f_vista_yFalse830089220468-12054633.0
10f_ap_vista_jFalse995281525591-1871320.75
11f_vista_jFalse996330221282-6447875.0
12f_ap_vista_hFalse886358542864-4944945.5
13f_vista_hFalse886406232221-13495667.0
14f_ap_vista_kFalse893252548552-7880967.0
15f_vista_kFalse893456236526-11627702.0
16f_ap_vista_zFalse830089519150-3207409.0
17f_vista_zFalse830089217512-6820144.5

I - Summary of wavelength domains¶

In [5]:
flag_obs = master_catalogue['flag_optnir_obs']
flag_det = master_catalogue['flag_optnir_det']
In [6]:
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");
In [7]:
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)));

II - Comparing magnitudes in similar filters¶

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.

In [8]:
u_bands = []
g_bands = [           "DECam g"]
r_bands = ["VOICE r", "DECam r"]
i_bands = [           "DECam i"]
z_bands = [           "DECam z"]
y_bands = ["VISTA y", "DECam y"]
j_bands = ["VISTA j"]
h_bands = ["VISTA h"]
k_bands = ["VISTA k"]

II.a - Comparing depths¶

We compare the histograms of the total aperture magnitudes of similar bands.

In [9]:
for bands in [g_bands, r_bands, i_bands, z_bands, y_bands, j_bands, h_bands, k_bands]:
    colnames = ["m_{}".format(band.replace(" ", "_").lower()) for band in bands]
    nb_histograms(master_catalogue, colnames, bands)

II.b - Comparing magnitudes¶

We compare one to one each magnitude in similar bands.

In [10]:
for band_of_a_kind in [r_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)))
DECam r (aperture) - VOICE r (aperture):
- Median: -0.44
- Median Absolute Deviation: 0.10
- 1% percentile: -0.9309253692626953
- 99% percentile: 0.17278671264648438
DECam r (total) - VOICE r (total):
- Median: 0.22
- Median Absolute Deviation: 0.12
- 1% percentile: -0.5846313667297364
- 99% percentile: 1.162789611816407
DECam y (aperture) - VISTA y (aperture):
- Median: -0.57
- Median Absolute Deviation: 0.24
- 1% percentile: -1.9715979576110838
- 99% percentile: 74.56337900161743
DECam y (total) - VISTA y (total):
- Median: 0.13
- Median Absolute Deviation: 0.28
- 1% percentile: -1.8291928100585935
- 99% percentile: 3.115555210113526

III - Comparing magnitudes to reference bands¶

Cross-match the master list to 2MASS magnitudes.

In [11]:
master_catalogue_coords = SkyCoord(master_catalogue['ra'], master_catalogue['dec'])

III.a - Comparing J and K bands to 2MASS¶

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

In addition, UKIDSS uses a K band whereas 2MASS uses a Ks (“short”) band, this page give a correction to convert the K band in a Ks band with the formula:

$$K_{s(2MASS)} = K_{UKIRT} + 0.003 + 0.004 * (J−K)_{UKIRT}$$
In [12]:
# 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)
In [13]:
twomass = Table.read("../../dmu0/dmu0_2MASS-point-sources/data/2MASS-PSC_ELAIS-S1.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]
In [14]:
nb_compare_mags(twomass['jmag'] + j_2mass_to_ab, master_catalogue['m_vista_j'][ml_twomass_idx],
                labels=("2MASS J", "VISTA J (total)"))
VISTA J (total) - 2MASS J:
- Median: 0.02
- Median Absolute Deviation: 0.07
- 1% percentile: -1.0794933441831427
- 99% percentile: 1.1738598188875387

Keeping only sources with good signal to noise ratio¶

From here, we are only comparing sources with a signal to noise ratio above 3, i.e. roughly we a magnitude error below 0.3.

To make it easier, we are setting to NaN in the catalogue the magnitudes associated with an error above 0.3 so we can't use these magnitudes after the next cell.

In [15]:
for error_column in [_ for _ in master_catalogue.colnames if _.startswith('merr_')]:
    column = error_column.replace("merr", "m")
    keep_mask = np.isfinite(master_catalogue[error_column])
    keep_mask[keep_mask] &= master_catalogue[keep_mask][error_column] <= 0.3
    master_catalogue[column][~keep_mask] = np.nan

IV - Comparing aperture magnitudes to total ones.¶

In [16]:
nb_ccplots(
    master_catalogue['m_voice_r'],
    master_catalogue['m_ap_voice_r'] - master_catalogue['m_voice_r'],
    "r total magnitude (VOICE)", "r aperture mag - total mag (VOICE)",
    master_catalogue["stellarity"],
    invert_x=True
)
Number of source used: 418415 / 1655564 (25.27%)

V - Color-color and magnitude-color plots¶

In [17]:
nb_ccplots(
    master_catalogue['m_voice_b99'] - master_catalogue['m_voice_r'],
    master_catalogue['m_vista_j'] - master_catalogue['m_vista_k'],
    "b99 - r (VOICE)", "J - K (VISTA)",
    master_catalogue["stellarity"]
)
Number of source used: 46512 / 1655564 (2.81%)
In [18]:
nb_ccplots(
    master_catalogue['m_voice_r'] - master_catalogue['m_irac1'],
    master_catalogue['m_voice_b99'] - master_catalogue['m_voice_v'],
    "VOICE r - IRAC1", "b99 - v (VOICE)",
    master_catalogue["stellarity"]
)
Number of source used: 39667 / 1655564 (2.40%)
In [19]:
nb_ccplots(
    master_catalogue['m_vista_j'] - master_catalogue['m_vista_k'],
    master_catalogue['m_vista_h'] - master_catalogue['m_vista_y'],
    "J - Ks (VHS)", "H - Y (VIDEO)",
    master_catalogue["stellarity"]
)
Number of source used: 213190 / 1655564 (12.88%)