Skip to content

Commit

Permalink
Update unit test for diaSourceCatalogTask
Browse files Browse the repository at this point in the history
Update docs and unit tests to include trailed source filtering in filterDiaSourceCatalog.py
  • Loading branch information
bsmartradio committed May 8, 2024
1 parent a820b9f commit 2e02abf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions python/lsst/ap/verify/testPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,22 +442,33 @@ class MockFilterDiaSourceCatalogTask(PipelineTask):
ConfigClass = FilterDiaSourceCatalogConfig
_DefaultName = "notFilterDiaSourceCatalog"

def run(self, diaSourceCat):
def run(self, diaSourceCat, diffImVisitInfo):
"""Produce filtering outputs with no processing.
Parameters
----------
diaSourceCat : `lsst.afw.table.SourceCatalog`
Catalog of sources measured on the difference image.
diffImVisitInfo: `lsst.afw.image.VisitInfo`
VisitInfo for the difference image corresponding to diaSourceCat.
Returns
-------
results : `lsst.pipe.base.Struct`
Results struct with components.
``filteredDiaSourceCat`` : `lsst.afw.table.SourceCatalog`
The catalog of filtered sources.
``rejectedDiaSources`` : `lsst.afw.table.SourceCatalog`
The catalog of rejected sky sources.
``longTrailedDiaSources`` : `astropy.table.Table`
DiaSources which have trail lengths greater than
max_trail_length*exposure_time.
"""
# TODO Add docstrings for diffIm
return Struct(filteredDiaSourceCat=afwTable.SourceCatalog(),
rejectedDiaSources=afwTable.SourceCatalog(),
longTrailedSources=afwTable.SourceCatalog(),
longTrailedSources=afwTable.SourceCatalog().asAstropy(),
)


Expand Down
3 changes: 2 additions & 1 deletion tests/test_testPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ def testMockDetectAndMeasureTask(self):
pipelineTests.runTestQuantum(task, self.butler, quantum, mockRun=False)

def testMockFilterDiaSourceCatalogTask(self):
visitInfo = afwImage.VisitInfo()
task = MockFilterDiaSourceCatalogTask()
pipelineTests.assertValidInitOutput(task)
result = task.run(afwTable.SourceCatalog())
result = task.run(afwTable.SourceCatalog(), visitInfo)
pipelineTests.assertValidOutput(task, result)

def testMockSpatiallySampledMetricsTask(self):
Expand Down

0 comments on commit 2e02abf

Please sign in to comment.