From 9a2307632c031632b48e922df2264babc61a4472 Mon Sep 17 00:00:00 2001 From: dr-guangtou Date: Wed, 15 Sep 2021 10:49:20 -0400 Subject: [PATCH 1/5] Register the new N419 and N540 filters --- config/calibrate.py | 3 +++ config/characterizeImage.py | 3 +++ config/measureCoaddSources.py | 3 +++ python/lsst/obs/decam/decamFilters.py | 6 ++++++ 4 files changed, 15 insertions(+) diff --git a/config/calibrate.py b/config/calibrate.py index 6a7eb24e..c1833486 100644 --- a/config/calibrate.py +++ b/config/calibrate.py @@ -13,7 +13,10 @@ # Note the u-band results may not be useful without a color term refObjLoader.filterMap['u'] = 'g' refObjLoader.filterMap['Y'] = 'y' + refObjLoader.filterMap['N419'] = 'g' + refObjLoader.filterMap['N540'] = 'g' refObjLoader.filterMap['N708'] = 'i' + refObjLoader.filterMap['N964'] = 'z' # This sets up the reference catalog for Gen3. config.connections.astromRefCat = "ps1_pv3_3pi_20170110" diff --git a/config/characterizeImage.py b/config/characterizeImage.py index 85823849..c14a44a8 100644 --- a/config/characterizeImage.py +++ b/config/characterizeImage.py @@ -10,4 +10,7 @@ # Note the u-band results may not be useful without a color term config.refObjLoader.filterMap['u'] = 'g' config.refObjLoader.filterMap['Y'] = 'y' +config.refObjLoader.filterMap['N419'] = 'g' +config.refObjLoader.filterMap['N540'] = 'g' config.refObjLoader.filterMap['N708'] = 'i' +config.refObjLoader.filterMap['N964'] = 'z' diff --git a/config/measureCoaddSources.py b/config/measureCoaddSources.py index 2c448cc2..c15f6583 100644 --- a/config/measureCoaddSources.py +++ b/config/measureCoaddSources.py @@ -1,5 +1,8 @@ config.match.refObjLoader.ref_dataset_name = "ps1_pv3_3pi_20170110" config.match.refObjLoader.filterMap['u'] = 'g' config.match.refObjLoader.filterMap['Y'] = 'y' +config.match.refObjLoader.filterMap['N419'] = 'g' +config.match.refObjLoader.filterMap['N540'] = 'g' config.match.refObjLoader.filterMap['N708'] = 'i' +config.match.refObjLoader.filterMap['N964'] = 'z' config.connections.refCat = "ps1_pv3_3pi_20170110" diff --git a/python/lsst/obs/decam/decamFilters.py b/python/lsst/obs/decam/decamFilters.py index 1b820808..6a192220 100644 --- a/python/lsst/obs/decam/decamFilters.py +++ b/python/lsst/obs/decam/decamFilters.py @@ -57,4 +57,10 @@ FilterDefinition(physical_filter="N708 DECam c0012 7080.0 400.0", band="N708", lambdaEff=708), + FilterDefinition(physical_filter="N540 DECam c0014 5403.2 210.0", + band="N540", + lambdaEff=540), + FilterDefinition(physical_filter="N419 DECam c0013 4194.0 75.0", + band="N419", + lambdaEff=419), ) From f425d1c9a1433f6d46942c5f3ef19d1622c51a0f Mon Sep 17 00:00:00 2001 From: dr-guangtou Date: Sun, 31 Oct 2021 17:31:44 -0400 Subject: [PATCH 2/5] Add color terms and extinction coefficients for the DECam filters --- config/colorterms.py | 40 ++++++++++++++++++++++++++++++++++++++ config/extinctionCoeffs.py | 15 ++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 config/colorterms.py create mode 100644 config/extinctionCoeffs.py diff --git a/config/colorterms.py b/config/colorterms.py new file mode 100644 index 00000000..0cf60128 --- /dev/null +++ b/config/colorterms.py @@ -0,0 +1,40 @@ +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, N964, and N419 bands are not available now. + +# The values for DECam g, r, & z-band are calculated independently and are different with the values from: https://www.legacysurvey.org/dr9/description/ + +config.data = { + "decam*": ColortermDict(data={ + 'g': Colorterm(primary="g", secondary="g"), + 'r': Colorterm(primary="r", secondary="r"), + 'i': Colorterm(primary="i", secondary="i"), + 'z': Colorterm(primary="z", secondary="z"), + }), + "sdss*": ColortermDict(data={ + 'g': Colorterm(primary="g", secondary="r", c0=-0.008015, c1=-0.089869, c2=-0.018398), # For -1.0 < g-r < 1.8 + 'r': Colorterm(primary="r", secondary="i", c0=-0.0077434, c1=-0.202615, c2=0.016042), # For -1.0 < r-i < 2.2 + 'i': Colorterm(primary="i", secondary="z", c0=0.00018887, c1=-0.2748281, c2=-0.029417), # For -1.0 < i-z < 1.2 + 'z': Colorterm(primary="z", secondary="i", c0=-0.0059858, c1=0.1131192, c2=0.0156471), # For -1.0 < z-i < 0.5 + 'N708': Colorterm(primary="r", secondary="i", c0=-0.01428724, c1=-0.71755905, c2=0.08959316), # For -1.0 < r-i < 2.0 + 'N540': Colorterm(primary="g", secondary="r", c0=-0.03359776, c1=-0.57665033, c2=-0.01510509), # For -1.0 < g-r < 1.5 + }), + "hsc*": ColortermDict(data={ + 'g': Colorterm(primary="g", secondary="r", c0=0.0000509, c1=-0.0152487, c2=-0.0029937), # For -1.0 < g-r < 1.4 + 'r': Colorterm(primary="r", secondary="i", c0=-0.0078995, c1=-0.1695323, c2=0.0251978), # For -1.0 < r-i < 2.2 + 'i': Colorterm(primary="i", secondary="z", c0=0.0010196, c1=-0.1314031, c2=0.0054605), # For -1.0 < i-z < 1.0 + 'z': Colorterm(primary="z", secondary="y", c0=-0.0013244, c1=-0.2846684, c2=-0.1229817), # For -1.0 < z-y < 0.5 + 'N708': Colorterm(primary="r", secondary="i", c0=-0.01978413, c1=-0.64368838, c2=0.09132738), # For -1.0 < r-i < 2.0 + 'N540': Colorterm(primary="g", secondary="r", c0=-0.03015158, c1=-0.53715834, c2=-0.00202415), # For -1.0 < g-r < 1.5 + }), + "ps1*": ColortermDict(data={ + 'g': Colorterm(primary="g", secondary="r", c0=0.006388, c1=0.045875, c2=-0.004484), # For -1.0 < g-r < 1.2 + 'r': Colorterm(primary="r", secondary="i", c0=-0.006775, c1=-0.187304, c2=0.018928), # For -1.0 < r-i < 2.2 + 'i': Colorterm(primary="i", secondary="z", c0=0.0012204, c1=-0.282956, c2=-0.011321), # For -1.0 < i-z < 1.4 + 'z': Colorterm(primary="z", secondary="y", c0=-0.0087868, c1=-0.5204795, c2=-0.057955), # For -1.0 < z-y < 1.0 + 'N708': Colorterm(primary="r", secondary="i", c0=-0.01508987, c1=-0.69377675, c2=0.09079348), # For -1.0 < r-i < 2.0 + 'N540': Colorterm(primary="g", secondary="r", c0=-0.02635164, c1=-0.50968428, c2=-0.00958104), # For -1.0 < g-r < 1.5 + }), +} \ No newline at end of file diff --git a/config/extinctionCoeffs.py b/config/extinctionCoeffs.py new file mode 100644 index 00000000..8fbb6465 --- /dev/null +++ b/config/extinctionCoeffs.py @@ -0,0 +1,15 @@ +# Extinction coefficients for DECam filters for conversion from E(B-V) to extinction, A_filter. +# Numbers provided by Song Huang (NAOJ). +# +# Band, A_filter/E(B-V) +# Values for N964 and N149 filters are not available at this point. +config.extinctionCoeffs = { + "u": 3.994, + "g": 3.212, + "r": 2.164, + "i": 1.591, + "z": 1.211, + "y": 1.063, + "N708": 1.847, + "N540": 2.753 +} \ No newline at end of file From 7b02705eb2d94e8cc6577ccaed7761a6ed38299d Mon Sep 17 00:00:00 2001 From: dr-guangtou Date: Sun, 31 Oct 2021 21:46:33 -0400 Subject: [PATCH 3/5] Adjust the calibrate.py to turn-on color-terms --- config/calibrate.py | 12 ++++++++++++ config/colorAnalysis.py | 6 ++++++ config/colorterms.py | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 config/colorAnalysis.py diff --git a/config/calibrate.py b/config/calibrate.py index c1833486..cf4cfbfd 100644 --- a/config/calibrate.py +++ b/config/calibrate.py @@ -30,4 +30,16 @@ # See Slack: https://lsstc.slack.com/archives/C2B6X08LS/p1586468459084600 config.astrometry.wcsFitter.order = 4 +# Photometric calibration: use color terms +config.photoCal.applyColorTerms = True +colors = config.photoCal.match.referenceSelection.colorLimits +# The following two color limits are adopted from obs_subaru for HSC SSP survey. +colors["g-r"] = ColorLimit(primary="g_flux", secondary="r_flux", minimum=0.0) +colors["r-i"] = ColorLimit(primary="r_flux", secondary="i_flux", maximum=0.5) +# The following magnitude limit is also adopted from obs_subaru for HSC SSP survey. +config.photoCal.match.referenceSelection.doMagLimit = True +config.photoCal.match.referenceSelection.magLimit.fluxField = "i_flux" +config.photoCal.match.referenceSelection.magLimit.maximum = 22.0 +config.photoCal.colorterms.load(os.path.join(obsConfigDir, 'colorterms.py')) + config.measurement.load(os.path.join(obsConfigDir, "hsm.py")) diff --git a/config/colorAnalysis.py b/config/colorAnalysis.py new file mode 100644 index 00000000..53fcd3d0 --- /dev/null +++ b/config/colorAnalysis.py @@ -0,0 +1,6 @@ +import os.path + +config.load(os.path.join(os.path.dirname(__file__), "srcSchemaMap.py")) +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 \ No newline at end of file diff --git a/config/colorterms.py b/config/colorterms.py index 0cf60128..e5d608ba 100644 --- a/config/colorterms.py +++ b/config/colorterms.py @@ -5,6 +5,8 @@ # Color terms for u, Y, N964, and N419 bands are not available now. # The values for DECam g, r, & z-band are calculated independently and are different with the values from: https://www.legacysurvey.org/dr9/description/ +# A Jupyter notebook is available at https://github.com/MerianSurvey/caterpillar/blob/main/notebook/photocal/merian_filter_color_terms.ipynb +# to reproduce these values. config.data = { "decam*": ColortermDict(data={ From 39c08e8113956bd0b98d29bff20804951d55fd0a Mon Sep 17 00:00:00 2001 From: dr-guangtou Date: Sun, 31 Oct 2021 21:57:30 -0400 Subject: [PATCH 4/5] Explain the missing files that use colorterms.py in obs_subaru --- config/colorterms.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/colorterms.py b/config/colorterms.py index e5d608ba..0dea1e79 100644 --- a/config/colorterms.py +++ b/config/colorterms.py @@ -8,6 +8,15 @@ # A Jupyter notebook is available at https://github.com/MerianSurvey/caterpillar/blob/main/notebook/photocal/merian_filter_color_terms.ipynb # to reproduce these values. +# In obs_subaru, colorterms.py is also used in: +# - config/jointcal.py +# - config/skyAnalysis.py +# - config/compareCoaddAnalysis.py +# - config/coaddAnalysis.py +# - config/visitAnalysis.py +# - config/fgcmBuildStarsTable.py and config/fgcmBuildStars.py +# These files are not available for obs_decam yet. + config.data = { "decam*": ColortermDict(data={ 'g': Colorterm(primary="g", secondary="g"), From 31b3fca6b26e05e6dbc6e0fff7c4a6e7027b7e9d Mon Sep 17 00:00:00 2001 From: dr-guangtou Date: Sun, 31 Oct 2021 22:00:16 -0400 Subject: [PATCH 5/5] Remove the srcSchema.py line --- config/colorAnalysis.py | 1 - 1 file changed, 1 deletion(-) diff --git a/config/colorAnalysis.py b/config/colorAnalysis.py index 53fcd3d0..028f5a09 100644 --- a/config/colorAnalysis.py +++ b/config/colorAnalysis.py @@ -1,6 +1,5 @@ import os.path -config.load(os.path.join(os.path.dirname(__file__), "srcSchemaMap.py")) 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 \ No newline at end of file