LSSTApplications  17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
LSSTDataManagementBasePackage
singleFrameDriver.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division, print_function
2 
3 from lsst.pipe.base import ArgumentParser, ButlerInitializedTaskRunner, ConfigDatasetType
4 from lsst.pipe.tasks.processCcd import ProcessCcdTask
5 from lsst.pex.config import Config, Field, ConfigurableField, ListField
6 from lsst.ctrl.pool.parallel import BatchParallelTask, BatchTaskRunner
7 
8 
10  processCcd = ConfigurableField(
11  target=ProcessCcdTask, doc="CCD processing task")
12  ignoreCcdList = ListField(dtype=int, default=[],
13  doc="List of CCDs to ignore when processing")
14  ccdKey = Field(dtype=str, default="ccd",
15  doc="DataId key corresponding to a single sensor")
16 
17 
19  """Run batches, and initialize Task using a butler"""
20  pass
21 
22 
23 class SingleFrameDriverTask(BatchParallelTask):
24  """Process CCDs in parallel
25  """
26  ConfigClass = SingleFrameDriverConfig
27  _DefaultName = "singleFrameDriver"
28  RunnerClass = SingleFrameTaskRunner
29 
30  def __init__(self, butler=None, psfRefObjLoader=None, astromRefObjLoader=None, photoRefObjLoader=None,
31  *args, **kwargs):
32  """!
33  Constructor
34 
35  The psfRefObjLoader, astromRefObjLoader, photoRefObjLoader should
36  be an instance of LoadReferenceObjectsTasks that supplies an external
37  reference catalog. They may be None if the butler argument is
38  provided or the particular reference catalog is not required.
39 
40  @param[in] butler The butler is passed to the refObjLoader constructor in case it is
41  needed. Ignored if the refObjLoader argument provides a loader directly.
42  @param[in] psfRefObjLoader Reference catalog loader for PSF determination.
43  @param[in] astromRefObjLoader Reference catalog loader for astrometric calibration.
44  @param[in] photoRefObjLoader Reference catalog loader for photometric calibration.
45  @param[in,out] kwargs other keyword arguments for lsst.ctrl.pool.BatchParallelTask
46  """
47  BatchParallelTask.__init__(self, *args, **kwargs)
48  self.ignoreCcds = set(self.config.ignoreCcdList)
49  self.makeSubtask("processCcd", butler=butler, psfRefObjLoader=psfRefObjLoader,
50  astromRefObjLoader=astromRefObjLoader, photoRefObjLoader=photoRefObjLoader)
51 
52  @classmethod
53  def _makeArgumentParser(cls, *args, **kwargs):
54  kwargs.pop("doBatch", False)
55  parser = ArgumentParser(name="singleFrameDriver", *args, **kwargs)
56  parser.add_id_argument("--id",
57  datasetType=ConfigDatasetType(
58  name="processCcd.isr.datasetType"),
59  level="sensor",
60  help="data ID, e.g. --id visit=12345 ccd=67")
61  return parser
62 
63  def runDataRef(self, sensorRef):
64  """Process a single CCD, with scatter-gather-scatter using MPI.
65  """
66  if sensorRef.dataId[self.config.ccdKey] in self.ignoreCcds:
67  self.log.warn("Ignoring %s: CCD in ignoreCcdList" %
68  (sensorRef.dataId))
69  return None
70 
71  with self.logOperation("processing %s" % (sensorRef.dataId,)):
72  return self.processCcd.runDataRef(sensorRef)
def makeSubtask(self, name, keyArgs)
Definition: task.py:275
daf::base::PropertySet * set
Definition: fits.cc:884
def __init__(self, butler=None, psfRefObjLoader=None, astromRefObjLoader=None, photoRefObjLoader=None, args, kwargs)
Constructor.
def logOperation(self, operation, catch=False, trace=True)
Provide a context manager for logging an operation.
Definition: parallel.py:497