Herschel Stripe 82 master catalogue¶

Preparation of SDSS Stripe 82 - IAC Legacy Survey data¶

This catalogue comes from dmu0_IAC_Stripe82_Legacy_Project.

One must choose between this catalogue and the official SDSS catalogue in 'dmu0_SDSS-S82'. Currently we choose this one.

In the catalogue, we keep:

  • We generate a 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",
        "ALPHA_J2000": "sdss_ra",
        "DELTA_J2000": "sdss_dec",
        #"flags": "flags",
        "stellarity": "sdss_stellarity",
        "u_MAG_AUTO": "m_sdss_u",
        "g_MAG_AUTO": "m_sdss_g",
        "r_MAG_AUTO": "m_sdss_r",
        "i_MAG_AUTO": "m_sdss_i",
        "z_MAG_AUTO": "m_sdss_z",
        "u_MAGERR_AUTO": "merr_sdss_u",
        "g_MAGERR_AUTO": "merr_sdss_g",
        "r_MAGERR_AUTO": "merr_sdss_r",
        "i_MAGERR_AUTO": "merr_sdss_i",
        "z_MAGERR_AUTO": "merr_sdss_z",
        "u_MAG_APER_1": "m_ap_sdss_u",
        "g_MAG_APER_1": "m_ap_sdss_g",
        "r_MAG_APER_1": "m_ap_sdss_r",
        "i_MAG_APER_1": "m_ap_sdss_i",
        "z_MAG_APER_1": "m_ap_sdss_z",
        "u_MAGERR_APER_1": "merr_ap_sdss_u",
        "g_MAGERR_APER_1": "merr_ap_sdss_g",
        "r_MAGERR_APER_1": "merr_ap_sdss_r",
        "i_MAGERR_APER_1": "merr_ap_sdss_i",
        "z_MAGERR_APER_1": "merr_ap_sdss_z"        
    })


catalogue = Table.read(
    "../../dmu0/dmu0_IAC_Stripe82_Legacy_Project/data/iac_stripe82_concat_helpcoverage.fits")[list(imported_columns)]
for column in imported_columns:
    catalogue[column].name = imported_columns[column]

catalogue.add_column(Column(data=np.arange(len(catalogue)), name='sdss_id', dtype=int))
    
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]))
        
        mask = catalogue[col] > 90.
        catalogue[col][mask] = np.nan
        catalogue[errcol][mask] = np.nan
        
        # 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 length=10>
idxsdss_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_zsdss_idf_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
degdegmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmag
07.9e-06-0.68115980.022.743422.17921.128320.702320.4440.18290.04610.02950.02820.074124.172323.2822.079221.650721.3750.26640.05870.03460.03030.073902.901616418560.488797960895False4.879777272860.20719372836False12.84339974550.348961645409False19.01428503740.49386106469False24.12126056091.64624279796False0.778179883870.1909369146521.770108958320.09570040622935.34958386120.1704793492077.938162774390.22153293867310.23292992280.696498392502
11.2e-05-0.4418530.025.059223.924223.807623.497423.76060.9830.14620.18980.20780.960125.002724.520624.308723.926424.01020.48030.13260.14990.14810.556710.3438111840350.311278552217False0.9779575412930.131687045076False1.088829803780.190340799038False1.448905296510.277307249491False1.136998783431.00543071806False0.3621762769360.1602168786950.564624865350.06895713417060.6863094834030.09475394770050.9759779367810.1331284079910.9034830306680.463251571578
21.63e-05-0.16935580.023.430522.787221.999421.557321.41210.25930.05850.04420.04170.135123.861623.313122.505622.02521.98320.22150.05870.04350.03940.121721.540990637110.368025741843False2.786891108720.150159061792False5.757580250810.234389390324False8.651272664310.332270461757False9.889173581721.2305266648False1.036000583470.2113534836841.716959298170.09282688590533.612101953440.1447187947555.62341325190.2040665874035.844131775570.655067809262
33.03e-05-0.15351.025.46124.648623.76223.843227.76651.12770.20410.14280.213831.420925.862425.140524.151323.923224.37671.03690.20950.13560.15290.879230.2374652143650.246643264788False0.5018339051640.0943362665766False1.135533627840.149349539368False1.053707327130.207492967033False0.02840534052540.822042555275False0.1640740884060.1566940676040.3190068435980.06155448574050.7933777195420.09908670107750.9788586884060.1378488557360.6446440818780.52201545302
44.24e-05-0.19197930.023.624423.463222.781122.48622.59150.26690.08790.07210.07710.324524.088823.906923.110522.828622.870.2560.08540.06380.06680.241441.288961661450.316857691521False1.495271308220.121055508158False2.802592787420.186110529508False3.677900704220.261174070693False3.337336513050.997448269422False0.8403883048970.1981507157180.9936650163020.07815802035552.069188232950.1215895801242.682625200380.1650487131222.582260190630.574133576174
54.79e-050.01047860.028.727124.775424.35224.567522.107732.74860.31330.34870.64330.287nan25.748324.89625.09223.7945nan0.33490.2540.4440.564750.01172627297840.353694591354False0.4465190581440.128847523278False0.6594775259490.211800815236False0.5407543229460.320397583157False5.210987123331.37745549779False9.12010839356e-318.31593095087e-290.1822552301290.0562174092590.3995765566190.09347799671450.3335799966620.1364139077881.102046703960.573183219829
64.91e-05-0.60331140.024.390523.967624.084422.870422.53190.75380.20470.33560.16550.444426.266724.77624.565423.949525.78361.35710.15990.18360.15092.72660.6365023332470.441907948449False0.9396367628350.177155044208False0.8438009305710.260818043148False2.581309026040.393471859866False3.525656521971.44307774899False0.1130628685830.1413212696440.4462723707620.06572402372890.5418012466720.09161959272710.9554324776410.1327898620720.1764249487710.442956961593
75.4e-05-0.29959980.022.990222.100921.501321.276720.93230.23240.04540.05290.13030.172224.323123.366622.405822.265521.91590.29570.0620.04850.10610.14572.311638931330.494802407146False5.243726115240.219266120618False9.109195019070.443824581327False11.20263019741.34443588444False15.38438004962.43999438623False0.6772671325280.184453544251.634406195890.09333131169543.959861533550.1768876118674.506091435730.4403429665846.21784655140.830393005227
86.2e-05-0.28364170.021.483922.59321.826820.727820.4340.07820.07080.07570.0870.121124.272524.224223.386822.675522.69850.28490.1080.09990.15220.279789.256354950170.666687685214False3.332728995760.217324624403False6.749630522090.470599606316False18.57291195661.48824671513False24.34445183692.71531252668False0.7095777679630.1861950492270.7418566601560.07379372535031.604279374470.1476118313163.088872626510.4330024288543.024126821280.779055048737
96.2e-050.47545110.022.149121.597520.609820.308120.15780.12420.03190.02090.02340.062623.54422.966621.878821.513621.20870.17910.04850.03040.0310.069795.016028553150.573795682203False8.33681184620.244943750359False20.70522718040.398567576705False27.33757578530.58918480435False31.39641059131.81021439131False1.388033666570.2289661416772.362435717090.1055303597486.433984347170.1801479247889.006581846820.25715642163211.92669189040.765646775999

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 37 x 3 (RA, Dec) tiles
INFO:herschelhelp_internal.masterlist:Processing RA between -0.000355 and 0.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between -0.000355 and 0.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between -0.000355 and 0.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 0.999645 and 1.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 0.999645 and 1.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 0.999645 and 1.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 1.999645 and 2.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 1.999645 and 2.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 1.999645 and 2.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 2.999645 and 3.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 2.999645 and 3.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 2.999645 and 3.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 3.999645 and 4.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 3.999645 and 4.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 3.999645 and 4.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 4.999645 and 5.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 4.999645 and 5.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 4.999645 and 5.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 5.999645 and 6.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 5.999645 and 6.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 5.999645 and 6.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 6.999645 and 7.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 6.999645 and 7.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 6.999645 and 7.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 7.999645 and 8.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 7.999645 and 8.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 7.999645 and 8.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 8.999645 and 9.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 8.999645 and 9.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 8.999645 and 9.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 9.999645 and 10.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 9.999645 and 10.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 9.999645 and 10.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 10.999645 and 11.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 10.999645 and 11.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 10.999645 and 11.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 11.999645 and 12.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 11.999645 and 12.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 11.999645 and 12.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 12.999645 and 13.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 12.999645 and 13.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 12.999645 and 13.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 13.999645 and 14.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 13.999645 and 14.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 13.999645 and 14.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 14.999645 and 15.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 14.999645 and 15.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 14.999645 and 15.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 15.999645 and 16.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 15.999645 and 16.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 15.999645 and 16.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 16.999645 and 17.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 16.999645 and 17.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 16.999645 and 17.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 17.999645 and 18.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 17.999645 and 18.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 17.999645 and 18.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 18.999645 and 19.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 18.999645 and 19.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 18.999645 and 19.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 19.999645 and 20.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 19.999645 and 20.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 19.999645 and 20.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 20.999645 and 21.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 20.999645 and 21.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 20.999645 and 21.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 21.999645 and 22.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 21.999645 and 22.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 21.999645 and 22.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 22.999645 and 23.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 22.999645 and 23.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 22.999645 and 23.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 23.999645 and 24.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 23.999645 and 24.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 23.999645 and 24.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 24.999645 and 25.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 24.999645 and 25.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 24.999645 and 25.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 25.999645 and 26.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 25.999645 and 26.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 25.999645 and 26.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 26.999645 and 27.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 26.999645 and 27.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 26.999645 and 27.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 27.999645 and 28.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 27.999645 and 28.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 27.999645 and 28.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 28.999645 and 29.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 28.999645 and 29.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 28.999645 and 29.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 29.999645 and 30.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 29.999645 and 30.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 29.999645 and 30.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 30.999645 and 31.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 30.999645 and 31.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 30.999645 and 31.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 31.999645 and 32.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 31.999645 and 32.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 31.999645 and 32.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 32.999645 and 33.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 32.999645 and 33.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 32.999645 and 33.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 33.999645 and 34.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 33.999645 and 34.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 33.999645 and 34.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 34.999645 and 35.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 34.999645 and 35.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 34.999645 and 35.999645, and Dec between 0.749642 and 1.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 35.999645 and 36.999645, and Dec between -1.250358 and -0.250358
INFO:herschelhelp_internal.masterlist:Processing RA between 35.999645 and 36.999645, and Dec between -0.250358 and 0.749642
INFO:herschelhelp_internal.masterlist:Processing RA between 35.999645 and 36.999645, and Dec between 0.749642 and 1.749642
The initial catalogue had 5290888 sources.
The cleaned catalogue has 5279317 sources (11571 removed).
The cleaned catalogue has 11560 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.06390892208401056 arcsec
Dec correction: -0.0685382447484173 arcsec
In [12]:
catalogue[RA_COL] = catalogue[RA_COL] +  delta_ra.to(u.deg)
catalogue[DEC_COL] = 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)))
184058 sources flagged.

V - Flagging objects near bright stars¶

VI - Saving to disk¶

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