33 __all__ = [
"DetectDcrCoaddSources",
"DeblendDcrCoaddSourcesTask",
"MergeDcrDetectionsTask",
34 "MeasureMergedDcrCoaddSourcesTask",
"MergeDcrMeasurementsTask"]
36 """Measure sources and their sub-filter spectrum from a DCR model."""
40 """Task runner for the MergeSourcesTask.
42 Required because the run method requires a list of dataRefs
43 rather than a single dataRef.
48 """Build a hierarchical dictionary of patch references
50 The filter references within the list will have different subfilters.
57 Key word arguments (unused)
62 A reference dictionary of the form {patch: {tract: {filter: {subfilter: dataRef}}}}
67 Thrown when multiple references are provided for the same combination of
68 tract, patch, filter, and subfilter
71 for ref
in parsedCmd.id.refList:
72 tract = ref.dataId[
"tract"]
73 patch = ref.dataId[
"patch"]
74 filter = ref.dataId[
"filter"]
75 subfilter = ref.dataId[
"subfilter"]
76 if tract
not in refDict:
78 if patch
not in refDict[tract]:
79 refDict[tract][patch] = {}
80 if filter
not in refDict[tract][patch]:
81 refDict[tract][patch][filter] = {}
82 if subfilter
in refDict[tract][patch][filter]:
83 raise RuntimeError(
"Multiple versions of %s" % (ref.dataId,))
84 refDict[tract][patch][filter][subfilter] = ref
89 """Provide a list of patch references for each patch, tract, filter combo.
96 Keyword arguments passed to the task
101 List of tuples, where each tuple is a (dataRef, kwargs) pair.
103 refDict = MergeDcrSourcesRunner.buildRefDict(parsedCmd)
104 return [(
list(f.values()), kwargs)
105 for t
in list(refDict.values())
106 for p
in list(t.values())
107 for f
in list(p.values())]
111 """Detect sources on a DCR coadd."""
114 def _makeArgumentParser(cls):
116 parser.add_id_argument(name=
"--id",
117 datasetType=
"dcrCoadd",
118 help=
"data ID, e.g. --id tract=12345 patch=1,2 filter=g, subfilter=0",
119 ContainerClass=ExistingCoaddDataIdContainer)
124 """Task runner for the `MergeSourcesTask`.
126 Required because the run method requires a list of
127 dataRefs rather than a single dataRef.
132 """Provide a list of patch references for each patch, tract, filter combo.
139 Keyword arguments passed to the task
144 List of tuples, where each tuple is a (dataRef, kwargs) pair.
146 refDict = MergeDcrSourcesRunner.buildRefDict(parsedCmd)
147 kwargs[
"psfCache"] = parsedCmd.psfCache
148 return [(
list(f.values()), kwargs)
149 for t
in list(refDict.values())
150 for p
in list(t.values())
151 for f
in list(p.values())]
155 """Deblend the sources in a merged catalog."""
157 RunnerClass = DeblendDcrCoaddSourcesRunner
160 def _makeArgumentParser(cls):
162 parser.add_id_argument(name=
"--id",
163 datasetType=
"dcrCoadd_calexp",
164 help=
"data ID, e.g. --id tract=12345 patch=1,2 filter=g, subfilter=0",
165 ContainerClass=ExistingCoaddDataIdContainer)
166 parser.add_argument(
"--psfCache", type=int, default=100, help=
"Size of CoaddPsf cache")
171 """Merge dcrCoadd detections from multiple subfilters."""
173 RunnerClass = MergeDcrSourcesRunner
176 def _makeArgumentParser(cls):
177 """Create a suitable ArgumentParser.
179 We will use the ArgumentParser to get a provide a list of data
180 references for patches; the RunnerClass will sort them into lists
181 of data references for the same patch
184 parser.add_id_argument(name=
"--id",
185 datasetType=
"dcrCoadd_" + cls.inputDataset,
186 ContainerClass=ExistingCoaddDataIdContainer,
187 help=
"data ID, e.g. --id tract=12345 patch=1,2 filter=g, subfilter=0^1^2")
192 """Deblend sources from master catalog in each coadd seperately and measure."""
195 def _makeArgumentParser(cls):
197 parser.add_id_argument(name=
"--id",
198 datasetType=
"dcrCoadd_calexp",
199 help=
"data ID, e.g. --id tract=12345 patch=1,2 filter=g, subfilter=0",
200 ContainerClass=ExistingCoaddDataIdContainer)
201 parser.add_argument(
"--psfCache", type=int, default=100, help=
"Size of CoaddPsf cache")
206 """Merge measurements from multiple subfilters."""
208 RunnerClass = MergeDcrSourcesRunner
211 def _makeArgumentParser(cls):
212 """Create a suitable ArgumentParser.
214 We will use the ArgumentParser to get a provide a list of data
215 references for patches; the RunnerClass will sort them into lists
216 of data references for the same patch
219 parser.add_id_argument(name=
"--id",
220 datasetType=
"dcrCoadd_" + cls.inputDataset,
221 ContainerClass=ExistingCoaddDataIdContainer,
222 help=
"data ID, e.g. --id tract=12345 patch=1,2 filter=g, subfilter=0^1^2")