-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create DECam DRP Processing Pipeline
- Loading branch information
1 parent
cf05173
commit 6020f26
Showing
25 changed files
with
1,668 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Set up aperture photometry | ||
# 'config' should be a SourceMeasurementConfig | ||
|
||
# Use a large aperture to be independent of seeing in calibration | ||
config.plugins["base_CircularApertureFlux"].maxSincRadius = 12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os.path | ||
|
||
# Load configs shared between makeWarp and assembleCoadd | ||
config.load(os.path.join(os.path.dirname(__file__), "coaddBase.py")) | ||
|
||
# 200 rows (since patch width is typically < 10k pixels) | ||
config.subregionSize = (10000, 200) | ||
config.removeMaskPlanes.append("CROSSTALK") | ||
config.doNImage = True | ||
config.badMaskPlanes += ["SUSPECT"] | ||
config.doAttachTransmissionCurve = True | ||
# Saturation trails are usually oriented east-west, so along rows | ||
config.interpImage.transpose = True | ||
config.coaddPsf.warpingKernelName = 'lanczos5' | ||
|
||
from lsst.pipe.tasks.selectImages import PsfWcsSelectImagesTask | ||
config.select.retarget(PsfWcsSelectImagesTask) | ||
|
||
# transmission curves do not exist as-yet for DECam data | ||
config.doAttachTransmissionCurve=False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Enable CModel mags (unsetup meas_modelfit to disable) | ||
# 'config' is a SourceMeasurementConfig. | ||
try: | ||
import lsst.meas.modelfit | ||
config.measurement.plugins.names |= ["modelfit_DoubleShapeletPsfApprox", "modelfit_CModel"] | ||
config.measurement.slots.modelFlux = 'modelfit_CModel' | ||
config.catalogCalculation.plugins['base_ClassificationExtendedness'].fluxRatio = 0.985 | ||
except (KeyError, ImportError): | ||
print("Cannot import lsst.meas.modelfit: disabling CModel measurements") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Configs shared between makeWarp and assembleCoadd | ||
config.matchingKernelSize = 29 | ||
config.doApplyExternalPhotoCalib = True | ||
config.externalPhotoCalibName = 'jointcal' | ||
config.doApplyExternalSkyWcs = True | ||
|
||
# When useGlobalExternalPhotoCalib is set to False, use per-tract photometric calibrations. | ||
# Global calibrations must be disabled if using jointcal. | ||
config.useGlobalExternalPhotoCalib = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import os.path | ||
|
||
config.load(os.path.join(os.path.dirname(__file__), "extinctionCoeffs.py")) | ||
from lsst.obs.decam.decamFilters import DECAM_FILTER_DEFINITIONS | ||
config.physicalToBandFilterMap = DECAM_FILTER_DEFINITIONS.physical_to_band |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from lsst.pipe.tasks.colorterms import Colorterm, ColortermDict | ||
|
||
# Average color terms for the DECam filters are calculated using the Pickles stellar spectra atlas. | ||
# The following values are provided by Song Huang (Tsinghua University; dr.guangtou@gmail.com) | ||
# Color terms for u, Y, N419 and N964 bands are not currently available. | ||
|
||
# The values for DECam g, r & z-bands are calculated independently and are different to the values at: | ||
# https://www.legacysurvey.org/dr9/description/ | ||
|
||
# A Jupyter notebook to reproduce these values is available at: | ||
# https://github.com/MerianSurvey/caterpillar/blob/main/notebook/photocal/merian_filter_color_terms.ipynb | ||
|
||
# In obs_subaru, colorterms.py is also used in: | ||
# - config/skyAnalysis.py | ||
# - config/compareCoaddAnalysis.py | ||
# - config/coaddAnalysis.py | ||
# - config/visitAnalysis.py | ||
# - config/fgcmBuildStarsTable.py and config/fgcmBuildStars.py | ||
# These files are not currently available for obs_decam. | ||
|
||
config.data = { | ||
"decam*": ColortermDict(data={ | ||
'g DECam SDSS c0001 4720.0 1520.0': Colorterm(primary="g", secondary="g"), | ||
'r DECam SDSS c0002 6415.0 1480.0': Colorterm(primary="r", secondary="r"), | ||
'i DECam SDSS c0003 7835.0 1470.0': Colorterm(primary="i", secondary="i"), | ||
'z DECam SDSS c0004 9260.0 1520.0': Colorterm(primary="z", secondary="z"), | ||
}), | ||
"sdss*": ColortermDict(data={ | ||
'g DECam SDSS c0001 4720.0 1520.0': Colorterm(primary="g", secondary="r", c0=-0.008015, c1=-0.089869, c2=-0.018398), # For -1.0 < g-r < 1.8 | ||
'r DECam SDSS c0002 6415.0 1480.0': Colorterm(primary="r", secondary="i", c0=-0.0077434, c1=-0.202615, c2=0.016042), # For -1.0 < r-i < 2.2 | ||
'i DECam SDSS c0003 7835.0 1470.0': Colorterm(primary="i", secondary="z", c0=0.00018887, c1=-0.2748281, c2=-0.029417), # For -1.0 < i-z < 1.2 | ||
'z DECam SDSS c0004 9260.0 1520.0': Colorterm(primary="z", secondary="i", c0=-0.0059858, c1=0.1131192, c2=0.0156471), # For -1.0 < z-i < 0.5 | ||
'N540 DECam c0014 5403.2 210.0': Colorterm(primary="g", secondary="r", c0=-0.03359776, c1=-0.57665033, c2=-0.01510509), # For -1.0 < g-r < 1.5 | ||
'N708 DECam c0012 7080.0 400.0': Colorterm(primary="r", secondary="i", c0=-0.01428724, c1=-0.71755905, c2=0.08959316), # For -1.0 < r-i < 2.0 | ||
}), | ||
"hsc*": ColortermDict(data={ | ||
'g DECam SDSS c0001 4720.0 1520.0': Colorterm(primary="g", secondary="r", c0=0.0000509, c1=-0.0152487, c2=-0.0029937), # For -1.0 < g-r < 1.4 | ||
'r DECam SDSS c0002 6415.0 1480.0': Colorterm(primary="r", secondary="i", c0=-0.0078995, c1=-0.1695323, c2=0.0251978), # For -1.0 < r-i < 2.2 | ||
'i DECam SDSS c0003 7835.0 1470.0': Colorterm(primary="i", secondary="z", c0=0.0010196, c1=-0.1314031, c2=0.0054605), # For -1.0 < i-z < 1.0 | ||
'z DECam SDSS c0004 9260.0 1520.0': Colorterm(primary="z", secondary="y", c0=-0.0013244, c1=-0.2846684, c2=-0.1229817), # For -1.0 < z-y < 0.5 | ||
'N540 DECam c0014 5403.2 210.0': Colorterm(primary="g", secondary="r", c0=-0.03015158, c1=-0.53715834, c2=-0.00202415), # For -1.0 < g-r < 1.5 | ||
'N708 DECam c0012 7080.0 400.0': Colorterm(primary="r", secondary="i", c0=-0.01978413, c1=-0.64368838, c2=0.09132738), # For -1.0 < r-i < 2.0 | ||
}), | ||
"ps1*": ColortermDict(data={ | ||
'g DECam SDSS c0001 4720.0 1520.0': Colorterm(primary="g", secondary="r", c0=0.006388, c1=0.045875, c2=-0.004484), # For -1.0 < g-r < 1.2 | ||
'r DECam SDSS c0002 6415.0 1480.0': Colorterm(primary="r", secondary="i", c0=-0.006775, c1=-0.187304, c2=0.018928), # For -1.0 < r-i < 2.2 | ||
'i DECam SDSS c0003 7835.0 1470.0': Colorterm(primary="i", secondary="z", c0=0.0012204, c1=-0.282956, c2=-0.011321), # For -1.0 < i-z < 1.4 | ||
'z DECam SDSS c0004 9260.0 1520.0': Colorterm(primary="z", secondary="y", c0=-0.0087868, c1=-0.5204795, c2=-0.057955), # For -1.0 < z-y < 1.0 | ||
'N540 DECam c0014 5403.2 210.0': Colorterm(primary="g", secondary="r", c0=-0.02635164, c1=-0.50968428, c2=-0.00958104), # For -1.0 < g-r < 1.5 | ||
'N708 DECam c0012 7080.0 400.0': Colorterm(primary="r", secondary="i", c0=-0.01508987, c1=-0.69377675, c2=0.09079348), # For -1.0 < r-i < 2.0 | ||
}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os.path | ||
|
||
# Load configs from base assembleCoadd | ||
config.load(os.path.join(os.path.dirname(__file__), "assembleCoadd.py")) | ||
|
||
# 200 rows (since patch width is typically < 10k pixels | ||
config.assembleStaticSkyModel.subregionSize = (10000, 200) | ||
config.assembleStaticSkyModel.doApplyExternalPhotoCalib = True | ||
config.assembleStaticSkyModel.externalPhotoCalibName = 'jointcal' | ||
config.assembleStaticSkyModel.doApplyExternalSkyWcs = True | ||
config.doFilterMorphological = True | ||
|
||
# When useGlobalExternalPhotoCalib is set to False, use per-tract photometric calibrations. | ||
# Global calibrations must be disabled if using jointcal. | ||
config.assembleStaticSkyModel.useGlobalExternalPhotoCalib = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Enable measurement of convolved fluxes | ||
# 'config' is a SourceMeasurementConfig | ||
try: | ||
import lsst.meas.extensions.convolved # noqa: Load flux.convolved algorithm | ||
except ImportError as exc: | ||
print("Cannot import lsst.meas.extensions.convolved (%s): disabling convolved flux measurements" % (exc,)) | ||
else: | ||
config.plugins.names.add("ext_convolved_ConvolvedFlux") | ||
config.plugins["ext_convolved_ConvolvedFlux"].seeing.append(8.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Extinction coefficients for DECam filters for conversion from E(B-V) to extinction, A_filter. | ||
# Numbers initially provided by Song Huang (NAOJ). | ||
# | ||
# Band, A_filter/E(B-V) | ||
# Values for N419 and N964 filters are not currently available. | ||
config.extinctionCoeffs = { | ||
"u": 3.994, | ||
"g": 3.212, | ||
"r": 2.164, | ||
"i": 1.591, | ||
"z": 1.211, | ||
"y": 1.063, | ||
"N540": 2.753, | ||
"N708": 1.847, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Mapping of camera filter name: reference catalog filter name; each reference filter must exist in the refcat. | ||
# Note that this does not perform any bandpass corrections: it is just a lookup. | ||
for source, target in [ | ||
('N419', 'g'), | ||
('N540', 'g'), | ||
('N708', 'i'), | ||
('N964', 'y'), | ||
]: | ||
config.filterMap[source] = target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os.path | ||
|
||
from lsst.meas.base import CircularApertureFluxAlgorithm | ||
|
||
config.measurement.load(os.path.join(os.path.dirname(__file__), "apertures.py")) | ||
config.measurement.load(os.path.join(os.path.dirname(__file__), "kron.py")) | ||
config.measurement.load(os.path.join(os.path.dirname(__file__), "convolvedFluxes.py")) | ||
config.measurement.load(os.path.join(os.path.dirname(__file__), "gaap.py")) | ||
config.load(os.path.join(os.path.dirname(__file__), "cmodel.py")) | ||
|
||
config.catalogCalculation.plugins.names = ["base_ClassificationExtendedness"] | ||
config.measurement.slots.psfFlux = "base_PsfFlux" | ||
|
||
def doUndeblended(config, algName, fluxList=None): | ||
"""Activate undeblended measurements of algorithm | ||
Parameters | ||
---------- | ||
algName : `str` | ||
Algorithm name. | ||
fluxList : `list` of `str`, or `None` | ||
List of flux columns to register for aperture correction. If `None`, | ||
then this will be the `algName` appended with `_instFlux`. | ||
""" | ||
if algName not in config.measurement.plugins: | ||
return | ||
if fluxList is None: | ||
fluxList = [algName + "_instFlux"] | ||
config.measurement.undeblended.names.add(algName) | ||
config.measurement.undeblended[algName] = config.measurement.plugins[algName] | ||
for flux in fluxList: | ||
config.applyApCorr.proxies["undeblended_" + flux] = flux | ||
|
||
|
||
doUndeblended(config, "base_PsfFlux") | ||
doUndeblended(config, "ext_photometryKron_KronFlux") | ||
doUndeblended(config, "base_CircularApertureFlux", []) # No aperture correction for circular apertures | ||
doUndeblended(config, "ext_convolved_ConvolvedFlux", | ||
config.measurement.plugins["ext_convolved_ConvolvedFlux"].getAllResultNames()) | ||
doUndeblended(config, "ext_gaap_GaapFlux", | ||
config.measurement.plugins["ext_gaap_GaapFlux"].getAllGaapResultNames()) | ||
# Disable registration for apCorr of undeblended convolved; apCorr will be done through the deblended proxy | ||
config.measurement.undeblended["ext_convolved_ConvolvedFlux"].registerForApCorr = False | ||
config.measurement.undeblended["ext_gaap_GaapFlux"].registerForApCorr = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Enable GAaP (Gaussian Aperture and PSF) colors | ||
# 'config' is typically a SourceMeasurementConfig | ||
try: | ||
import lsst.meas.extensions.gaap # noqa | ||
config.plugins.names.add("ext_gaap_GaapFlux") | ||
config.plugins["ext_gaap_GaapFlux"].sigmas = [0.5, 0.7, 1.0, 1.5, 2.5, 3.0] | ||
# Enable PSF photometry after PSF-Gaussianization in the `ext_gaap_GaapFlux` plugin | ||
config.plugins["ext_gaap_GaapFlux"].doPsfPhotometry = True | ||
except ImportError as exc: | ||
print("Cannot import lsst.meas.extensions.gaap (%s): disabling GAaP flux measurements" % (exc,)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os.path | ||
|
||
# `load()` appends to the filterMaps: we need them to be empty, so that | ||
# only the specified filter mappings are used. | ||
config.photometryRefObjLoader.filterMap = {} | ||
filterMapFile = os.path.join(os.path.dirname(__file__), "filterMap.py") | ||
config.photometryRefObjLoader.load(filterMapFile) | ||
# We have PS1 colorterms | ||
config.applyColorTerms = True | ||
config.colorterms.load(os.path.join(os.path.dirname(__file__), "colorterms.py")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Enable Kron mags | ||
# 'config' is a SourceMeasurementConfig | ||
|
||
try: | ||
import lsst.meas.extensions.photometryKron | ||
config.plugins.names |= ["ext_photometryKron_KronFlux"] | ||
except ImportError: | ||
print("Cannot import lsst.meas.extensions.photometryKron: disabling Kron measurements") |
Oops, something went wrong.