-
Notifications
You must be signed in to change notification settings - Fork 18
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-42472: Add minimum valid annulus fraction as a configuration parameter in StackBrightStarsTask #879
DM-42472: Add minimum valid annulus fraction as a configuration parameter in StackBrightStarsTask #879
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,6 +354,11 @@ class StackBrightStarsConfig(Config): | |
doc="Magnitude limit, in Gaia G; all stars brighter than this value will be stacked", | ||
default=18, | ||
) | ||
minValidAnnulusFraction = Field[float]( | ||
doc="Minimum number of valid pixels that must fall within the annulus for the bright star to be " | ||
"included in the generation of a PSF.", | ||
default=0.0, | ||
) | ||
|
||
|
||
class StackBrightStarsTask(Task): | ||
|
@@ -376,6 +381,24 @@ def _set_up_stacking(self, example_stamp): | |
stats_flags = stringToStatisticsProperty(self.config.stacking_statistic) | ||
return stats_control, stats_flags | ||
|
||
def removeInvalidStamps(self, read_stars): | ||
"""Remove stamps that do not have enough valid pixels in the annulus. | ||
|
||
Parameters | ||
---------- | ||
read_stars : `list` of `lsst.pipe.tasks.processBrightStars.BrightStarStamp` | ||
List of bright star stamps to be stacked. | ||
""" | ||
# finding stamps that do not have enough valid pixels in the annulus | ||
inValidStamps = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should just be: |
||
for stamp in read_stars: | ||
if stamp.validAnnulusFraction < self.config.minValidAnnulusFraction: | ||
inValidStamps.append(stamp) | ||
# removing stamps that do not have enough valid pixels in the annulus | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly:
|
||
if len(inValidStamps): | ||
for inValidStamp in inValidStamps: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And lowercase V here also. |
||
read_stars._stamps.remove(inValidStamp) | ||
|
||
def run(self, bss_ref_list, region_name=None): | ||
"""Read input bright star stamps and stack them together. | ||
|
||
|
@@ -424,6 +447,7 @@ def run(self, bss_ref_list, region_name=None): | |
all_stars = None | ||
for bss_ref in bss_ref_list: | ||
read_stars = bss_ref.get(parameters={"bbox": bbox}) | ||
self.removeInvalidStamps(read_stars) | ||
if self.config.do_mag_cut: | ||
read_stars = read_stars.selectByMag(magMax=self.config.mag_limit) | ||
if all_stars: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would re-word this in the imperative, i.e.: