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-38703: Add missing bright star feature to subtractBrightStars #815

Merged
merged 2 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions python/lsst/pipe/tasks/extended_psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,11 @@ def readFits(cls, filename):
class StackBrightStarsConfig(Config):
"""Configuration parameters for StackBrightStarsTask."""

subregion_size = ListField(
dtype=int,
subregion_size = ListField[int](
doc="Size, in pixels, of the subregions over which the stacking will be " "iteratively performed.",
default=(100, 100),
)
stacking_statistic = ChoiceField(
dtype=str,
stacking_statistic = ChoiceField[str](
doc="Type of statistic to use for stacking.",
default="MEANCLIP",
allowed={
Expand All @@ -289,28 +287,23 @@ class StackBrightStarsConfig(Config):
"MEANCLIP": "clipped mean",
},
)
num_sigma_clip = Field(
dtype=float,
num_sigma_clip = Field[float](
doc="Sigma for outlier rejection; ignored if stacking_statistic != 'MEANCLIP'.",
default=4,
)
num_iter = Field(
dtype=int,
num_iter = Field[int](
doc="Number of iterations of outlier rejection; ignored if stackingStatistic != 'MEANCLIP'.",
default=3,
)
bad_mask_planes = ListField(
dtype=str,
bad_mask_planes = ListField[str](
doc="Mask planes that define pixels to be excluded from the stacking of the bright star stamps.",
default=("BAD", "CR", "CROSSTALK", "EDGE", "NO_DATA", "SAT", "SUSPECT", "UNMASKEDNAN"),
)
do_mag_cut = Field(
dtype=bool,
do_mag_cut = Field[bool](
doc="Apply magnitude cut before stacking?",
default=False,
)
mag_limit = Field(
dtype=float,
mag_limit = Field[float](
doc="Magnitude limit, in Gaia G; all stars brighter than this value will be stacked",
default=18,
)
Expand All @@ -324,9 +317,10 @@ class StackBrightStarsTask(Task):

def _set_up_stacking(self, example_stamp):
"""Configure stacking statistic and control from config fields."""
stats_control = StatisticsControl()
stats_control.setNumSigmaClip(self.config.num_sigma_clip)
stats_control.setNumIter(self.config.num_iter)
stats_control = StatisticsControl(
numSigmaClip=self.config.num_sigma_clip,
numIter=self.config.num_iter,
)
if bad_masks := self.config.bad_mask_planes:
and_mask = example_stamp.mask.getPlaneBitMask(bad_masks[0])
for bm in bad_masks[1:]:
Expand Down
Loading