Skip to content
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-41063: Remove trailedSourceFilter and add to filterDiaSourceCatalog #222

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions python/lsst/ap/verify/testPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,21 +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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea 😜

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added docstrings and updated the results docstrings to be more comprehensive.

return Struct(filteredDiaSourceCat=afwTable.SourceCatalog(),
rejectedDiaSources=afwTable.SourceCatalog(),
longTrailedSources=afwTable.SourceCatalog().asAstropy(),
)


Expand Down Expand Up @@ -631,6 +643,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(),)
7 changes: 4 additions & 3 deletions tests/test_testPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -262,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 Expand Up @@ -359,7 +361,6 @@ def testMockDiaPipelineTask(self):
"template": self.visitId,
"apdbMarker": self.visitId,
"associatedDiaSources": self.visitId,
"longTrailedSources": self.visitId,
"diaForcedSources": self.visitId,
"diaObjects": self.visitId,
})
Expand Down
Loading