-
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-35207: use updated visit summaries in downstream tasks #741
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1cc6599
Remove Gen2 doc section and empty section headers.
TallJimbo f2fe093
Add initOutput schema to ConsolidateVisitSummary.
TallJimbo 4ac6ac8
Use finalVisitSummary instead of visitSummary in downstream tasks.
TallJimbo 4664404
Stop using calexpType for datasets no longer in fakes pipeline.
TallJimbo 8efb6c8
Use finalVisitSummary to provide PSFs and aperture corrections.
TallJimbo 0a2a25d
Use finalVisitSummary to provide PhotoCalibs.
TallJimbo 586c0d3
Use finalVisitSummary to provide SkyWcs objects.
TallJimbo a0e5091
Use slot shapes in ComputeExposureSummaryStats by default.
TallJimbo 0a6f6fd
Restore ComputeSummaryStats compatibility with astropy table inputs.
TallJimbo ba01324
Remove good-for-tests, bad-for-production logic in summary stats.
TallJimbo 19b21e7
Be more defensive against NaNs in PsfWcsSelectImages checks.
TallJimbo c66ba93
Disable ComputeSummaryStats in ProcessCcdWithFakes.
TallJimbo File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,12 +62,12 @@ class ComputeExposureSummaryStatsConfig(pexConfig.Config): | |
starShape = pexConfig.Field( | ||
doc="Base name of columns to use for the source shape in the PSF statistics computation.", | ||
dtype=str, | ||
default="base_SdssShape" | ||
default="slot_Shape" | ||
) | ||
psfShape = pexConfig.Field( | ||
doc="Base name of columns to use for the PSF shape in the PSF statistics computation.", | ||
dtype=str, | ||
default="base_SdssShape_psf" | ||
default="slot_PsfShape" | ||
) | ||
psfSampling = pexConfig.Field( | ||
dtype=int, | ||
|
@@ -171,7 +171,7 @@ def run(self, exposure, sources, background): | |
|
||
return summary | ||
|
||
def update_psf_stats(self, summary, psf, bbox, sources=None, image_mask=None, sources_columns=None): | ||
def update_psf_stats(self, summary, psf, bbox, sources=None, image_mask=None, sources_is_astropy=False): | ||
"""Compute all summary-statistic fields that depend on the PSF model. | ||
|
||
Parameters | ||
|
@@ -184,17 +184,18 @@ def update_psf_stats(self, summary, psf, bbox, sources=None, image_mask=None, so | |
bbox : `lsst.geom.Box2I` | ||
Bounding box of the image for which summary stats are being | ||
computed. | ||
sources : `lsst.afw.table.SourceCatalog`, optional | ||
sources : `lsst.afw.table.SourceCatalog` or `astropy.table.Table` | ||
Catalog for quantities that are computed from source table columns. | ||
If `None`, these quantities will be reset (generally to NaN). | ||
The type of this table must correspond to the | ||
``sources_is_astropy`` argument. | ||
image_mask : `lsst.afw.image.Mask`, optional | ||
Mask image that may be used to compute distance-to-nearest-star | ||
metrics. | ||
sources_columns : `collections.abc.Set` [ `str` ], optional | ||
Set of all column names in ``sources``. If provided, ``sources`` | ||
may be any table type for which string indexes yield column arrays. | ||
If not provided, ``sources`` is assumed to be an | ||
`lsst.afw.table.SourceCatalog`. | ||
sources_is_astropy : `bool`, optional | ||
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 docstring needs updating. |
||
Whether ``sources`` is an `astropy.table.Table` instance instead | ||
of an `lsst.afw.table.Catalog` instance. Default is `False` (the | ||
latter). | ||
""" | ||
nan = float("nan") | ||
summary.psfSigma = nan | ||
|
@@ -240,24 +241,18 @@ def update_psf_stats(self, summary, psf, bbox, sources=None, image_mask=None, so | |
# No sources are available (as in some tests) | ||
return | ||
|
||
if sources_columns is None: | ||
sources_columns = sources.schema.getNames() | ||
if ( | ||
self.config.starSelection not in sources_columns | ||
or self.config.starShape + '_flag' not in sources_columns | ||
): | ||
# The source catalog does not have the necessary fields (as in some | ||
# tests). | ||
return | ||
|
||
psf_mask = sources[self.config.starSelection] & (~sources[self.config.starShape + '_flag']) | ||
nPsfStar = psf_mask.sum() | ||
|
||
if nPsfStar == 0: | ||
# No stars to measure statistics, so we must return the defaults | ||
# of 0 stars and NaN values. | ||
return | ||
psf_cat = sources[psf_mask].copy(deep=True) | ||
|
||
if sources_is_astropy: | ||
psf_cat = sources[psf_mask] | ||
else: | ||
psf_cat = sources[psf_mask].copy(deep=True) | ||
|
||
starXX = psf_cat[self.config.starShape + '_xx'] | ||
starYY = psf_cat[self.config.starShape + '_yy'] | ||
|
@@ -449,8 +444,8 @@ def maximum_nearest_psf_distance( | |
Parameters | ||
---------- | ||
image_mask : `lsst.afw.image.Mask` | ||
The mask plane assosiated with the exposure. | ||
psf_cat : `lsst.afw.table.SourceCatalog` | ||
The mask plane associated with the exposure. | ||
psf_cat : `lsst.afw.table.SourceCatalog` or `astropy.table.Table` | ||
Catalog containing only the stars used in the PSF modeling. | ||
sampling : `int` | ||
Sampling rate in each dimension to create the grid of points on which | ||
|
@@ -476,8 +471,8 @@ def maximum_nearest_psf_distance( | |
|
||
dist_to_nearest_psf = np.full(good.shape, np.inf) | ||
for psf in psf_cat: | ||
x_psf = psf.getX() | ||
y_psf = psf.getY() | ||
x_psf = psf["slot_Centroid_x"] | ||
y_psf = psf["slot_Centroid_y"] | ||
dist_to_nearest_psf = np.minimum(dist_to_nearest_psf, np.hypot(xx - x_psf, yy - y_psf)) | ||
unmasked_dists = dist_to_nearest_psf * good | ||
max_dist_to_nearest_psf = np.max(unmasked_dists) | ||
|
@@ -498,9 +493,9 @@ def psf_trace_radius_delta( | |
Parameters | ||
---------- | ||
image_mask : `lsst.afw.image.Mask` | ||
The mask plane assosiated with the exposure. | ||
The mask plane associated with the exposure. | ||
image_psf : `lsst.afw.detection.Psf` | ||
The PSF model assosiated with the exposure. | ||
The PSF model associated with the exposure. | ||
sampling : `int` | ||
Sampling rate in each dimension to create the grid of points at which | ||
to evaluate ``image_psf``s trace radius value. The tradeoff is between | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is it a bit of a falsehood to say we're using the global versions (we don't actually have any, do we?!).