{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Cataloguing the data\n", "\n", "The primary use for the galfind `Data` object is the creation of photometric catalogues for public and personal use. Once produced, these catalogues can be loaded into the `Catalogue` class to derive specific properties, which we cover in the [next section](../catalogue/catalogue.rst). In this first galfind release, we implement the ability to produce these using SExtractor only, although we aim to include other codes to perform forced photometry in the near future.\n", "\n", "The cataloguing procedure involves many different steps that have been explained in previous notebooks in this section. We outline these here.\n", "\n", "1. Instantiate a blank `Data` object from the reduced imaging\n", "2. Produce segmentation maps for each band using SExtractor\n", "3. Mask the data (i.e. image edges, stars, artefacts) either manually or automatically\n", "4. Perform forced photometry in a set of given apertures in either a single band or an inverse-variance weighted stack of bands.\n", "5. Aperture correct the fluxes based on a given model or empirical PSF\n", "6. Apply boolean mask columns to the catalogue to indicate whether each source falls in the mask\n", "7. Calculate local depths for each source\n", "8. Determine appropriate flux errors based on these depths, accounting for the correlated image noise\n", "\n", "We will create a `Data` object and associated .fits catalogue following these 8 steps in two ways, long (example 1) and short (example 2).\n", "\n", "## Example 1: Producing photometric catalogues\n", "\n", "To start with, we will load the same JOF `Data` object we have seen in previous examples." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Reading GALFIND config file from: /nvme/scratch/work/austind/GALFIND/galfind/../configs/galfind_config.ini\n", "Important: Gaia archive will be intermittently unavailable due to scheduled maintenance on 14-10-2024 from 10:30 to 12:30 (CEST)\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "INFO:galfind:Loaded aper_diams= for F277W+F356W+F444W\n", "INFO:galfind:Combined mask for NIRCam/F277W+F356W+F444W already exists at /raid/scratch/work/austind/GALFIND_WORK/Masks/JOF/combined/JOF_F277W+F356W+F444W_auto.fits\n", "WARNING:galfind:Aperture correction columns already in /raid/scratch/work/austind/GALFIND_WORK/Catalogues/v11/NIRCam/JOF/(0.32)as/JOF_MASTER_Sel-F277W+F356W+F444W_v11.fits\n", "Calculating depths: 0%| | 0/15 [00:00: {'mode': 'n_nearest', 'scatter_size': 0.1, 'distance_to_mask': 30, 'region_radius_used_pix': 300, 'n_nearest': 200, 'coord_type': 'sky', 'split_depth_min_size': 100000, 'split_depths_factor': 5, 'step_size': 100, 'n_split': 'auto'}}\n", "----------\n", "****************************************\n", "NIRCam/F090W\n", "----------\n", "IM NAME: jw01210-o001_t002_nircam_clear-f090w_i2dnobg.fits[1]\n", "RMS ERR NAME: jw01210-o001_t002_nircam_clear-f090w_i2dnobg.fits[2]\n", "WHT NAME: jw01210-o001_t002_nircam_clear-f090w_i2dnobg.fits[4]\n", "SEG PATH: JOF_F090W_F090W_sel_cat_v11_seg.fits\n", "MASK PATH: F090W_auto.fits\n", "FORCED PHOT PATH: JOF_F090W_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 29.81\n", "MEAN DEPTH: 29.808\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F090W.h5\n", "****************************************\n", "NIRCam/F115W\n", "----------\n", "IM NAME: jw01210-o001_t002_nircam_clear-f115w_i2dnobg.fits[1]\n", "RMS ERR NAME: jw01210-o001_t002_nircam_clear-f115w_i2dnobg.fits[2]\n", "WHT NAME: jw01210-o001_t002_nircam_clear-f115w_i2dnobg.fits[4]\n", "SEG PATH: JOF_F115W_F115W_sel_cat_v11_seg.fits\n", "MASK PATH: F115W_auto.fits\n", "FORCED PHOT PATH: JOF_F115W_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 29.877\n", "MEAN DEPTH: 29.863\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F115W.h5\n", "****************************************\n", "NIRCam/F150W\n", "----------\n", "IM NAME: jw01210-o001_t002_nircam_clear-f150w_i2dnobg.fits[1]\n", "RMS ERR NAME: jw01210-o001_t002_nircam_clear-f150w_i2dnobg.fits[2]\n", "WHT NAME: jw01210-o001_t002_nircam_clear-f150w_i2dnobg.fits[4]\n", "SEG PATH: JOF_F150W_F150W_sel_cat_v11_seg.fits\n", "MASK PATH: F150W_auto.fits\n", "FORCED PHOT PATH: JOF_F150W_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.118\n", "MEAN DEPTH: 30.121\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F150W.h5\n", "****************************************\n", "NIRCam/F162M\n", "----------\n", "IM NAME: jw03215-o001_t002_nircam_clear-f162m_i2dnobg.fits[1]\n", "RMS ERR NAME: jw03215-o001_t002_nircam_clear-f162m_i2dnobg.fits[2]\n", "WHT NAME: jw03215-o001_t002_nircam_clear-f162m_i2dnobg.fits[4]\n", "SEG PATH: JOF_F162M_F162M_sel_cat_v11_seg.fits\n", "MASK PATH: F162M_auto.fits\n", "FORCED PHOT PATH: JOF_F162M_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 29.894\n", "MEAN DEPTH: 29.889\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F162M.h5\n", "****************************************\n", "NIRCam/F182M\n", "----------\n", "IM NAME: jw03215-o001_t002_nircam_clear-f182m_i2dnobg.fits[1]\n", "RMS ERR NAME: jw03215-o001_t002_nircam_clear-f182m_i2dnobg.fits[2]\n", "WHT NAME: jw03215-o001_t002_nircam_clear-f182m_i2dnobg.fits[4]\n", "SEG PATH: JOF_F182M_F182M_sel_cat_v11_seg.fits\n", "MASK PATH: F182M_auto.fits\n", "FORCED PHOT PATH: JOF_F182M_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.259\n", "MEAN DEPTH: 30.255\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F182M.h5\n", "****************************************\n", "NIRCam/F200W\n", "----------\n", "IM NAME: jw01210-o001_t002_nircam_clear-f200w_i2dnobg.fits[1]\n", "RMS ERR NAME: jw01210-o001_t002_nircam_clear-f200w_i2dnobg.fits[2]\n", "WHT NAME: jw01210-o001_t002_nircam_clear-f200w_i2dnobg.fits[4]\n", "SEG PATH: JOF_F200W_F200W_sel_cat_v11_seg.fits\n", "MASK PATH: F200W_auto.fits\n", "FORCED PHOT PATH: JOF_F200W_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.11\n", "MEAN DEPTH: 30.105\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F200W.h5\n", "****************************************\n", "NIRCam/F210M\n", "----------\n", "IM NAME: jw03215-o001_t002_nircam_clear-f210m_i2dnobg.fits[1]\n", "RMS ERR NAME: jw03215-o001_t002_nircam_clear-f210m_i2dnobg.fits[2]\n", "WHT NAME: jw03215-o001_t002_nircam_clear-f210m_i2dnobg.fits[4]\n", "SEG PATH: JOF_F210M_F210M_sel_cat_v11_seg.fits\n", "MASK PATH: F210M_auto.fits\n", "FORCED PHOT PATH: JOF_F210M_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.072\n", "MEAN DEPTH: 30.069\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F210M.h5\n", "****************************************\n", "NIRCam/F250M\n", "----------\n", "IM NAME: jw03215-o001_t002_nircam_clear-f250m_i2dnobg.fits[1]\n", "RMS ERR NAME: jw03215-o001_t002_nircam_clear-f250m_i2dnobg.fits[2]\n", "WHT NAME: jw03215-o001_t002_nircam_clear-f250m_i2dnobg.fits[4]\n", "SEG PATH: JOF_F250M_F250M_sel_cat_v11_seg.fits\n", "MASK PATH: F250M_auto.fits\n", "FORCED PHOT PATH: JOF_F250M_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 29.815\n", "MEAN DEPTH: 29.815\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F250M.h5\n", "****************************************\n", "NIRCam/F277W\n", "----------\n", "IM NAME: jw01210-o001_t002_nircam_clear-f277w_i2dnobg.fits[1]\n", "RMS ERR NAME: jw01210-o001_t002_nircam_clear-f277w_i2dnobg.fits[2]\n", "WHT NAME: jw01210-o001_t002_nircam_clear-f277w_i2dnobg.fits[4]\n", "SEG PATH: JOF_F277W_F277W_sel_cat_v11_seg.fits\n", "MASK PATH: F277W_auto.fits\n", "FORCED PHOT PATH: JOF_F277W_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.384\n", "MEAN DEPTH: 30.385\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F277W.h5\n", "****************************************\n", "NIRCam/F300M\n", "----------\n", "IM NAME: jw03215-o001_t002_nircam_clear-f300m_i2dnobg.fits[1]\n", "RMS ERR NAME: jw03215-o001_t002_nircam_clear-f300m_i2dnobg.fits[2]\n", "WHT NAME: jw03215-o001_t002_nircam_clear-f300m_i2dnobg.fits[4]\n", "SEG PATH: JOF_F300M_F300M_sel_cat_v11_seg.fits\n", "MASK PATH: F300M_auto.fits\n", "FORCED PHOT PATH: JOF_F300M_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.095\n", "MEAN DEPTH: 30.097\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F300M.h5\n", "****************************************\n", "NIRCam/F335M\n", "----------\n", "IM NAME: jw03215-o001_t002_nircam_clear-f335m_i2dnobg.fits[1]\n", "RMS ERR NAME: jw03215-o001_t002_nircam_clear-f335m_i2dnobg.fits[2]\n", "WHT NAME: jw03215-o001_t002_nircam_clear-f335m_i2dnobg.fits[4]\n", "SEG PATH: JOF_F335M_F335M_sel_cat_v11_seg.fits\n", "MASK PATH: F335M_auto.fits\n", "FORCED PHOT PATH: JOF_F335M_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.19\n", "MEAN DEPTH: 30.19\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F335M.h5\n", "****************************************\n", "NIRCam/F356W\n", "----------\n", "IM NAME: jw01210-o001_t002_nircam_clear-f356w_i2dnobg.fits[1]\n", "RMS ERR NAME: jw01210-o001_t002_nircam_clear-f356w_i2dnobg.fits[2]\n", "WHT NAME: jw01210-o001_t002_nircam_clear-f356w_i2dnobg.fits[4]\n", "SEG PATH: JOF_F356W_F356W_sel_cat_v11_seg.fits\n", "MASK PATH: F356W_auto.fits\n", "FORCED PHOT PATH: JOF_F356W_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.41\n", "MEAN DEPTH: 30.411\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F356W.h5\n", "****************************************\n", "NIRCam/F410M\n", "----------\n", "IM NAME: jw01210-o001_t002_nircam_clear-f410m_i2dnobg.fits[1]\n", "RMS ERR NAME: jw01210-o001_t002_nircam_clear-f410m_i2dnobg.fits[2]\n", "WHT NAME: jw01210-o001_t002_nircam_clear-f410m_i2dnobg.fits[4]\n", "SEG PATH: JOF_F410M_F410M_sel_cat_v11_seg.fits\n", "MASK PATH: F410M_auto.fits\n", "FORCED PHOT PATH: JOF_F410M_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 29.806\n", "MEAN DEPTH: 29.807\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F410M.h5\n", "****************************************\n", "NIRCam/F444W\n", "----------\n", "IM NAME: jw04210-o001_t002_nircam_clear-f444w_i2dnobg.fits[1]\n", "RMS ERR NAME: jw04210-o001_t002_nircam_clear-f444w_i2dnobg.fits[2]\n", "WHT NAME: jw04210-o001_t002_nircam_clear-f444w_i2dnobg.fits[4]\n", "SEG PATH: JOF_F444W_F444W_sel_cat_v11_seg.fits\n", "MASK PATH: F444W_auto.fits\n", "FORCED PHOT PATH: JOF_F444W_F277W+F356W+F444W_sel_cat_v11.fits\n", "----------\n", "0.32 arcsec\n", "----------\n", "MEDIAN DEPTH: 30.272\n", "MEAN DEPTH: 30.275\n", "H5 PATH: /raid/scratch/work/austind/GALFIND_WORK/Depths/NIRCam/v11/JOF/0.32as/n_nearest/F444W.h5\n", "****************************************\n", "****************************************\n", "\n" ] } ], "source": [ "print(JOF_data_long)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For safety reasons, once the (path to the) photometric catalogue has been loaded into the Data object, it is not possible to re-run it. This is so that, for example, you don't get confused between the products stemming from the previous catalogue and your newly loaded in one. To be clear, the `overwrite` parameter that we have been using simply states whether the pre-existing paths should be overwritten with the new data and NOT whether the data stored in the object should be updated. Preventing stored paths from being overwritten in a particular object, however, does not entirely prevent you from changing the outputs of any methods run from those stored paths as the information is not cached in a single object, rather extracted from the data products when required. Let's try re-producing this SExtractor forced photometric catalogue but instead using the F356W filter for selection in the same object to see what error message we get out of galfind." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "CRITICAL:galfind:MASTER Photometric catalogue already exists!\n" ] } ], "source": [ "JOF_data_long.perform_forced_phot(forced_phot_band = \"F356W\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2: Running the Data pipeline\n", "\n", "There is one last class method for the Data object that we havn't quite covered yet, `Data.pipeline()` which again just takes `survey` and `version` inputs. This class method is what is used in the EPOCHS pipeline and essentially just chains the cataloguing steps in the previous notebooks together elegantly, skipping those that have already been executed in the past. For further details, please read the previous notebooks in this section if you have not already done so." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:galfind:Loaded aper_diams= for F277W+F356W+F444W\n", "INFO:galfind:Combined mask for NIRCam/F277W+F356W+F444W already exists at /raid/scratch/work/austind/GALFIND_WORK/Masks/JOF/combined/JOF_F277W+F356W+F444W_auto.fits\n", "WARNING:galfind:Aperture correction columns already in /raid/scratch/work/austind/GALFIND_WORK/Catalogues/v11/NIRCam/JOF/(0.32)as/JOF_MASTER_Sel-F277W+F356W+F444W_v11.fits\n", "Calculating depths: 0%| | 0/15 [00:00