Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from lsst.verify.tasks import MetricTask, MetricConfig, MetricConnections 

2import lsst.pipe.base as pipeBase 

3import lsst.pex.config as pexConfig 

4 

5from .BaseSubTasks import NumpySummaryTask 

6 

7__all__ = ( 

8 "CatalogSummaryBaseConnections", 

9 "CatalogSummaryBaseConfig", 

10 "CatalogSummaryBaseTask", 

11) 

12 

13 

14# Dimensions of the Connections class define the iterations of runQuantum 

15class CatalogSummaryBaseConnections( 

16 MetricConnections, 

17 defaultTemplates={"agg_name": None}, 

18 dimensions=("band", "tract", "instrument", "skymap"), 

19): 

20 # Make this an LSST verify Measurement 

21 measurement = pipeBase.connectionTypes.Output( 

22 doc="{agg_name} {package}_{metric}.", 

23 dimensions=("instrument", "tract", "band"), 

24 storageClass="MetricValue", 

25 name="metricvalue_{agg_name}_{package}_{metric}", 

26 ) 

27 

28 

29class CatalogSummaryBaseConfig( 

30 MetricConfig, pipelineConnections=CatalogSummaryBaseConnections 

31): 

32 agg = pexConfig.ConfigurableField( 

33 # This task is meant to make measurements of various types. 

34 # The default task is, therefore, a bit of a place holder. 

35 # It is expected that this will be overridden in the pipeline 

36 # definition in most cases. 

37 target=NumpySummaryTask, 

38 doc="Numpy aggregation task", 

39 ) 

40 

41 

42class CatalogSummaryBaseTask(MetricTask): 

43 

44 ConfigClass = CatalogSummaryBaseConfig 

45 _DefaultName = "catalogSummaryBaseTask" 

46 

47 def __init__(self, config, *args, **kwargs): 

48 super().__init__(*args, config=config, **kwargs) 

49 self.makeSubtask("agg") 

50 

51 def run(self, measurements): 

52 return self.agg.run( 

53 measurements, 

54 self.config.connections.agg_name, 

55 self.config.connections.package, 

56 self.config.connections.metric, 

57 )