Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-38667: Change BSS stamp inclusion to use annulus percent #786

Merged
merged 1 commit into from
May 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 13 additions & 10 deletions python/lsst/pipe/tasks/processBrightStars.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ProcessBrightStarsConfig(PipelineTaskConfig, pipelineConnections=ProcessBr
annularFluxRadii = ListField(
dtype=int,
doc="Inner and outer radii of the annulus used to compute AnnularFlux for normalization, in pixels.",
default=(40, 50),
default=(70, 80),
)
annularFluxStatistic = ChoiceField(
dtype=str,
Expand All @@ -154,13 +154,11 @@ class ProcessBrightStarsConfig(PipelineTaskConfig, pipelineConnections=ProcessBr
doc="Mask planes that identify pixels to not include in the computation of the annular flux.",
default=("BAD", "CR", "CROSSTALK", "EDGE", "NO_DATA", "SAT", "SUSPECT", "UNMASKEDNAN"),
)
minPixelsWithinFrame = Field(
dtype=int,
doc=(
"Minimum number of pixels that must fall within the stamp boundary for the bright star to be "
"saved when its center is beyond the exposure boundary."
),
default=50,
minValidAnnulusFraction = Field(
dtype=float,
doc="Minumum number of valid pixels that must fall within the annulus for the bright star to be "
"saved for subsequent generation of a PSF.",
default=0.0,
)
doApplySkyCorr = Field(
dtype=bool,
Expand Down Expand Up @@ -286,10 +284,14 @@ def extractStamps(self, inputExposure, refObjLoader=None):
# select stars within, or close enough to input exposure from refcat
inputIm = inputExposure.maskedImage
inputExpBBox = inputExposure.getBBox()
dilatationExtent = Extent2I(np.array(self.config.stampSize) - self.config.minPixelsWithinFrame)
# Attempt to include stars that are outside of the exposure but their
# stamps overlap with the exposure.
dilatationExtent = Extent2I(np.array(self.config.stampSize) // 2)
# TODO (DM-25894): handle catalog with stars missing from Gaia
withinCalexp = refObjLoader.loadPixelBox(
inputExpBBox.dilatedBy(dilatationExtent), wcs, filterName="phot_g_mean"
inputExpBBox.dilatedBy(dilatationExtent),
wcs,
filterName="phot_g_mean",
)
refCat = withinCalexp.refCat
# keep bright objects
Expand Down Expand Up @@ -501,6 +503,7 @@ def run(self, inputExposure, refObjLoader=None, dataId=None, skyCorr=None):
position=xy0s[j],
gaiaGMag=extractedStamps.GMags[j],
gaiaId=extractedStamps.gaiaIds[j],
minValidAnnulusFraction=self.config.minValidAnnulusFraction,
)
for j, (warp, transform) in enumerate(zip(warpedStars, warpOutputs.warpTransforms))
]
Expand Down