LSSTApplications  16.0-1-gce273f5+18,16.0-10-gc1446dd+17,16.0-12-g569485f+1,16.0-12-g6065a46,16.0-13-g5e87145+1,16.0-13-g80874fd,16.0-13-gb122224+8,16.0-13-gd9b1b71+17,16.0-14-g08f9460,16.0-15-g77ef378+3,16.0-16-gf910c00+1,16.0-17-g0bdc215+10,16.0-17-g6a7bfb3b+17,16.0-2-g0febb12+14,16.0-2-g839ba83+55,16.0-2-g9d5294e+43,16.0-2-gc6e0ed0+1,16.0-21-g8fa7d5a4,16.0-3-g404ea43+10,16.0-3-gbc759ec+15,16.0-3-gcfd6c53+41,16.0-4-g03cf288+32,16.0-4-g13a27c5+18,16.0-4-g5f3a788+13,16.0-4-g8a0f11a+39,16.0-4-ga3eb747+3,16.0-5-g1991253+17,16.0-5-g1e9226d+1,16.0-5-g865efd9+18,16.0-5-gb3f8a4b+49,16.0-5-gd0f1235+7,16.0-51-gb4b4a8566,16.0-6-gf9cb114+19,16.0-7-g6043bfc+5,16.0-7-ga8e1655+13,16.0-7-gde5bd64,16.0-8-g4dec96c+30,16.0-8-gfd407c0+3,16.0-9-g2f60796,master-g5768c874b9+2,w.2018.41
High-level Overview of Multi-Band Coadd Processing

The goal of the multi-band coadd measurement procedure is to consistently detect and measure sources across coadds constructed in multiple filter bands in a consistent and reasonable manner i.e.

measure the same sources, with consistent centroids and shapes, across all the photometric bands. This is useful, for example:

Consider how this workflow contrasts with a simpler approach in which detection and measurement is carried out in each band independently.

Our strategy for is broken up into a number of simple steps:

i. DetectCoaddSourcesTask: Detect Sources in Individual Coadds
Begin by detecting sources on each coadd. After scaling the variance plane in a coadd to correct for the effects of warping, sources are detected using the SourceDetectionTask subtask. This step produces sources with footprints in each band.
ii. MergeDetectionsTask: Merge Footprints and Peaks from Multiple Coadds
Footprints and peaks from all the bands are merged together while keeping track of the band(s) that each source comes from. This produces a cross-band master source catalog. During the merging process, we cull garbage peaks around bright sources using the criteria described in CullPeaksConfig.
iii. MeasureMergedCoaddSourcesTask: Deblend & Measure Sources
The master catalog is used to deblend & measure sources in each coadd. This ensures that all bands will have the same sources. First, the SourceDeblendTask subtask is used to deblend sources. The deblender has to retain all peaks from the master catalog, deblending peaks that do not correspond to sources in the given coadd (dropouts) as PSFs. Next, the SingleFrameMeasurementTask subtask is used to measure the properties of the deblended children. After this, the SetPrimaryFlagsTask subtask is run to set 'is-primary' (i.e. source to select for a self-consistent catalog) and related flags. The PropagateVisitFlagsTask subtask is used to propagate flags from individual visits to the coadd (e.g. was the source used for PSF determination in the original visit etc). At this point, the ANetAstrometryTask subtask can be run (optional, not run by default) to match the sources to an external reference catalog such as from PanSTARRS etc.
iv. MergeMeasurementsTask Merge Deblended Peaks
Deblended peaks from each band are merged. A 'reference' band for each peak is tracked. This reference band is the first band from a priority-sorted list of bands (e.g. ["HSC-I", "HSC-R", "HSC-Z", "HSC-Y", "HSC-G",] in the case of HSC). Every source must have a centroid, shape, and CModel fit in every band, even if the object was not detected in the canonical band.
v. ForcedPhotCoaddTask: Run Forced Photometry on Coadds
Forced photometry is run on the coadd for each band using reference centroids and shapes but using footprints from the previous de-blending step i.e. the footprints are band specific.
vi. ForcedPhotCcdTask: Run Forced Photometry on Exposures
Forced photometry is run on the individual calibrated exposures for each band for each visit using the reference measurements to provide centroids and shapes (but no deblending).

We now provide a complete run through multiband processing using the ci_hsc package. We will process the HSC-I & -R band coadds generated from HSC engineering test data provided in the ci_hsc package. To begin, assuming that the lsst stack has been already set up, we must set up the obs_subaru and ci_hsc packages. This defines the environment variable $CI_HSC_DIR which points at the location of the package on disc. The raw HSC exposures live in the $CI_HSC_DIR/raw directory. Note that all the scons build commands are cumulative i.e. to build the coadd in step 4, scons checks to see if the targets of step 3 exist. If not, it first builds step 3 etc. Stepwise, we can process the data in ci_hsc as follows:

1. Process each CCD
Process the individual ccds in $CI_HSC_RAW to produce calibrated exposures.
2. Make a SkyMap
Create a skymap that covers the area of the sky present in the raw exposures.
3. Make coaddTempExps
Warp the individual calibrated exposures to the tangent plane of the coadd.
4. Assemble Coadds
Coadd the calibrated exposures.
$CI_HSC_DIR scons coadd-HSC-R coadd-HSC-I
5. Detect Sources in Individual Coadds
Detect peaks and generate footprints in each coadd individually.
$CI_HSC_DIR scons detect-HSC-I detect-HSC-I
6. Merge Footprints and Peaks from Multiple Coadds
Merge the detected sources in each coadd by running
$CI_HSC_DIR scons mergeDetections
7. Deblend & Measure Sources
Perform deblending and measure sources in each coadd by running
$CI_HSC_DIR scons measure-HSC-I measure-HSC-R
8. Merge Deblended Peaks
Create the catalog for driving forced photometry by running
$CI_HSC_DIR scons mergeMeasurements

Having done this, we can run forced photometry on the coadds and individual visits using the master catalog generated by step 8.