Getting started tutorial part 5: measuring sources¶
In this step of the tutorial series you’ll measure the coadditions you assembled in part 4 to build catalogs of stars and galaxies. This is the measurement strategy:
- Detect sources in individual coadd patches.
- Merge those multi-band source detections into a single detection catalog.
- Deblend and measure sources in the individual coadds using the unified detection catalog.
- Merge the multi-band catalogs of source measurements to identify the best positional measurements for each source.
- Re-measure the coadds in each band using fixed positions (forced photometry).
Tip
Instead of running multiple command-line tasks, like you’ll do here, you could instead run the multiBandDriver.py command as an integrated multi-band source measurement pipeline.
Set up¶
Pick up your shell session where you left off in part 4.
That means your current working directory must contain the DATA
directory (the Butler repository).
The lsst_distrib
package also needs to be set up in your shell environment.
See Setting up installed LSST Science Pipelines for details on doing this.
Detecting sources in coadded images¶
To start, you can detect sources in the coadded images to take advantage of their depth and high signal-to-noise ratio. Use the detectCoaddSources.py command-line task to accomplish this:
detectCoaddSources.py DATA --rerun coadd:coaddPhot \
--id filter=HSC-R tract=0 patch=0,0^0,1^0,2^1,0^1,1^1,2^2,0^2,1^2,2
Notice that since this task operates on coadds, we need to select the coadds using the filter
, tract
, and patch
data ID keys.
Also notice that you’ve created a new rerun for the photometry outputs, coaddPhot
, that is chained to the coadd
rerun.
Now repeat source detection in HSC-I
-band patches:
detectCoaddSources.py DATA --rerun coaddPhot \
--id filter=HSC-I tract=0 patch=0,0^0,1^0,2^1,0^1,1^1,2^2,0^2,1^2,2
The detectCoaddSources.py commands produce deepCoadd_det
datasets in the Butler repository.
Typically these datasets are only used as inputs for the mergeCoaddDetections.py command, which you’ll run next.
Merging multi-band detection catalogs¶
Next, use the mergeCoaddDetections.py command to combine the individual HSC-R
and HSC-I
-band detection catalogs:
mergeCoaddDetections.py DATA --rerun coaddPhot --id filter=HSC-R^HSC-I
This command created a deepCoadd_mergeDet
dataset, which is a consistent table of sources across all filters.
Deblending and measuring source catalogs on coadds¶
Using the merged table of sources, the deblender retains all peaks and deblends any missing peaks (dropouts in that band) as PSFs. Repeating this procedure with the same master catalog across multiple coadds will generate a consistent set of child sources. Run the HSC-SDSS deblender separately in each band:
deblendCoaddSources.py DATA --rerun coaddPhot --id filter=HSC-R
deblendCoaddSources.py DATA --rerun coaddPhot --id filter=HSC-I
The deblendCoaddSources command-line task produces deepCoadd_deblendedFlux
datasets in the Butler data repository.
Now, use the merged detection catalog to measure sources in both the HSC-R
and HSC-I
coadd patches.
You can accomplish this with measureCoaddSources.py:
measureCoaddSources.py DATA --rerun coaddPhot --id filter=HSC-R
And repeat with the HSC-I
-band coadd:
measureCoaddSources.py DATA --rerun coaddPhot --id filter=HSC-I
The measureCoaddSources command-line task produces deepCoadd_meas
datasets in the Butler data repository.
Because the same merged detection catalog is used for every filter, the HSC-R
and HSC-I
-band deepCoadd_meas
tables have consistent rows.
You’ll see how to access these tables later.
Merging multi-band source catalogs from coadds¶
The previous step you created measurement catalogs for each patch in both the HSC-R
and HSC-I
bands.
You’ll get even more complete and consistent multi-band photometry by measuring the same source in multiple bands at a fixed position (the forced photometry method) rather than fitting the source’s location individually for each band.
For forced photometry you want to use the best position measurements for each source, which could be from different filters depending on the source. We call the filter that best measures a source the reference filter. Go ahead and run the mergeCoaddMeasurements.py command to create a table that identifies the reference filter for each source in the tables you created with the previous step:
mergeCoaddMeasurements.py DATA --rerun coaddPhot --id filter=HSC-R^HSC-I
This command created a deepCoadd_ref
dataset.
Running forced photometry on coadds¶
Now you have accurate positions for all detected sources in the coadds. Re-measure the coadds using these fixed source positions (the forced photometry method) to create the best possible photometry of sources in your coadds:
forcedPhotCoadd.py DATA --rerun coaddPhot:coaddForcedPhot --id filter=HSC-R
Also run forced photometry on the HSC-I
-band coadds:
forcedPhotCoadd.py DATA --rerun coaddForcedPhot --id filter=HSC-I
The forcedPhotCoadd.py command creates table datasets called deepCoadd_forced_src
in the Butler repository.
In a future tutorial you’ll see how to work with these tables.
Note
You can also try the forcedPhotCcd.py command to apply forced photometry to individual exposures, which may in principle yield better measurements. forcedPhotCcd.py doesn’t currently deblend sources, though. Thus forced coadd photometry, as you’ve performed here, provides the best source photometry.
Wrap up¶
In this tutorial, you’ve created forced photometry catalogs of sources in coadded images. Here are some key takeaways:
- Forced photometry is a method of measuring sources in several bandpasses using a common source list.
- The pipeline for forced photometry consists of the detectCoaddSources.py, mergeCoaddDetections.py, measureCoaddDetections.py, mergeCoaddMeasurements.py, and forcedPhotCoadd.py command-line tasks.
Continue this tutorial series in part 6 where you will analyze and plot the source catalogs that you’ve just measured.