Skip to content

Commit

Permalink
Add runtime metrics for FilterDiaSourceCatalogTask
Browse files Browse the repository at this point in the history
  • Loading branch information
rai-harshit committed Feb 2, 2024
1 parent 4dcd5b5 commit 1071cb2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
16 changes: 15 additions & 1 deletion pipelines/_ingredients/MetricsRuntime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ tasks:
connections.metric: PackageAlertsTime
connections.labelName: diaPipe
target: diaPipe:alertPackager.run
timing_filterDiaSrcCat:
class: lsst.verify.tasks.commonMetrics.TimingMetricTask
config:
connections.package: ap_association
connections.metric: FilterDiaSourceCatalogTime
connections.labelName: filterDiaSrcCat
target: filterDiaSrcCat.run
cputiming_isr:
class: lsst.verify.tasks.commonMetrics.CpuTimingMetricTask
config:
Expand Down Expand Up @@ -233,6 +240,13 @@ tasks:
connections.metric: PackageAlertsCpuTime
connections.labelName: diaPipe
target: diaPipe:alertPackager.run
cputiming_filterDiaSrcCat:
class: lsst.verify.tasks.commonMetrics.TimingMetricTask
config:
connections.package: ap_association
connections.metric: FilterDiaSourceCatalogCpuTime
connections.labelName: filterDiaSrcCat
target: filterDiaSrcCat.run
memory_apPipe:
class: lsst.verify.tasks.commonMetrics.MemoryMetricTask
config:
Expand All @@ -253,4 +267,4 @@ tasks:
connections.package: ap_association
connections.metric: PackageAlertsMemory
connections.labelName: diaPipe
target: diaPipe:alertPackager.run
target: diaPipe:alertPackager.run
27 changes: 26 additions & 1 deletion python/lsst/ap/verify/testPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
from lsst.ip.diffim import GetTemplateConfig, AlardLuptonSubtractConfig, DetectAndMeasureConfig
from lsst.pipe.tasks.characterizeImage import CharacterizeImageConfig
from lsst.pipe.tasks.calibrate import CalibrateConfig
from lsst.ap.association import TransformDiaSourceCatalogConfig, DiaPipelineConfig
from lsst.ap.association import (TransformDiaSourceCatalogConfig,
DiaPipelineConfig, FilterDiaSourceCatalogConfig)


class MockIsrTask(PipelineTask):
Expand Down Expand Up @@ -433,6 +434,30 @@ def run(self, science, matchedTemplate, difference,
)


class MockFilterDiaSourceCatalogTask(PipelineTask):
"""A do-nothing substitute for FilterDiaSourceCatalogTask.
"""
ConfigClass = FilterDiaSourceCatalogConfig
_DefaultName = "notFilterDiaSourceCatalog"

def run(self, diaSourceCat):
"""Produce filtering outputs with no processing.
Parameters
----------
diaSourceCat : `lsst.afw.table.SourceCatalog`
Catalog of sources measured on the difference image.
Returns
-------
results : `lsst.pipe.base.Struct`
Results struct with components.
"""
return Struct(filteredDiaSourceCat=afwTable.SourceCatalog(),
rejectedDiaSources=afwTable.SourceCatalog(),
)


class MockTransformDiaSourceCatalogTask(PipelineTask):
"""A do-nothing substitute for TransformDiaSourceCatalogTask.
"""
Expand Down
7 changes: 7 additions & 0 deletions tests/MockApPipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ tasks:
config:
connections.coaddName: parameters.coaddName
doSkySources: True
filterDiaSrcCat:
class: lsst.ap.verify.testPipeline.MockFilterDiaSourceCatalogTask
config:
doRemoveSkySources: True
connections.coaddName: parameters.coaddName
transformDiaSrcCat:
class: lsst.ap.verify.testPipeline.MockTransformDiaSourceCatalogTask
config:
Expand All @@ -61,6 +66,8 @@ contracts:
- detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).subtractedMeasuredExposure.name ==
transformDiaSrcCat.connections.ConnectionsClass(config=transformDiaSrcCat).diffIm.name
- detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).diaSources.name ==
filterDiaSrcCat.connections.ConnectionsClass(config=filterDiaSrcCat).diaSourceCat.name
- filterDiaSrcCat.connections.ConnectionsClass(config=filterDiaSrcCat).filteredDiaSourceCat.name ==
transformDiaSrcCat.connections.ConnectionsClass(config=transformDiaSrcCat).diaSourceCat.name
- detectAndMeasure.connections.ConnectionsClass(config=detectAndMeasure).subtractedMeasuredExposure.name ==
diaPipe.connections.ConnectionsClass(config=diaPipe).diffIm.name
Expand Down

0 comments on commit 1071cb2

Please sign in to comment.