Herschel Stripe 82 master catalogue¶

Preparation of SDSS Stripe 82 data¶

This catalogue comes from dmu0_SDSS-S82.

In the catalogue, we keep:

  • The object_id as unique object identifier;
  • The position;
  • The u, g, r, i, z, aperture magnitude (for now in 3”);
  • The u, g, r, i, z, auto fluxes and magnitudes.

We don't know when the maps have been observed. We will use the year of the reference paper.

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
import numpy as np

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

RA_COL = "sdss_ra"
DEC_COL = "sdss_dec"

I - Column selection¶

In [4]:
imported_columns = OrderedDict({
        "objID": "sdss_id",
        "ra": "sdss_ra",
        "dec": "sdss_dec",
        #"flags": "flags",
        "probPSF": "sdss_stellarity",
        "petroMag_u": "m_sdss_u",
        "petroMag_g": "m_sdss_g",
        "petroMag_r": "m_sdss_r",
        "petroMag_i": "m_sdss_i",
        "petroMag_z": "m_sdss_z",
        "petroMagErr_u": "merr_sdss_u",
        "petroMagErr_g": "merr_sdss_g",
        "petroMagErr_r": "merr_sdss_r",
        "petroMagErr_i": "merr_sdss_i",
        "petroMagErr_z": "merr_sdss_z",
        "fiberMag_u": "m_ap_sdss_u",
        "fiberMag_g": "m_ap_sdss_g",
        "fiberMag_r": "m_ap_sdss_r",
        "fiberMag_i": "m_ap_sdss_i",
        "fiberMag_z": "m_ap_sdss_z",
        "fiberMagErr_u": "merr_ap_sdss_u",
        "fiberMagErr_g": "merr_ap_sdss_g",
        "fiberMagErr_r": "merr_ap_sdss_r",
        "fiberMagErr_i": "merr_ap_sdss_i",
        "fiberMagErr_z": "merr_ap_sdss_z"        
    })


catalogue = Table.read(
    "../../dmu0/dmu0_SDSS-S82/data/SDSS-S82_November2017.fits")[list(imported_columns)]
for column in imported_columns:
    catalogue[column].name = imported_columns[column]

epoch = 2013

# Clean table metadata
catalogue.meta = None
In [5]:
# Adding flux and band-flag columns
for col in catalogue.colnames:
    if col.startswith('m_'):
        
        errcol = "merr{}".format(col[1:])
        flux, error = mag_to_flux(np.array(catalogue[col]), np.array(catalogue[errcol]))
        
        # Fluxes are added in µJy
        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:])))
        
In [6]:
catalogue[:10].show_in_notebook()
Out[6]:
<Table masked=True length=10>
idxsdss_idsdss_rasdss_decsdss_stellaritym_sdss_um_sdss_gm_sdss_rm_sdss_im_sdss_zmerr_sdss_umerr_sdss_gmerr_sdss_rmerr_sdss_imerr_sdss_zm_ap_sdss_um_ap_sdss_gm_ap_sdss_rm_ap_sdss_im_ap_sdss_zmerr_ap_sdss_umerr_ap_sdss_gmerr_ap_sdss_rmerr_ap_sdss_imerr_ap_sdss_zf_sdss_uferr_sdss_uflag_sdss_uf_sdss_gferr_sdss_gflag_sdss_gf_sdss_rferr_sdss_rflag_sdss_rf_sdss_iferr_sdss_iflag_sdss_if_sdss_zferr_sdss_zflag_sdss_zf_ap_sdss_uferr_ap_sdss_uf_ap_sdss_gferr_ap_sdss_gf_ap_sdss_rferr_ap_sdss_rf_ap_sdss_iferr_ap_sdss_if_ap_sdss_zferr_ap_sdss_z
086474746924819438800.0001311753126390.4912634993270.030.555723.342322.637322.066722.25110.8372230.1267220.1079920.09929460.39403428.838723.587722.811722.406322.23192.089660.08816150.06508040.07662390.2132120.002176250.00167813False1.671360.195074False3.199540.318241False5.411440.494896False4.566391.65723False0.0105810.02036481.333240.1082592.724780.1633273.957960.2793264.647710.912697
186474751225155425660.0001345725294021.169303099280.024.097222.868122.515822.334322.93331.003140.1269530.1691530.365561.3595924.836323.381522.94622.703222.62620.6853270.07139730.08902610.1771580.3631440.833940.770501False2.586870.302478False3.578320.557486False4.229551.42406False2.436033.05047False0.4221510.2664661.612150.1060142.407750.1974263.010930.4912893.232331.08111
286474746903344601540.000137217793067-1.158891260960.023.271824.358223.643422.621822.20780.511230.7296230.4847540.2616890.5879224.483824.77523.891323.193223.29960.4678910.3901630.1854610.1587090.5748161.783550.8398False0.6557020.440637False1.266610.56551False3.245410.782223False4.751862.5731False0.5840790.2517050.4466650.160511.008010.1721831.917420.2802821.738380.920343
386474751198311883400.000143891377017-0.9994297146620.024.332124.506524.03723.808723.21790.7126740.6627260.3598710.4797030.91137224.873325.494924.475423.939823.36410.6013050.6914460.2834070.2822880.5384790.6716670.44088False0.5719960.349142False0.8814840.292171False1.087740.480586False1.874341.57333False0.4080270.2259750.2301690.1465820.5886520.1536540.9640150.2506411.638120.812437
486474751225155425480.0001492624707481.059508238741.028.353323.784522.368520.916920.11215.206510.1647110.06977350.03182020.050715829.929424.011122.589221.155720.41050.8344410.1170120.04943210.02302340.03817060.01654560.0793425False1.112220.168729False4.098340.263375False15.60340.457298False32.74561.52958False0.003874780.002977960.9027530.09729153.344320.15226212.5230.26555524.87770.874612
586474751203680609030.000153237080115-0.4984896009711.027.747725.247723.882922.654421.91976.587890.6223320.2859660.1619120.26588126.724925.340124.01422.9322.25123.027450.385420.1794030.1098170.2053640.02890120.175363False0.2890090.165657False1.015890.267571False3.149470.46967False6.196191.51735False0.07413780.2067250.2654470.09422990.9003660.1487732.443320.2471314.565640.86358
686474751209049315730.000158245625013-0.1896234681650.030.538623.460422.222222.004823.98175.327540.8065020.2699440.55414112.611825.08225.309923.913122.641121.90410.773520.3647550.1686620.08251060.1572010.00221080.0108481False1.499071.11353False4.689381.16591False5.728962.92396False0.92752810.774False0.3366770.2398610.2729190.09168780.9880330.1534843.188230.2422896.285820.910107
786474746919450728250.0001695920604620.07399017167820.022.975622.868222.467721.839921.05540.4851290.1160240.1252310.1111790.24897423.906823.631123.032122.459121.83620.3399880.09307430.08258570.0772910.2019772.342971.04689False2.586440.276394False3.740280.431409False6.668630.682864False13.73543.14971False0.9937710.311191.281060.1098192.224050.1691713.770110.2683856.691171.24474
886474746908713309560.000172304462786-0.7213253504110.024.329823.976623.747423.640422.88470.767470.2101450.2525610.3697980.70207724.630724.293224.005423.905623.20520.6201570.1735280.2033490.30040.5750840.6730760.475775False0.9318940.180369False1.150920.267724False1.270090.432587False2.547631.64739False0.5101620.2913970.6961810.1112670.9074920.1699660.9948250.2752471.896431.00449
986474751209049315600.000176910175625-0.1420149125161.026.267233.059622.846722.707926.02418.925190.3994140.269130.37433415.488826.072825.035123.578723.242923.39831.813930.2835990.1241020.1431320.616050.113010.928986False0.000216867.97772e-05False2.638250.653962False2.998041.03365False0.1413722.01677False0.1351740.2258330.3515260.09182041.344420.153671.831610.2414611.587410.9007

II - Removal of duplicated sources¶

We remove duplicated objects from the input catalogues.

In [7]:
import logging
logging.basicConfig(level=logging.INFO)
In [8]:
SORT_COLS = []
FLAG_NAME = 'sdss_flag_cleaned'

nb_orig_sources = len(catalogue)

catalogue = remove_duplicates_tiled(
    catalogue, RA_COL, DEC_COL, 
    sort_col= SORT_COLS,
    flag_name=FLAG_NAME,
    near_ra0=True)

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])))
INFO:herschelhelp_internal.masterlist:The catalogue is divided in 47 x 3 (RA, Dec) tiles
INFO:herschelhelp_internal.masterlist:Processing RA between -9.924922 and -8.924922, and Dec between -1.258481 and -0.258481
/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/column.py:1096: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.
Check the NumPy 1.11 release notes for more information.
  ma.MaskedArray.__setitem__(self, index, value)
INFO:herschelhelp_internal.masterlist:Processing RA between -9.924922 and -8.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -9.924922 and -8.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -8.924922 and -7.924922, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -8.924922 and -7.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -8.924922 and -7.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -7.924922 and -6.924922, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -7.924922 and -6.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -7.924922 and -6.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -6.924922 and -5.924922, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -6.924922 and -5.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -6.924922 and -5.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -5.924922 and -4.924922, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -5.924922 and -4.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -5.924922 and -4.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -4.924922 and -3.924922, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -4.924922 and -3.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -4.924922 and -3.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -3.924922 and -2.924922, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -3.924922 and -2.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -3.924922 and -2.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -2.924922 and -1.924922, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -2.924922 and -1.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -2.924922 and -1.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -1.924922 and -0.924922, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -1.924922 and -0.924922, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -1.924922 and -0.924922, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -0.924922 and 0.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between -0.924922 and 0.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between -0.924922 and 0.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 0.075078 and 1.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 0.075078 and 1.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 0.075078 and 1.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 1.075078 and 2.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 1.075078 and 2.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 1.075078 and 2.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 2.075078 and 3.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 2.075078 and 3.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 2.075078 and 3.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 3.075078 and 4.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 3.075078 and 4.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 3.075078 and 4.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 4.075078 and 5.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 4.075078 and 5.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 4.075078 and 5.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 5.075078 and 6.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 5.075078 and 6.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 5.075078 and 6.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 6.075078 and 7.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 6.075078 and 7.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 6.075078 and 7.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 7.075078 and 8.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 7.075078 and 8.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 7.075078 and 8.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 8.075078 and 9.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 8.075078 and 9.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 8.075078 and 9.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 9.075078 and 10.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 9.075078 and 10.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 9.075078 and 10.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 10.075078 and 11.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 10.075078 and 11.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 10.075078 and 11.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 11.075078 and 12.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 11.075078 and 12.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 11.075078 and 12.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 12.075078 and 13.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 12.075078 and 13.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 12.075078 and 13.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 13.075078 and 14.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 13.075078 and 14.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 13.075078 and 14.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 14.075078 and 15.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 14.075078 and 15.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 14.075078 and 15.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 15.075078 and 16.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 15.075078 and 16.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 15.075078 and 16.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 16.075078 and 17.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 16.075078 and 17.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 16.075078 and 17.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 17.075078 and 18.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 17.075078 and 18.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 17.075078 and 18.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 18.075078 and 19.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 18.075078 and 19.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 18.075078 and 19.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 19.075078 and 20.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 19.075078 and 20.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 19.075078 and 20.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 20.075078 and 21.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 20.075078 and 21.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 20.075078 and 21.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 21.075078 and 22.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 21.075078 and 22.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 21.075078 and 22.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 22.075078 and 23.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 22.075078 and 23.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 22.075078 and 23.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 23.075078 and 24.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 23.075078 and 24.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 23.075078 and 24.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 24.075078 and 25.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 24.075078 and 25.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 24.075078 and 25.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 25.075078 and 26.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 25.075078 and 26.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 25.075078 and 26.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 26.075078 and 27.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 26.075078 and 27.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 26.075078 and 27.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 27.075078 and 28.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 27.075078 and 28.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 27.075078 and 28.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 28.075078 and 29.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 28.075078 and 29.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 28.075078 and 29.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 29.075078 and 30.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 29.075078 and 30.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 29.075078 and 30.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 30.075078 and 31.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 30.075078 and 31.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 30.075078 and 31.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 31.075078 and 32.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 31.075078 and 32.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 31.075078 and 32.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 32.075078 and 33.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 32.075078 and 33.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 32.075078 and 33.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 33.075078 and 34.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 33.075078 and 34.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 33.075078 and 34.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 34.075078 and 35.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 34.075078 and 35.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 34.075078 and 35.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 35.075078 and 36.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 35.075078 and 36.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 35.075078 and 36.075078, and Dec between 0.741519 and 1.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 36.075078 and 37.075078, and Dec between -1.258481 and -0.258481
INFO:herschelhelp_internal.masterlist:Processing RA between 36.075078 and 37.075078, and Dec between -0.258481 and 0.741519
INFO:herschelhelp_internal.masterlist:Processing RA between 36.075078 and 37.075078, and Dec between 0.741519 and 1.741519
The initial catalogue had 6377638 sources.
The cleaned catalogue has 6376812 sources (826 removed).
The cleaned catalogue has 826 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 [9]:
gaia = Table.read("../../dmu0/dmu0_GAIA/data/GAIA_Herschel-Stripe-82.fits")
gaia_coords = SkyCoord(gaia['ra'], gaia['dec'])
In [10]:
nb_astcor_diag_plot(catalogue[RA_COL], catalogue[DEC_COL], 
                    gaia_coords.ra, gaia_coords.dec, near_ra0=True)
In [11]:
delta_ra, delta_dec =  astrometric_correction(
    SkyCoord(catalogue[RA_COL], catalogue[DEC_COL]),
    gaia_coords, near_ra0=True
)

print("RA correction: {}".format(delta_ra))
print("Dec correction: {}".format(delta_dec))
RA correction: 0.06227235712685797 arcsec
Dec correction: -0.0734814464327993 arcsec
In [12]:
catalogue[RA_COL] +=  delta_ra.to(u.deg)
catalogue[DEC_COL] += delta_dec.to(u.deg)
In [13]:
nb_astcor_diag_plot(catalogue[RA_COL], catalogue[DEC_COL], 
                    gaia_coords.ra, gaia_coords.dec, near_ra0=True)

IV - Flagging Gaia objects¶

In [14]:
catalogue.add_column(
    gaia_flag_column(SkyCoord(catalogue[RA_COL], catalogue[DEC_COL]), epoch, gaia)
)
In [15]:
GAIA_FLAG_NAME = "sdss_flag_gaia"

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

V - Flagging objects near bright stars¶

VI - Saving to disk¶

In [16]:
catalogue.write("{}/SDSS-S82.fits".format(OUT_DIR), overwrite=True)