Mosaicking

In order to coadd multiple visit images, you have to define the tract and determine wcs and flux scale.

Define tract

We use makeDiscreteSkyMap.py to define tract. Based on the coordinates in the header, the tract is determined as a square covering the entire observed area specified with –id. You have to select all visits and filters for each target (target field) because the tract definition depends on the selected data. In case of the object observed with two filters, if you execute makeDiscreteSkyMap.py to each filter data, the definition of tract/patch can be slightly different. It can cause failures of stack and multi-band analysis.

# Assume that a directory for reduction is ~/HSC, rerun name is test, and field name is test_field (you can check your field name with registry.sqlite3).
makeDiscreteSkyMap.py ~/HSC --calib ~/HSC/CALIB --rerun test --id field=test_field

# makeDiscreteSkyMap.py [data reduction directory] --calib [calib directory] --rerun [rerun name] --id [visit, field, filter..]
# Option
#       --id : Specify all data used to define tract.

You can see the following message when the process is finished successfully.

makeDiscreteSkyMap INFO: tract 0 has corners (177.676, 57.388), (173.867, 57.388), (173.752, 59.440), (177.790, 59.440) (RA, Dec deg) and 11 x 11 patches

# It means that the tract 0 which has 11x11 patch is determined

If you want to define your tract as same as HSC-SSP, use makeSkyMap.py (Defining tract same as SSP).

Note

If the number of patches is larger than patch=31x31, coaddDriver.py does not work properly. Please make sure the number of patches is smaller than 31x31.

Mosaicking

Note

From hscpipe7, mosaic process changes over from mosaic.py to jointcal.py, which is faster than mosaic.py.

For hscpipe7, there was a photometric offset (~>5%) among some of the data processed with jointcal.py, and it was recommended to use mosaic.py. Hscpipe8 avoids this problem by using jointcal.py only for positional calibration and using a new software, fgcmCalibrateTract.py, for flux calibration. Because fgcmCalibrateTract.py is only available for regions with two bands or more, there is an option to use jointcal.py for both positional and flux calibrations, and skip fgcmCalibrateTract.py for monochromatic images.

Next, you need to match the wcs and flux scale of each visit/CCD data. It can be done by jointcal.py and fgcmCalibrateTract.py. This command generates a matched list of reference bright stars from each CCD in a given tract. Then it solves spatially-varying correction terms of relative positions and flux scales on different CCDs/visits.

First, a positional calibration is performed by joincal.py. Since jointcal.py runs in a single band, you have to specify only object IDs taken with the same filter. If you have two or more band data, execute jointcal.py to each band.

# A directory for reduction is ~/HSC, and rerun name is test
# Execute to each filter
jointcal.py ~/HSC/ --calib ~/HSC/CALIB --rerun test --id visit=20878..20890:2 tract=0 ccd=0..103

# jointcal.py [data reduction directory] --calib [calib directory] --rerun [rerun name] --id [visit, field, filter, ccd] tract=[tract]
# Options
#       --id : Specify the object ID. You can also use field and filter. The tract must be selected here.
#                If you set tracts with makeskyMap.py and do not know the tract ID, run without setting tract.

# To skip fgcmCalibrateTract.py, add "--config doPhotometry=True" to jointcal.py.
# In that case, coaddDriver.py needs the option to apply the flux calibration results by jointcal.py.
jointcal.py ~/HSC/ --calib ~/HSC/CALIB --rerun test --id visit=20878..20890:2 tract=0 ccd=0..103 --config doPhotometry=True

When jointcal.py is completed, jointcal_wcs-[visit]-[ccd].fits are made under ~/HSC/rerun/[rerun]/jointcal-results/[filter]/[tract]. (If you apply the “doPhotometry” option, jointcal_photoCalib-[visit]-[ccd].fits are also made.)

The next step is a flux calibration, but before running fgcmCalibrateTract.py, you need to run fgcmMakeLut.py to create a lookup table to track atmospheric and instrumental variations.

fgcmMakeLut.py ~/HSC --rerun test --calib ~/HSC/CALIB
# fgcmMakeLut.py [data reduction directory] --rerun [reurn name] --calib [calib directory]

When fgcmMakeLut.py is completed, fgcmLookUpTable.fits is made under ~/HSC/rerun/[rerun]/fgcm-process/. Then run fgcmCalibrateTract.py.

fgcmCalibrateTract.py ~/HSC --calib ~/HSC/CALIB --rerun test --id visit=20878..20890:2 tract=0 ccd=0..103 --config fgcmFitCycle.colorSplitBands=iy
# fgcmCalibrateTract.py [data reduction directory] --rerun [rerun name] --calib [calib directory] --id [visit, field, ccd] tract=[tract]
# Options
#       --id : Specify the object ID. You can also use field. The tract must be selected here.
#                  Unlike jointcal.py, fgcmCalibrateTract.py runs in a multiband and does not require a filter specification in --id option.
#       --config fgcmFitCycle.colorSplitBands : Specify two bands to separate stars by color (default is g, i-band).

When fgcmCalibrateTract.py is completed, fgcm_photoCalib-[visit]-[ccd].fits and atmosphere_[visit].fits are made under ~/HSC/rerun/[rerun]/fgcm-results/[filter]/[tract] and ~/HSC/rerun/[rerun]/fgcm-results/transmission/[tract], respectively.

Applying the mosaic solution to each visit/CCD data

We previously offer two commands, calibrateExposure.py and calibrateCatalog.py, to apply the wcs and flux scale determined by jointcal.py and fgcm, which however are not supported officially now.

A similar process is performed during the execution of coaddDriver and WCS and flux scaling are properly adopted in the final coadded images. Only if you need pre-coadd CCD images that reflects the mosaicing results (WCS and flux scale), please use calibrateExposure.py and calibrateCatalog.py.

For more details, please see 、Applying the mosaic solution to each visit/CCD data.