exposureIdInfo = dataRef.get("expIdInfo")
if self.config.insertFakes.fakeType == "snapshot":
fakeCat = dataRef.get("fakeSourceCat").toDataFrame()
elif self.config.insertFakes.fakeType == "static":
fakeCat = dataRef.get("deepCoadd_fakeSourceCat").toDataFrame()
else:
fakeCat = Table.read(self.config.insertFakes.fakeType).to_pandas()
calexp = dataRef.get("calexp")
if self.config.doApplyExternalSkyWcs:
self.log.info("Using external wcs from " + self.config.externalSkyWcsName)
wcs = dataRef.get(self.config.externalSkyWcsName + "_wcs")
else:
wcs = calexp.getWcs()
if self.config.doApplyExternalPhotoCalib:
self.log.info("Using external photocalib from " + self.config.externalPhotoCalibName)
photoCalib = dataRef.get(self.config.externalPhotoCalibName + "_photoCalib")
else:
photoCalib = calexp.getPhotoCalib()
icSourceCat = dataRef.get("icSrc", immediate=True)
sfdSourceCat = dataRef.get("src", immediate=True)
resultStruct = self.run(fakeCat, calexp, wcs=wcs, photoCalib=photoCalib,
exposureIdInfo=exposureIdInfo, icSourceCat=icSourceCat,
sfdSourceCat=sfdSourceCat)
dataRef.put(resultStruct.outputExposure, "fakes_calexp")
dataRef.put(resultStruct.outputCat, "fakes_src")
return resultStruct
def runQuantum(self, butlerQC, inputRefs, outputRefs):
inputs = butlerQC.get(inputRefs)
if 'exposureIdInfo' not in inputs.keys():
expId, expBits = butlerQC.quantum.dataId.pack("visit_detector", returnMaxBits=True)
inputs['exposureIdInfo'] = ExposureIdInfo(expId, expBits)
if not self.config.doApplyExternalSkyWcs:
inputs["wcs"] = inputs["exposure"].getWcs()
if not self.config.doApplyExternalPhotoCalib:
inputs["photoCalib"] = inputs["exposure"].getPhotoCalib()
outputs = self.run(**inputs)
butlerQC.put(outputs, outputRefs)
@classmethod
def _makeArgumentParser(cls):
parser = pipeBase.ArgumentParser(name=cls._DefaultName)
parser.add_id_argument("--id", "fakes_calexp", help="data ID with raw CCD keys [+ tract optionally], "
"e.g. --id visit=12345 ccd=1,2 [tract=0]",
ContainerClass=PerTractCcdDataIdContainer)
return parser
def run(self, fakeCat, exposure, wcs=None, photoCalib=None, exposureIdInfo=None, icSourceCat=None,
sfdSourceCat=None):
Definition at line 345 of file processCcdWithFakes.py.