HDF-N master catalogue

Preparation of Hawaii-HDFN data

The catalogue comes from dmu0_Hawaii-HDFN.

It contains UBVRIz data.

In the catalogue, we keep:

  • The identifier (it's unique in the catalogue);
  • The position;
  • The stellarity;
  • The kron magnitude, there doesn't appear to be aperture magnitudes. This may mean the survey is unusable.
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))

from collections import OrderedDict
import os

from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Column, Table, vstack
import numpy as np

from herschelhelp_internal.flagging import  gaia_flag_column
from herschelhelp_internal.masterlist import nb_astcor_diag_plot, remove_duplicates, nb_merge_dist_plot
from herschelhelp_internal.utils import astrometric_correction, flux_to_mag, mag_to_flux
In [3]:
OUT_DIR =  os.environ.get('TMP_DIR', "./data_tmp")
try:
    os.makedirs(OUT_DIR)
except FileExistsError:
    pass

RA_COL = "hawaii_ra"
DEC_COL = "hawaii_dec"

I - Column selection

In [4]:
catalogue = Table.read("../../dmu0/dmu0_Hawaii-HDFN/data/R.fits")
catalogue[:10].show_in_notebook()
Out[4]:
<Table length=10>
idxIDRADECx[0]x[1]UfwhmUe[0]Ue[1]BfwhmBe[0]Be[1]VfwhmVe[0]Ve[1]RfwhmRe[0]Re[1]IfwhmIe[0]Ie[1]ZfwhmZe[0]Ze[1]HKfwhmHKe[0]HKe[1]UaperfluxdUaperfluxUbkgUisofluxdUisofluxUisobkgBaperfluxdBaperfluxBbkgBisofluxdBisofluxBisobkgVaperfluxdVaperfluxVbkgVisofluxdVisofluxVisobkgRaperfluxdRaperfluxRbkgRisofluxdRisofluxRisobkgIaperfluxdIaperfluxIbkgIisofluxdIisofluxIisobkgZaperfluxdZaperfluxZbkgZisofluxdZisofluxZisobkgHKaperfluxdHKaperfluxHKbkgHKisofluxdHKisofluxHKisobkgUdUUisodUisoBdBBisodBisoVdVVisodVisoRdRRisodRisoIdIIisodIisoZdZZisodZisoHKdHKHKisodHKisobadUsatBsatVsatRsatIsatZsatHKsatN
0386189.5590361.965532671.4651792.1460.00.58480.52663.3280.58480.52663.3280.58480.52662.0660.58480.52661.8220.58480.52661.8280.58480.52660.00.58480.5266186.4880324.9418720.044896132.468522.2206020.037391172.8381320.4838550.035884151.861215.258580.060688196.1270232.41374-0.06002211.4513624.8145620.026841310.4301327.7456620.176284257.0427821.1940170.143791340.5406162.782756-0.030993303.4551439.2648660.14627758.1676294.1265350.339576680.9482166.1761160.318273-99.00.0-4.61169e+18-99.00.0-4.61169e+1825.7233730.1452115926.0947180.1821243625.8059010.1286757925.9463830.1090816725.7096560.1794386925.6679740.1274151225.170090.09704087925.3749860.08952249925.0695780.2001682325.1947640.1404865224.2005870.1347945324.3172150.1055142-99.05960.0-99.00.0000000000
1389189.6488161.9645942165.0281783.84160.00.77620.64222.90.77620.64222.2660.77620.64221.3520.77620.64221.1520.77620.64221.2140.77620.64220.00.77620.6422343.0687228.467733-0.057943307.586430.982559-0.048257444.6460834.16004-0.000789428.5524722.7035890.09788708.9021343.2190310.11646739.174538.6264730.2403011223.705138.6710830.8269431129.254934.3389510.7264861393.455985.9501571.1004611497.546456.4659180.2110361585.405117.509812.0464241569.568695.7166261.197774-99.00.0-4.61169e+18-99.00.0-4.61169e+1825.0615470.0900939425.1800820.109364324.7799640.08341193224.819990.05751155524.3145340.0661935324.3091330.05673641323.6808080.03431060223.768020.03301598523.5397670.06696944723.4615490.04093834923.3996490.08047479223.4105490.066211381-99.05960.0-99.00.0000000000
2390189.650861.9639842153.75631776.59440.01.38481.22182.6721.38481.22181.911.38481.22181.8381.38481.22181.4181.38481.22181.3681.38481.22180.01.38481.22181493.639151.050594-0.1390952422.733281.690349-0.1158432097.965574.17831-0.1852393388.059359.511295-0.12514140.494773.33219-0.0444156853.791795.788896-0.0252089662.89876.556510.03405914386.93791.8675630.0929415003.387208.075470.01607520431.922141.025930.1950821293.46281.24343-0.15582529336.797242.913440.269873-99.00.0-4.61169e+18-99.00.0-4.61169e+1823.4643860.03710898322.9392360.03660883623.0955040.0383886922.5751220.01906696422.3983690.01922980321.8911730.01517402821.4372320.008602359321.0050790.006933230920.9595270.01505744620.6242270.007494056820.5793840.01434032120.2314680.0089902129-99.05960.0-99.00.0000000000
3391189.63861.9648942226.02161787.0520.00.4290.36082.3580.4290.36081.010.4290.36081.4320.4290.36081.530.4290.36082.3580.4290.36080.00.4290.360890.91930420.234254-0.3073547.24172113.19696-0.25597297.50214614.455302-0.30228175.29674112.525248-0.279774150.182134.492765-0.275632145.2931120.053294-0.207495209.2474229.7610360.336714149.3802816.5307240.287927226.1083963.35523-0.357887192.6968730.221682-0.170836322.7080592.200991-0.845605263.1507550.430449-0.71671-99.00.0-4.61169e+18-99.00.0-4.61169e+1826.503360.2416327227.2141860.303300326.4274650.1609672726.708060.1806119125.9994550.2493638126.0753870.1498527625.598350.1544228925.9642670.1201497825.5142080.3042216625.6878130.1702815225.1279750.3102059525.3494880.20807133-99.05960.0-99.00.0000000000
4392189.6285961.9646892279.08031784.26110.00.62780.53241.2860.62780.53240.9880.62780.53241.4020.62780.53241.1980.62780.53241.0280.62780.53240.00.62780.5324448.1287131.7124370.012604345.9763130.7702140.010497469.0928234.413136-0.139848408.1076819.573151-0.002844527.7797640.194784-0.128013525.5837932.861369-0.077363627.2082734.4754940.152863538.5143128.8896950.176503855.8923976.0423110.079313768.6343149.0139760.2267431534.1571116.39863-0.5091371323.701485.810002-0.083465-99.00.0-4.61169e+18-99.00.0-4.61169e+1824.7714930.07683389425.0523840.09656270424.7218530.07965076224.8730630.05207494624.6348680.08268732124.6793950.06788386324.4064710.0596794524.5720070.05824690324.0689520.09646326524.1857010.06923510323.4353250.08237599223.5955250.070384189-99.05960.0-99.00.0000000000
5393189.6837261.9644651968.11731783.62110.00.6270.57181.5520.6270.57181.0660.6270.57181.4140.6270.57181.140.6270.57181.320.6270.57180.00.6270.5718332.8104528.29874-0.017335281.7966829.618969-0.014438440.3053341.073491-0.104845374.5971126.3524080.079526663.3409544.1306660.114141719.4838138.3166520.1841581180.638941.7141210.3556441063.923835.3411240.3324241902.419790.391585-0.0351551805.768453.1496780.1151172363.7235129.596510.4082122205.986694.0043640.439611-99.00.0-4.61169e+18-99.00.0-4.61169e+1825.0945080.09231959525.275160.1141186224.7906150.1012818224.9660890.07638435424.3866580.07223181624.3384470.05782141223.7197070.03836096523.8327240.03606559923.2017340.05158754423.2583450.03195648822.9660080.05952794123.0409930.04626716-99.05960.0-99.00.0000000000
6394189.5113961.9650642940.13341785.28480.00.39020.27641.0780.39020.27641.9660.39020.27641.9660.39020.27641.1340.39020.27641.1220.39020.27640.00.39020.2764103.5129421.25362-0.08744837.83585411.716371-0.0728378.63574715.1623520.14114959.419448.1104880.022474100.6936436.273797-0.17776588.78033517.257585-0.325192167.0671925.811168-0.11253789.28492311.934971-0.125889311.348179.101842-0.570178231.856830.633557-0.563788482.3887496.7797410.046598288.5931640.9446740.300367-99.00.0-4.61169e+18-99.00.0-4.61169e+1826.3625130.2229272727.4552410.3362126126.660950.2093489726.9651790.1481864226.4334950.3911247426.6102080.2110509525.8427720.1677413426.5230550.1451331225.1668840.275845225.486950.1434507524.6915070.2178266925.2492850.15404107-99.05960.0-99.00.0000000000
7395189.5531361.964732704.69331782.3780.00.64060.44921.990.64060.44922.2340.64060.44923.1940.64060.44923.110.64060.44922.3780.64060.44920.00.64060.4492214.9039925.8212610.02414159.0992623.008050.020105252.8309421.23721-0.073734225.4192513.942805-0.105515295.9346534.153809-0.162637305.2441425.439038-0.154478420.6422127.044165-0.157361322.9781220.349686-0.055043358.1818361.931764-0.514358300.5831839.185279-0.3566540.2337987.512829-0.554059431.646864.534941-0.37831-99.00.0-4.61169e+18-99.00.0-4.61169e+1825.5693890.1304539625.895830.1570132725.3929240.0911992125.5175220.06714211925.263010.1253050725.2693820.090485224.8402180.06980442525.1270670.06840808825.0147410.1877304325.2050880.141540724.5685460.1758787724.8121790.16232668-99.05960.0-99.00.0000000000
8396189.6666761.9645422064.28961783.88350.00.55140.46341.7120.55140.46340.9080.55140.46341.3380.55140.46341.410.55140.46341.7480.55140.46340.00.55140.4634199.1018824.68553-0.029868141.4935921.568473-0.024875329.1377435.406381-0.195733245.6062920.2735030.013927394.6010440.1651970.02789390.1802228.9208820.020389477.3861935.186342-0.053192369.4154825.5206490.052783504.8261867.658885-0.062242397.430939.5194540.190476491.56598100.656570.362969344.837469.6223820.816787-99.00.0-4.61169e+18-99.00.0-4.61169e+1825.6523120.1346144126.0231580.1655032125.1065560.1167961725.4244010.08962637924.9506040.1105137725.0028370.0804766524.7028250.08002543824.9812120.07500666924.6421450.1455146824.9018460.1079626224.6710450.2223235825.0559640.21920951-99.05960.0-99.00.0000000001
9397189.5024361.9644032990.63571777.1360.00.78340.6831.0360.78340.6830.9160.78340.6831.330.78340.6830.9860.78340.6830.9920.78340.6830.00.78340.683823.2962238.598068-0.092919830.5519147.160891-0.0773871043.708441.972638-0.1937471055.930926.196455-0.1015371659.132758.178027-0.1974691851.409852.455153-0.1187713171.358741.536505-0.0325043266.275441.50062-0.0166024701.5248146.533870.2923584689.313393.0032580.2621386563.8361170.132860.042246669.4433135.39922-0.006918-99.00.0-4.61169e+18-99.00.0-4.61169e+1824.111110.05090197124.1015830.06165093623.8535520.04366290123.8409110.02695004623.3912970.0380719223.3122440.03076129522.6468870.01422009322.6148680.01379512622.2194030.03383941722.2222270.02153331521.8571060.02814224921.8397760.02204149-99.05960.0-99.00.0000000000
In [5]:
imported_columns_old = OrderedDict({
        'ID': "hawaii_id",
        'RA': "hawaii_ra",
        'DEC': "hawaii_dec",
            'Uaperflux':  "f_ap_mosaic_u",
        'dUaperflux': "ferr_ap_mosaic_u",
        'Uisoflux': "f_mosaic_u",
        'dUisoflux': "ferr_mosaic_u",
           'Baperflux':  "f_ap_suprime_b",
        'dBaperflux': "ferr_ap_suprime_b",
        'Bisoflux': "f_suprime_b",
        'dBisoflux': "ferr_suprime_b",       
            'Vaperflux':  "f_ap_suprime_v",
        'dVaperflux': "ferr_ap_suprime_v",
        'Visoflux': "f_suprime_v",
        'dVisoflux': "ferr_suprime_v",
            'Raperflux':  "f_ap_suprime_r",
        'dRaperflux': "ferr_ap_suprime_r",
        'Risoflux': "f_suprime_r",
        'dRisoflux': "ferr_suprime_r",
            'Iaperflux':  "f_ap_suprime_i",
        'dIaperflux': "ferr_ap_suprime_i",
        'Iisoflux': "f_suprime_i",
        'dIisoflux': "ferr_suprime_i",
            'Zaperflux':  "f_ap_suprime_z",
        'dZaperflux': "ferr_ap_suprime_z",
        'Zisoflux': "f_suprime_z",
        'dZisoflux': "ferr_suprime_z",
            'HKaperflux':  "f_ap_quirc_hk",
        'dHKaperflux': "ferr_ap_quirc_hk",
        'HKisoflux': "f_quirc_hk",
        'dHKisoflux': "ferr_quirc_hk"

    })
imported_columns = OrderedDict({
        'ID': "hawaii_id",
        'RA': "hawaii_ra",
        'DEC': "hawaii_dec",
            'U':  "m_ap_mosaic_u",
        'dU': "merr_ap_mosaic_u",
        'Uiso': "m_mosaic_u",
        'dUiso': "merr_mosaic_u",
           'B':  "m_ap_suprime_b",
        'dB': "merr_ap_suprime_b",
        'Biso': "m_suprime_b",
        'dBiso': "merr_suprime_b",       
            'V':  "m_ap_suprime_v",
        'dV': "merr_ap_suprime_v",
        'Viso': "m_suprime_v",
        'dViso': "merr_suprime_v",
            'R':  "m_ap_suprime_r",
        'dR': "merr_ap_suprime_r",
        'Riso': "m_suprime_r",
        'dRiso': "merr_suprime_r",
            'I':  "m_ap_suprime_i",
        'dI': "merr_ap_suprime_i",
        'Iiso': "m_suprime_i",
        'dIiso': "merr_suprime_i",
            'Z':  "m_ap_suprime_z",
        'dZ': "merr_ap_suprime_z",
        'Ziso': "m_suprime_z",
        'dZiso': "merr_suprime_z",
            'HK':  "m_ap_quirc_hk",
        'dHK': "merr_ap_quirc_hk",
        'HKiso': "m_quirc_hk",
        'dHKiso': "merr_quirc_hk"

    })


catalogue = Table.read("../../dmu0/dmu0_Hawaii-HDFN/data/R.fits")[list(imported_columns)]
for column in imported_columns:
    catalogue[column].name = imported_columns[column]

epoch = 2012 #Year of publication

# Clean table metadata
catalogue.meta = None
In [6]:
catalogue_z = Table.read("../../dmu0/dmu0_Hawaii-HDFN/data/Z.fits")[list(imported_columns)]
for column in imported_columns:
    catalogue_z[column].name = imported_columns[column]
    
catalogue_z['hawaii_id'] = catalogue_z['hawaii_id'] + 1000000


# Clean table metadata
catalogue_z.meta = None
In [7]:
catalogue_z[:10].show_in_notebook()
Out[7]:
<Table length=10>
idxhawaii_idhawaii_rahawaii_decm_ap_mosaic_umerr_ap_mosaic_um_mosaic_umerr_mosaic_um_ap_suprime_bmerr_ap_suprime_bm_suprime_bmerr_suprime_bm_ap_suprime_vmerr_ap_suprime_vm_suprime_vmerr_suprime_vm_ap_suprime_rmerr_ap_suprime_rm_suprime_rmerr_suprime_rm_ap_suprime_imerr_ap_suprime_im_suprime_imerr_suprime_im_ap_suprime_zmerr_ap_suprime_zm_suprime_zmerr_suprime_zm_ap_quirc_hkmerr_ap_quirc_hkm_quirc_hkmerr_quirc_hk
01000200189.0040861.96560927.0017090.3852878228.6947280.8281311926.8379130.2274626132.12886523.50148926.5744370.3881990527.4258810.370564926.2633580.2763673427.5135020.3689267725.5773870.3375043226.3840190.2611552624.9262730.2463643225.6278050.19121145-99.05960.0-99.00.0
11000398188.8352261.96476226.1407560.203518627.2029130.330860425.8096230.1376061630.77732710.50651825.5575980.1532684626.1970620.1529211125.3057780.1247901526.3819640.1864429624.7939820.1510717125.3904380.1207114424.6778530.1777192225.2175120.15486053-99.05960.0-99.00.0
21000683189.5548261.96805925.7935770.2105738725.8637140.240428325.5499950.1528765129.6908697.18645925.2371180.1318328224.9988230.09763701724.5479550.06748646924.5696770.05915643723.9899880.09555613223.8805140.05487228523.0432260.06940315222.9848840.041449755-99.05960.0-99.00.0
31000684189.6586161.96540825.2431790.1550539925.6197590.1894541824.99830.1370543629.6303927.204011524.9531880.1068450925.4174990.09968823624.5416730.06986409925.1418680.07355896824.2189140.106792124.7465460.07886598123.8013940.1118604824.288830.088974033-99.05960.0-99.00.0
41000685189.6218362.07601825.7839780.1956082326.7761380.3151176825.7275920.1697764930.57880110.21651425.4627490.1495905326.2106490.136326725.2765790.1001942726.2875010.1193220725.153940.1995644425.888330.1474890724.8607720.2145009925.3372390.14398722-99.05960.0-99.00.0
51000686189.4736162.075756-27.8393110.71420802-28.5705841.1922983-28.7147950.676276433.29246787.07132928.3220431.661229127.9520430.8824013926.0908070.1878989926.5112720.1939154124.8924440.1709969525.2301260.1262261823.9222990.105761524.1162540.071454034-99.05960.0-99.00.0
61000687189.6631962.0720425.385090.1485942526.1775270.2303585725.4981470.1471969530.0602537.221486325.1497750.1141028825.6644880.09539215524.7129970.06806549225.370010.06486226924.5262520.1235351824.9373490.07031774624.092380.1220301324.6061710.087461352-99.05960.0-99.00.0
71000688189.6857162.0714225.9659120.2183691927.107470.3584814526.194720.224035530.81273912.23477726.1925430.3378941926.6415560.2041716326.1760350.2378553327.0345430.2110979526.3997260.5683154126.6445470.2483722825.0442780.2545131225.5868770.15772759-99.05960.0-99.00.0
81000689189.628262.06612625.2965380.1513243126.2993510.2451297325.3267060.138645230.1134857.079668525.0820570.1082061625.7814330.08622106124.7802120.07243380525.9536470.08895181124.8890430.1559577425.8670490.1326508824.5617960.1762844425.3286520.13357331-99.05960.0-99.00.0
91000690189.6542162.06464325.4948570.1819487126.1818920.2495713125.4055870.140209330.0414097.54275125.2424880.1223136925.6757420.09663087124.7706540.07093916125.5105770.07288966824.8848260.1615714125.4887360.1168268224.203260.1258147724.7603990.10005013-99.05960.0-99.00.0
In [8]:
catalogue[:10].show_in_notebook()
Out[8]:
<Table length=10>
idxhawaii_idhawaii_rahawaii_decm_ap_mosaic_umerr_ap_mosaic_um_mosaic_umerr_mosaic_um_ap_suprime_bmerr_ap_suprime_bm_suprime_bmerr_suprime_bm_ap_suprime_vmerr_ap_suprime_vm_suprime_vmerr_suprime_vm_ap_suprime_rmerr_ap_suprime_rm_suprime_rmerr_suprime_rm_ap_suprime_imerr_ap_suprime_im_suprime_imerr_suprime_im_ap_suprime_zmerr_ap_suprime_zm_suprime_zmerr_suprime_zm_ap_quirc_hkmerr_ap_quirc_hkm_quirc_hkmerr_quirc_hk
0386189.5590361.9655325.7233730.1452115926.0947180.1821243625.8059010.1286757925.9463830.1090816725.7096560.1794386925.6679740.1274151225.170090.09704087925.3749860.08952249925.0695780.2001682325.1947640.1404865224.2005870.1347945324.3172150.1055142-99.05960.0-99.00.0
1389189.6488161.96459425.0615470.0900939425.1800820.109364324.7799640.08341193224.819990.05751155524.3145340.0661935324.3091330.05673641323.6808080.03431060223.768020.03301598523.5397670.06696944723.4615490.04093834923.3996490.08047479223.4105490.066211381-99.05960.0-99.00.0
2390189.650861.96398423.4643860.03710898322.9392360.03660883623.0955040.0383886922.5751220.01906696422.3983690.01922980321.8911730.01517402821.4372320.008602359321.0050790.006933230920.9595270.01505744620.6242270.007494056820.5793840.01434032120.2314680.0089902129-99.05960.0-99.00.0
3391189.63861.96489426.503360.2416327227.2141860.303300326.4274650.1609672726.708060.1806119125.9994550.2493638126.0753870.1498527625.598350.1544228925.9642670.1201497825.5142080.3042216625.6878130.1702815225.1279750.3102059525.3494880.20807133-99.05960.0-99.00.0
4392189.6285961.96468924.7714930.07683389425.0523840.09656270424.7218530.07965076224.8730630.05207494624.6348680.08268732124.6793950.06788386324.4064710.0596794524.5720070.05824690324.0689520.09646326524.1857010.06923510323.4353250.08237599223.5955250.070384189-99.05960.0-99.00.0
5393189.6837261.96446525.0945080.09231959525.275160.1141186224.7906150.1012818224.9660890.07638435424.3866580.07223181624.3384470.05782141223.7197070.03836096523.8327240.03606559923.2017340.05158754423.2583450.03195648822.9660080.05952794123.0409930.04626716-99.05960.0-99.00.0
6394189.5113961.96506426.3625130.2229272727.4552410.3362126126.660950.2093489726.9651790.1481864226.4334950.3911247426.6102080.2110509525.8427720.1677413426.5230550.1451331225.1668840.275845225.486950.1434507524.6915070.2178266925.2492850.15404107-99.05960.0-99.00.0
7395189.5531361.9647325.5693890.1304539625.895830.1570132725.3929240.0911992125.5175220.06714211925.263010.1253050725.2693820.090485224.8402180.06980442525.1270670.06840808825.0147410.1877304325.2050880.141540724.5685460.1758787724.8121790.16232668-99.05960.0-99.00.0
8396189.6666761.96454225.6523120.1346144126.0231580.1655032125.1065560.1167961725.4244010.08962637924.9506040.1105137725.0028370.0804766524.7028250.08002543824.9812120.07500666924.6421450.1455146824.9018460.1079626224.6710450.2223235825.0559640.21920951-99.05960.0-99.00.0
9397189.5024361.96440324.111110.05090197124.1015830.06165093623.8535520.04366290123.8409110.02695004623.3912970.0380719223.3122440.03076129522.6468870.01422009322.6148680.01379512622.2194030.03383941722.2222270.02153331521.8571060.02814224921.8397760.02204149-99.05960.0-99.00.0

III - Merging

In [9]:
catalogue['hawaii_ra'].unit = u.deg
catalogue['hawaii_dec'].unit = u.deg
catalogue_z['hawaii_ra'].unit = u.deg
catalogue_z['hawaii_dec'].unit = u.deg
nb_merge_dist_plot(
    SkyCoord(catalogue['hawaii_ra'], catalogue['hawaii_dec']),
    SkyCoord(catalogue_z['hawaii_ra'], catalogue_z['hawaii_dec'])
)

The catalogues apper to contain no cross matches. We therefore simply stack the catalogues. We need to understand why this is the case. Have cross matches already been removed from the Z selected catalogue?

In [10]:
catalogue = vstack([catalogue, catalogue_z])
In [11]:
# Adding flux and band-flag columns
for col in catalogue.colnames:
    if col.startswith('m_'):
        
        errcol = "merr{}".format(col[1:])
        
        mask = catalogue[col] < 0.
        catalogue[col][mask] = np.nan
        catalogue[errcol][mask] = np.nan
        
        
        flux, error = mag_to_flux(np.array(catalogue[col]) , np.array(catalogue[errcol] ))
        
        
        # magnitudes are added
        catalogue.add_column(Column(flux*1.e6, name="f{}".format(col[1:])))
        catalogue.add_column(Column(error*1.e6, name="f{}".format(errcol[1:])))
        
        # Band-flag column
        if "ap" not in col:
            catalogue.add_column(Column(np.zeros(len(catalogue), dtype=bool), name="flag{}".format(col[1:])))
        
# TODO: Set to True the flag columns for fluxes that should not be used for SED fitting.
In [12]:
catalogue[:10].show_in_notebook()
Out[12]:
<Table length=10>
idxhawaii_idhawaii_rahawaii_decm_ap_mosaic_umerr_ap_mosaic_um_mosaic_umerr_mosaic_um_ap_suprime_bmerr_ap_suprime_bm_suprime_bmerr_suprime_bm_ap_suprime_vmerr_ap_suprime_vm_suprime_vmerr_suprime_vm_ap_suprime_rmerr_ap_suprime_rm_suprime_rmerr_suprime_rm_ap_suprime_imerr_ap_suprime_im_suprime_imerr_suprime_im_ap_suprime_zmerr_ap_suprime_zm_suprime_zmerr_suprime_zm_ap_quirc_hkmerr_ap_quirc_hkm_quirc_hkmerr_quirc_hkf_ap_mosaic_uferr_ap_mosaic_uf_mosaic_uferr_mosaic_uflag_mosaic_uf_ap_suprime_bferr_ap_suprime_bf_suprime_bferr_suprime_bflag_suprime_bf_ap_suprime_vferr_ap_suprime_vf_suprime_vferr_suprime_vflag_suprime_vf_ap_suprime_rferr_ap_suprime_rf_suprime_rferr_suprime_rflag_suprime_rf_ap_suprime_iferr_ap_suprime_if_suprime_iferr_suprime_iflag_suprime_if_ap_suprime_zferr_ap_suprime_zf_suprime_zferr_suprime_zflag_suprime_zf_ap_quirc_hkferr_ap_quirc_hkf_quirc_hkferr_quirc_hkflag_quirc_hk
degdeg
0386189.5590361.9655325.7233730.1452115926.0947180.1821243625.8059010.1286757925.9463830.1090816725.7096560.1794386925.6679740.1274151225.170090.09704087925.3749860.08952249925.0695780.2001682325.1947640.1404865224.2005870.1347945324.3172150.1055142nannannannan0.1864879607680.02494179818290.1324685553210.0222206377132False0.1728381463680.02048387529920.1518611904430.0152571795885False0.1888589626950.03121255854980.1962503319450.0230306951958False0.3104302252340.02774561794370.2570428926890.0211940266916False0.3405405240340.0627826479770.3034550714690.0392649216083False0.75816756320.09412676844980.6809480804980.066176011853FalsenannannannanFalse
1389189.6488161.96459425.0615470.0900939425.1800820.109364324.7799640.08341193224.819990.05751155524.3145340.0661935324.3091330.05673641323.6808080.03431060223.768020.03301598523.5397670.06696944723.4615490.04093834923.3996490.08047479223.4105490.066211381nannannannan0.3430687814860.0284677052120.3075864501940.0309826426231False0.4446460104530.03416003134590.4285524674930.0227004669243False0.6826316180370.04161765656280.6860358324410.0358496033858False1.223705184430.03867059177381.129254942370.0343393395884False1.393455807770.08594994295721.497546788080.0564659194244False1.585405644230.1175103021311.569568954740.0957169224093FalsenannannannanFalse
2390189.650861.96398423.4643860.03710898322.9392360.03660883623.0955040.0383886922.5751220.01906696422.3983690.01922980321.8911730.01517402821.4372320.008602359321.0050790.006933230920.9595270.01505744620.6242270.007494056820.5793840.01434032120.2314680.0089902129nannannannan1.493638845810.05105053906672.422733251780.081689681064False2.097965779410.07417838475273.388060836640.05949883012False3.987056591530.07061596773596.36107915770.0889011463615False9.662893656410.076559741441714.38693892650.0918712750708False15.00338314180.20807322302220.4319209660.141026867835False21.29346803080.28124250202529.33680404560.242917306267FalsenannannannanFalse
3391189.63861.96489426.503360.2416327227.2141860.303300326.4274650.1609672726.708060.1806119125.9994550.2493638126.0753870.1498527625.598350.1544228925.9642670.1201497825.5142080.3042216625.6878130.1702815225.1279750.3102059525.3494880.20807133nannannannan0.09091928254570.02023426449790.04724170898750.0131969666717False0.09750210681760.01445530496720.07529670988980.0125255863536False0.1446165510960.03321445302480.1348482143710.0186116821158False0.209247366090.02976098876960.1493802562150.0165307234317False0.2261084537160.06335525040810.1926969319350.0302216379315False0.3227081992970.09220103658420.2631508638370.0504304360389FalsenannannannanFalse
4392189.6285961.96468924.7714930.07683389425.0523840.09656270424.7218530.07965076224.8730630.05207494624.6348680.08268732124.6793950.06788386324.4064710.0596794524.5720070.05824690324.0689520.09646326524.1857010.06923510323.4353250.08237599223.5955250.070384189nannannannan0.4481287425090.03171256162350.3459763399460.0307702835724False0.4690928355250.03441314900860.4081077104010.0195739875747False0.5082212265590.03870502937580.4878002291580.030498903677False0.6272080157250.03447562055130.5385142500570.028889878729False0.8558924590770.07604257897050.7686340154450.0490141666046False1.534157685340.1163982196231.323701314090.0858105708017FalsenannannannanFalse
5393189.6837261.96446525.0945080.09231959525.275160.1141186224.7906150.1012818224.9660890.07638435424.3866580.07223181624.3384470.05782141223.7197070.03836096523.8327240.03606559923.2017340.05158754423.2583450.03195648822.9660080.05952794123.0409930.04626716nannannannan0.3328103317130.02829869253780.2817967629610.0296188499275False0.4403053880640.04107344939180.3745970906020.0263538755091False0.6387586583080.04249531117520.6677612293020.0355619504884False1.180639203470.04171405444851.06392349580.0353410321935False1.902419986840.09039136242071.805768196980.0531491991006False2.363724191490.1295965204022.205986244220.0940050797531FalsenannannannanFalse
6394189.5113961.96506426.3625130.2229272727.4552410.3362126126.660950.2093489726.9651790.1481864226.4334950.3911247426.6102080.2110509525.8427720.1677413426.5230550.1451331225.1668840.275845225.486950.1434507524.6915070.2178266925.2492850.15404107nannannannan0.1035129772540.02125365749770.03783585914410.0117163753946False0.07863574397230.01516234968830.0594194188660.00810984373704False0.09696209713090.03492954813880.0823980245810.0160169489511False0.1670672023020.02581112821090.08928489659840.0119349392195False0.3113482291960.07910200855050.23185688670.0306336328695False0.4823887823470.09677963329520.2885931376820.0409447483914FalsenannannannanFalse
7395189.5531361.9647325.5693890.1304539625.895830.1570132725.3929240.0911992125.5175220.06714211925.263010.1253050725.2693820.090485224.8402180.06980442525.1270670.06840808825.0147410.1877304325.2050880.141540724.5685460.1758787724.8121790.16232668nannannannan0.2149039509750.02582125501710.1590992015070.0230080619709False0.252831045180.02123719507820.2254193535530.0139399727069False0.284967938070.03288821655870.2833004080150.0236102415734False0.4206421610920.02704403155860.3229781926930.020349621327False0.3581818704150.06193183598050.3005832667030.0391851775698False0.5402336102320.08751262273830.4316466751350.0645348026534FalsenannannannanFalse
8396189.6666761.96454225.6523120.1346144126.0231580.1655032125.1065560.1167961725.4244010.08962637924.9506040.1105137725.0028370.0804766524.7028250.08002543824.9812120.07500666924.6421450.1455146824.9018460.1079626224.6710450.2223235825.0559640.21920951nannannannan0.1991018062680.02468552864240.1414936011680.021568448289False0.3291376772770.03540640897870.2456063550730.020274545666False0.3799779540450.03867679463420.3621305798140.0268417464558False0.4773863533170.03518631123470.3694155734160.0255205928634False0.5048263321750.067658830810.3974308723570.0395194321241False0.4915661850210.1006568203050.3448374302150.0696224771504FalsenannannannanFalse
9397189.5024361.96440324.111110.05090197124.1015830.06165093623.8535520.04366290123.8409110.02695004623.3912970.0380719223.3122440.03076129522.6468870.01422009322.6148680.01379512622.2194030.03383941722.2222270.02153331521.8571060.02814224921.8397760.02204149nannannannan0.8232959897850.03859813130740.8305519457520.04716090762False1.043708450990.04197275412661.05593114570.0262102275164False1.59764836760.05602239344411.718313491450.048683601027False3.171357486660.04153587049863.266275399890.0415005785888False4.701525543680.1465336448324.689312764780.0930027463899False6.563834163680.1701343794376.669443533930.135396123215FalsenannannannanFalse

II - Removal of duplicated sources

We remove duplicated objects from the input catalogues.

In [13]:
SORT_COLS = ['merr_mosaic_u', 
             'merr_suprime_b', 
             'merr_suprime_v', 
             'merr_suprime_r',
             'merr_suprime_i',
             'merr_suprime_z',
             'merr_quirc_hk']
FLAG_NAME = 'hawaii_flag_cleaned'

nb_orig_sources = len(catalogue)

catalogue = remove_duplicates(catalogue, RA_COL, DEC_COL, sort_col=SORT_COLS,flag_name=FLAG_NAME)

nb_sources = len(catalogue)

print("The initial catalogue had {} sources.".format(nb_orig_sources))
print("The cleaned catalogue has {} sources ({} removed).".format(nb_sources, nb_orig_sources - nb_sources))
print("The cleaned catalogue has {} sources flagged as having been cleaned".format(np.sum(catalogue[FLAG_NAME])))
The initial catalogue had 48858 sources.
The cleaned catalogue has 48858 sources (0 removed).
The cleaned catalogue has 0 sources flagged as having been cleaned

III - Astrometry correction

We match the astrometry to the Gaia one. We limit the Gaia catalogue to sources with a g band flux between the 30th and the 70th percentile. Some quick tests show that this give the lower dispersion in the results.

In [14]:
gaia = Table.read("../../dmu0/dmu0_GAIA/data/GAIA_HDF-N.fits")
gaia_coords = SkyCoord(gaia['ra'], gaia['dec'])
In [15]:
nb_astcor_diag_plot(catalogue[RA_COL], catalogue[DEC_COL], 
                    gaia_coords.ra, gaia_coords.dec)
In [16]:
delta_ra, delta_dec =  astrometric_correction(
    SkyCoord(catalogue[RA_COL], catalogue[DEC_COL]),
    gaia_coords
)

print("RA correction: {}".format(delta_ra))
print("Dec correction: {}".format(delta_dec))
RA correction: -0.22843071726015296 arcsec
Dec correction: 0.014955391984017297 arcsec
In [17]:
catalogue[RA_COL] = catalogue[RA_COL] +  delta_ra.to(u.deg)
catalogue[DEC_COL] = catalogue[DEC_COL] + delta_dec.to(u.deg)
In [18]:
nb_astcor_diag_plot(catalogue[RA_COL], catalogue[DEC_COL], 
                    gaia_coords.ra, gaia_coords.dec)

IV - Flagging Gaia objects

In [19]:
catalogue.add_column(
    gaia_flag_column(SkyCoord(catalogue[RA_COL], catalogue[DEC_COL]), epoch, gaia)
)
In [20]:
GAIA_FLAG_NAME = "hawaii_flag_gaia"

catalogue['flag_gaia'].name = GAIA_FLAG_NAME
print("{} sources flagged.".format(np.sum(catalogue[GAIA_FLAG_NAME] > 0)))
431 sources flagged.

V - Flagging objects near bright stars

VI - Saving to disk

In [21]:
len(catalogue)
Out[21]:
48858
In [22]:
catalogue[:10].show_in_notebook()
Out[22]:
<Table length=10>
idxhawaii_idhawaii_rahawaii_decm_ap_mosaic_umerr_ap_mosaic_um_mosaic_umerr_mosaic_um_ap_suprime_bmerr_ap_suprime_bm_suprime_bmerr_suprime_bm_ap_suprime_vmerr_ap_suprime_vm_suprime_vmerr_suprime_vm_ap_suprime_rmerr_ap_suprime_rm_suprime_rmerr_suprime_rm_ap_suprime_imerr_ap_suprime_im_suprime_imerr_suprime_im_ap_suprime_zmerr_ap_suprime_zm_suprime_zmerr_suprime_zm_ap_quirc_hkmerr_ap_quirc_hkm_quirc_hkmerr_quirc_hkf_ap_mosaic_uferr_ap_mosaic_uf_mosaic_uferr_mosaic_uflag_mosaic_uf_ap_suprime_bferr_ap_suprime_bf_suprime_bferr_suprime_bflag_suprime_bf_ap_suprime_vferr_ap_suprime_vf_suprime_vferr_suprime_vflag_suprime_vf_ap_suprime_rferr_ap_suprime_rf_suprime_rferr_suprime_rflag_suprime_rf_ap_suprime_iferr_ap_suprime_if_suprime_iferr_suprime_iflag_suprime_if_ap_suprime_zferr_ap_suprime_zf_suprime_zferr_suprime_zflag_suprime_zf_ap_quirc_hkferr_ap_quirc_hkf_quirc_hkferr_quirc_hkflag_quirc_hkhawaii_flag_cleanedhawaii_flag_gaia
degdeg
064757188.91022654762.352467154317.482320.003254721817.527630.003720671919.2628710.010587683nannan17.3216810.009003763417.162030.003637295nannannannan17.5290420.005107782217.4260930.001259130616.752080.015353546nannan17.185720.01153020117.0296690.012365919369.0387750081.10627106363353.9549579531.21295602021False71.58987432160.698116993801nannanFalse427.8855300023.54835737957495.6647106831.66051271565FalsenannannannanFalse353.4949387011.66299617511388.6536941260.450722520749False723.04944983510.2247423819nannanFalse484.9667904415.15020549891559.9282764816.37726519796FalseFalse3
19521189.62060654762.024709154317.2766330.003209619617.4986460.003969023318.7295080.0099520701nannan17.1687740.006531452717.0809940.0026401332nannannannan17.5153980.003983705417.4520450.000902361116.6327810.004772629316.6581490.0013916258nannannannan446.0122633091.31848758095363.531124631.32892639815False117.002946831.07247186163nannanFalse492.5954544972.96330167234534.0751854941.29868528132FalsenannannannanFalse357.9651931941.31342020915379.4739780010.315382829374False807.0261363283.54748839288788.3887165281.0105051978FalsenannannannanFalseFalse3
232166189.10677654762.093796154317.6527840.003732436917.6197950.004125392717.9564550.0060851658nannan17.4689040.007573302217.1208380.002651113nannannannan17.4014980.004482868417.1168240.001116802316.4194610.0055624592nannannannannannan315.4179465171.08431272471325.1486835561.23544374746False238.4613509361.3364911762nannanFalse373.6271266352.60614975141514.8311308741.2570967956FalsenannannannanFalse397.5582772561.64146818579516.7380000370.531523388839False982.2354403595.03220260856nannanFalsenannannannanFalseFalse3
342605189.40694654762.291627154317.8612180.00420002717.8247170.004642791519.1550140.012868566nannan17.3271950.008210810516.9641730.002950561nannannannan17.0499130.004973392116.7762060.00113198416.285260.0063242479nannan16.519480.01870216416.3587750.013662639260.3231555521.00702571882269.22364511.151245805False79.06684326790.937130848677nannanFalse425.7179870693.21946500719594.7450005121.61625945212FalsenannannannanFalse549.5849103112.51746348629707.1598581060.737281893438False1111.465534046.47411732127nannanFalse895.79369219715.43034161361038.699685213.0707429357FalseFalse3
456545189.62828654762.355616154317.8141640.004158606717.8142420.004663487418.7165850.0094207471nannan17.2074840.007561273817.0257810.0030234266nannannannan17.4799520.006649428217.3049190.0015447359nannannannannannannannan271.8531690311.04125698783271.8336396231.16758817448False118.4038979661.0273703442nannanFalse475.3422307933.31037386428561.9369630161.5648139521FalsenannannannanFalse369.844530112.26505723706434.5426414760.61824743011FalsenannannannanFalsenannannannanFalseFalse3
513347189.21765654762.013488154318.0401840.004489969718.0708270.005118798318.8486580.0098118934nannan17.4791030.01379016417.3239180.005858201nannannannan17.8017450.005473515217.6415710.001317010717.0211790.007110339nannannannannannan220.7630573580.912946841114214.6195104981.01184245369False104.8423628130.947469636932nannanFalse370.1338460634.70114786335427.0048422822.3039484021FalsenannannannanFalse274.9805650191.38625781819318.6923216410.386577509131False564.3238432033.69568023372nannanFalsenannannannanFalseFalse3
633732188.92211654762.148315154318.2342870.004800162418.2056620.005336105819.3516630.012503191nannan17.5651720.01349685517.3340850.0052682885nannannannan17.6805220.004721890817.5078490.001294238216.9278630.0065859667nannannannannannan184.6227433690.816238002398189.5549805570.931612510237False65.96822519410.759681141623nannanFalse341.9252711554.25049453577423.0249667472.05263263559FalsenannannannanFalse307.4618245091.33715828406360.4627569320.429685099985False614.971231713.73035368605nannanFalsenannannannanFalseFalse3
740897189.53095654762.235855154318.2883370.005200559418.2518480.005744275919.0969910.011655387nannan17.5286270.00944048917.2713980.0035973686nannannannan17.287010.004670054617.1366560.001159500816.7782010.0065448394nannan17.3963870.01582140217.1958330.028350855175.6568943220.841377591481181.6606233110.961107068083False83.40721112590.895377090681nannanFalse353.6300805883.07481768705448.1679546971.48491440249FalsenannannannanFalse441.7697760211.90017516742507.3849721060.541856556396False705.861671154.25494816885nannanFalse399.4341568625.82057440891480.47057971612.5460969963FalseFalse3
864448188.90234654762.363955154318.5469880.005322059218.5009490.005839707219.4078910.0084091621nannan17.6643510.008488390317.4867040.0035544478nannannannan17.9093020.005924681817.6424780.001445106217.4433340.02033648517.2858090.0074940858nannannannan138.4218980440.678516137471144.4176919760.776760535336False62.63882464150.485145496536nannanFalse312.0754461052.43983591777367.5516697111.20327867678FalsenannannannanFalse249.0457873681.35900141979318.4262042970.423822729735False382.5307923177.16502930077442.2587152793.05260591254FalsenannannannanFalseFalse3
956084189.46241654762.363689154318.4046930.005474854418.3774520.006063913419.2651470.0096437775nannan17.6289510.008975080217.4928690.0037101607nannannannan17.9301770.006630229617.8087340.0018493184nannannannan17.9434580.024707717.5321820.07423976157.8057414110.795739751445161.8151573950.903749084677False71.43995955350.634547389618nannanFalse322.4182378142.66522340292365.4705611091.24888025921FalsenannannannanFalse244.3032249721.49187847517273.216170620.465365057637FalsenannannannanFalse241.333049115.49192755236352.47409164824.101242876FalseFalse3
In [23]:
catalogue.write("{}/Hawaii.fits".format(OUT_DIR), overwrite=True)