From 2e02abf6244f6b40ba5b8cb3a0bf4416a2e66010 Mon Sep 17 00:00:00 2001 From: Brianna Smart Date: Wed, 8 May 2024 09:29:11 -0700 Subject: [PATCH] Update unit test for diaSourceCatalogTask Update docs and unit tests to include trailed source filtering in filterDiaSourceCatalog.py --- python/lsst/ap/verify/testPipeline.py | 15 +++++++++++++-- tests/test_testPipeline.py | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/python/lsst/ap/verify/testPipeline.py b/python/lsst/ap/verify/testPipeline.py index fe2544d..92b039f 100644 --- a/python/lsst/ap/verify/testPipeline.py +++ b/python/lsst/ap/verify/testPipeline.py @@ -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(), ) diff --git a/tests/test_testPipeline.py b/tests/test_testPipeline.py index 205391d..175a1b0 100644 --- a/tests/test_testPipeline.py +++ b/tests/test_testPipeline.py @@ -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):