From a820b9f5e13e60aff1f7618745b5c5a0b466c2d3 Mon Sep 17 00:00:00 2001 From: Brianna Smart Date: Fri, 19 Apr 2024 14:15:20 -0700 Subject: [PATCH 1/2] Remove longTrailedSources from pipeline output --- python/lsst/ap/verify/testPipeline.py | 5 ++--- tests/test_testPipeline.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/python/lsst/ap/verify/testPipeline.py b/python/lsst/ap/verify/testPipeline.py index 23b89376..fe2544dd 100644 --- a/python/lsst/ap/verify/testPipeline.py +++ b/python/lsst/ap/verify/testPipeline.py @@ -457,6 +457,7 @@ def run(self, diaSourceCat): """ return Struct(filteredDiaSourceCat=afwTable.SourceCatalog(), rejectedDiaSources=afwTable.SourceCatalog(), + longTrailedSources=afwTable.SourceCatalog(), ) @@ -631,6 +632,4 @@ def run(self, return Struct(apdbMarker=self.config.apdb.value, associatedDiaSources=pandas.DataFrame(), diaForcedSources=pandas.DataFrame(), - diaObjects=pandas.DataFrame(), - longTrailedSources=pandas.DataFrame(), - ) + diaObjects=pandas.DataFrame(),) diff --git a/tests/test_testPipeline.py b/tests/test_testPipeline.py index 45a14765..205391d3 100644 --- a/tests/test_testPipeline.py +++ b/tests/test_testPipeline.py @@ -131,7 +131,8 @@ def setUpClass(cls): butlerTests.addDatasetType(cls.repo, "visitSsObjects", cls.visitOnlyId.dimensions, "DataFrame") butlerTests.addDatasetType(cls.repo, "apdb_marker", cls.visitId.dimensions, "Config") butlerTests.addDatasetType(cls.repo, "deepDiff_assocDiaSrc", cls.visitId.dimensions, "DataFrame") - butlerTests.addDatasetType(cls.repo, "deepDiff_longTrailedSrc", cls.visitId.dimensions, "DataFrame") + butlerTests.addDatasetType(cls.repo, "deepDiff_longTrailedSrc", cls.visitId.dimensions, + "ArrowAstropy") butlerTests.addDatasetType(cls.repo, "deepRealBogusSources", cls.visitId.dimensions, "Catalog") butlerTests.addDatasetType(cls.repo, "deepDiff_diaForcedSrc", cls.visitId.dimensions, "DataFrame") butlerTests.addDatasetType(cls.repo, "deepDiff_diaObject", cls.visitId.dimensions, "DataFrame") @@ -359,7 +360,6 @@ def testMockDiaPipelineTask(self): "template": self.visitId, "apdbMarker": self.visitId, "associatedDiaSources": self.visitId, - "longTrailedSources": self.visitId, "diaForcedSources": self.visitId, "diaObjects": self.visitId, }) From 2e02abf6244f6b40ba5b8cb3a0bf4416a2e66010 Mon Sep 17 00:00:00 2001 From: Brianna Smart Date: Wed, 8 May 2024 09:29:11 -0700 Subject: [PATCH 2/2] 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 fe2544dd..92b039f8 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 205391d3..175a1b0f 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):