raColName = pexConfig.Field(
doc="RA column name used in the fake source catalog.",
dtype=str,
default="raJ2000",
)
decColName = pexConfig.Field(
doc="Dec. column name used in the fake source catalog.",
dtype=str,
default="decJ2000",
)
doCleanCat = pexConfig.Field(
doc="If true removes bad sources from the catalog.",
dtype=bool,
default=True,
)
diskHLR = pexConfig.Field(
doc="Column name for the disk half light radius used in the fake source catalog.",
dtype=str,
default="DiskHalfLightRadius",
)
bulgeHLR = pexConfig.Field(
doc="Column name for the bulge half light radius used in the fake source catalog.",
dtype=str,
default="BulgeHalfLightRadius",
)
magVar = pexConfig.Field(
doc="The column name for the magnitude calculated taking variability into account. In the format "
"``filter name``magVar, e.g. imagVar for the magnitude in the i band.",
dtype=str,
default="%smagVar",
)
nDisk = pexConfig.Field(
doc="The column name for the sersic index of the disk component used in the fake source catalog.",
dtype=str,
default="disk_n",
)
nBulge = pexConfig.Field(
doc="The column name for the sersic index of the bulge component used in the fake source catalog.",
dtype=str,
default="bulge_n",
)
aDisk = pexConfig.Field(
doc="The column name for the semi major axis length of the disk component used in the fake source"
"catalog.",
dtype=str,
default="a_d",
)
aBulge = pexConfig.Field(
doc="The column name for the semi major axis length of the bulge component.",
dtype=str,
default="a_b",
)
bDisk = pexConfig.Field(
doc="The column name for the semi minor axis length of the disk component.",
dtype=str,
default="b_d",
)
bBulge = pexConfig.Field(
doc="The column name for the semi minor axis length of the bulge component used in the fake source "
"catalog.",
dtype=str,
default="b_b",
)
paDisk = pexConfig.Field(
doc="The column name for the PA of the disk component used in the fake source catalog.",
dtype=str,
default="pa_disk",
)
paBulge = pexConfig.Field(
doc="The column name for the PA of the bulge component used in the fake source catalog.",
dtype=str,
default="pa_bulge",
)
sourceType = pexConfig.Field(
doc="The column name for the source type used in the fake source catalog.",
dtype=str,
default="sourceType",
)
fakeType = pexConfig.Field(
doc="What type of fake catalog to use, snapshot (includes variability in the magnitudes calculated "
"from the MJD of the image), static (no variability) or filename for a user defined fits"
"catalog.",
dtype=str,
default="static",
)
calibFluxRadius = pexConfig.Field(
doc="Aperture radius (in pixels) that was used to define the calibration for this image+catalog. "
"This will be used to produce the correct instrumental fluxes within the radius. "
"This value should match that of the field defined in slot_CalibFlux_instFlux.",
dtype=float,
default=12.0,
)
coaddName = pexConfig.Field(
doc="The name of the type of coadd used",
dtype=str,
default="deep",
)
class InsertFakesTask(PipelineTask, CmdLineTask):
_DefaultName = "insertFakes"
ConfigClass = InsertFakesConfig
def runDataRef(self, dataRef):
# To do: should it warn when asked to insert variable sources into the coadd
if self.config.fakeType == "static":
fakeCat = dataRef.get("deepCoadd_fakeSourceCat").toDataFrame()
# To do: DM-16254, the read and write of the fake catalogs will be changed once the new pipeline
# task structure for ref cats is in place.
self.fakeSourceCatType = "deepCoadd_fakeSourceCat"
else:
fakeCat = Table.read(self.config.fakeType).to_pandas()
coadd = dataRef.get("deepCoadd")
wcs = coadd.getWcs()
photoCalib = coadd.getPhotoCalib()
imageWithFakes = self.run(fakeCat, coadd, wcs, photoCalib)
dataRef.put(imageWithFakes.imageWithFakes, "fakes_deepCoadd")
def runQuantum(self, butlerQC, inputRefs, outputRefs):
inputs = butlerQC.get(inputRefs)
inputs["wcs"] = inputs["image"].getWcs()
inputs["photoCalib"] = inputs["image"].getPhotoCalib()
outputs = self.run(**inputs)
butlerQC.put(outputs, outputRefs)
@classmethod
def _makeArgumentParser(cls):
parser = pipeBase.ArgumentParser(name=cls._DefaultName)
parser.add_id_argument(name="--id", datasetType="deepCoadd",
help="data IDs for the deepCoadd, e.g. --id tract=12345 patch=1,2 filter=r",
ContainerClass=ExistingCoaddDataIdContainer)
return parser
def run(self, fakeCat, image, wcs, photoCalib):
Definition at line 288 of file insertFakes.py.