Getting started tutorial part 5: measuring sources
In this step of the :ref:`tutorial series <getting-started-tutorial>` you'll measure the coadditions you assembled in :doc:`part 4 <coaddition>` to build catalogs of stars and galaxies. This is the measurement strategy:
- :ref:`Detect sources in individual coadd patches <getting-started-tutorial-detect-coadds>`.
- :ref:`Merge those multi-band source detections into a single detection catalog <getting-started-tutorial-merge-coadd-detections>`.
- :ref:`Deblend and measure sources in the individual coadds using the unified detection catalog <getting-started-tutorial-measure-coadds>`.
- :ref:`Merge the multi-band catalogs of source measurements to identify the best positional measurements for each source <getting-started-tutorial-merge-coadds>`.
- :ref:`Re-measure the coadds in each band using fixed positions (forced photometry) <getting-started-tutorial-forced-coadds>`.
Instead of running multiple command-line tasks, like you'll do here, you could instead run the :command:`multiBandDriver.py` command as an integrated multi-band source measurement pipeline.
lsst_distrib package also needs to be set up in your shell environment.
See :doc:`/install/setup` 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 :command:`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
patch data ID keys.
Also notice that you've created a new rerun for the photometry outputs,
coaddPhot, that is chained to the
Now repeat source detection in
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 :command:`detectCoaddSources.py` commands produce
deepCoadd_det datasets in the Butler repository.
Typically these datasets are only used as inputs for the :command:`mergeCoaddDetections.py` command, which you'll run next.
Merging multi-band detection catalogs
Next, use the :command:`mergeCoaddDetections.py` command to combine the individual
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 :command:`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-I coadd patches.
You can accomplish this with :command:`measureCoaddSources.py`:
measureCoaddSources.py DATA --rerun coaddPhot --id filter=HSC-R
And repeat with the
measureCoaddSources.py DATA --rerun coaddPhot --id filter=HSC-I
The :command:`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
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
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 :command:`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
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
forcedPhotCoadd.py DATA --rerun coaddForcedPhot --id filter=HSC-I
The :command:`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.
You can also try the :command:`forcedPhotCcd.py` command to apply forced photometry to individual exposures, which may in principle yield better measurements. :command:`forcedPhotCcd.py` doesn't currently deblend sources, though. Thus forced coadd photometry, as you've performed here, provides the best source photometry.
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 :command:`detectCoaddSources.py`, :command:`mergeCoaddDetections.py`, :command:`measureCoaddDetections.py`, :command:`mergeCoaddMeasurements.py`, and :command:`forcedPhotCoadd.py` command-line tasks.
:doc:`Continue this tutorial series in part 6 <multiband-analysis>` where you will analyze and plot the source catalogs that you've just measured.