Skip to content

Commit

Permalink
Merge branch 'tickets/DM-30926'
Browse files Browse the repository at this point in the history
  • Loading branch information
morriscb committed Jul 8, 2021
2 parents d695ed4 + d03ed09 commit 26fc5eb
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions python/lsst/ap/association/transformDiaSourceCatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ class TransformDiaSourceCatalogConfig(pipeBase.PipelineTaskConfig,
"data",
"DiaSource.yaml")
)
doRemoveSkySources = pexConfig.Field(
dtype=bool,
default=False,
doc="Input DiaSource catalog contains SkySources that should be "
"removed before storing the output DiaSource catalog."
)


class TransformDiaSourceCatalogTask(TransformCatalogBaseTask):
Expand Down Expand Up @@ -172,6 +178,8 @@ def run(self,
ccdVisitId)

diaSourceDf = diaSourceCat.asAstropy().to_pandas()
if self.config.doRemoveSkySources:
diaSourceDf = diaSourceDf[~diaSourceDf["sky_source"]]
diaSourceDf["bboxSize"] = self.computeBBoxSizes(diaSourceCat)
diaSourceDf["ccdVisitId"] = ccdVisitId
diaSourceDf["filterName"] = band
Expand Down Expand Up @@ -202,11 +210,14 @@ def computeBBoxSizes(self, inputCatalog):
Returns
-------
outputBBoxSizes : `numpy.ndarray`, (N,)
outputBBoxSizes : `list` of `float`
Array of bbox sizes.
"""
outputBBoxSizes = np.empty(len(inputCatalog), dtype=int)
for idx, record in enumerate(inputCatalog):
outputBBoxSizes = []
for record in inputCatalog:
if self.config.doRemoveSkySources:
if record["sky_source"]:
continue
footprintBBox = record.getFootprint().getBBox()
# Compute twice the size of the largest dimension of the footprint
# bounding box. This is the largest footprint we should need to cover
Expand All @@ -223,7 +234,7 @@ def computeBBoxSizes(self, inputCatalog):
footprintBBox.minY - recY]))))
if bboxSize > maxSize:
bboxSize = maxSize
outputBBoxSizes[idx] = bboxSize
outputBBoxSizes.append(bboxSize)

return outputBBoxSizes

Expand Down

0 comments on commit 26fc5eb

Please sign in to comment.