doWriteSubtractor = Field[bool](
dtype=bool,
doc="Should an exposure containing all bright star models be written to disk?",
default=True,
)
doWriteSubtractedExposure = Field[bool](
dtype=bool,
doc="Should an exposure with bright stars subtracted be written to disk?",
default=True,
)
magLimit = Field[float](
dtype=float,
doc="Magnitude limit, in Gaia G; all stars brighter than this value will be subtracted",
default=18,
)
warpingKernelName = ChoiceField[str](
dtype=str,
doc="Warping kernel",
default="lanczos5",
allowed={
"bilinear": "bilinear interpolation",
"lanczos3": "Lanczos kernel of order 3",
"lanczos4": "Lanczos kernel of order 4",
"lanczos5": "Lanczos kernel of order 5",
"lanczos6": "Lanczos kernel of order 6",
"lanczos7": "Lanczos kernel of order 7",
},
)
scalingType = ChoiceField[str](
dtype=str,
doc="How the model should be scaled to each bright star; implemented options are "
"`annularFlux` to reuse the annular flux of each stamp, or `leastSquare` to perform "
"least square fitting on each pixel with no bad mask plane set.",
default="leastSquare",
allowed={
"annularFlux": "reuse BrightStarStamp annular flux measurement",
"leastSquare": "find least square scaling factor",
},
)
badMaskPlanes = ListField[str](
dtype=str,
doc="Mask planes that, if set, lead to associated pixels not being included in the computation of "
"the scaling factor (`BAD` should always be included). Ignored if scalingType is `annularFlux`, "
"as the stamps are expected to already be normalized.",
# Note that `BAD` should always be included, as secondary detected
# sources (i.e., detected sources other than the primary source of
# interest) also get set to `BAD`.
default=("BAD", "CR", "CROSSTALK", "EDGE", "NO_DATA", "SAT", "SUSPECT", "UNMASKEDNAN"),
)
doApplySkyCorr = Field[bool](
dtype=bool,
doc="Apply full focal plane sky correction before extracting stars?",
default=True,
)
class SubtractBrightStarsTask(PipelineTask):
ConfigClass = SubtractBrightStarsConfig
_DefaultName = "subtractBrightStars"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Placeholders to set up Statistics if scalingType is leastSquare.
self.statsControl, self.statsFlag = None, None
def _setUpStatistics(self, exampleMask):
if self.config.scalingType == "leastSquare":
self.statsControl = StatisticsControl()
# Set the mask planes which will be ignored.
andMask = reduce(ior, (exampleMask.getPlaneBitMask(bm) for bm in self.config.badMaskPlanes))
self.statsControl.setAndMask(andMask)
self.statsFlag = stringToStatisticsProperty("SUM")
def applySkyCorr(self, calexp, skyCorr):
Definition at line 206 of file subtractBrightStars.py.