LSSTApplications  19.0.0-14-gb0260a2+599893a4c6,20.0.0+126303c00d,20.0.0+2f3d0e5c40,20.0.0+36ef800059,20.0.0+5ac7adcc0c,20.0.0+693a64958a,20.0.0+bebc1f60e8,20.0.0+cad136aba6,20.0.0+e2e26847c2,20.0.0+e69b5d60e7,20.0.0-1-g10df615+11b215b765,20.0.0-1-g253301a+36ef800059,20.0.0-1-g2b7511a+bebc1f60e8,20.0.0-1-g4d801e7+aeeb640673,20.0.0-1-g5b95a8c+f111d5f02f,20.0.0-1-g660595b+f45b7d88f4,20.0.0-1-gc96f8cb+e3b38461e6,20.0.0-1-gd1c87d7+85c46248f3,20.0.0-1-gedffbd8+d0b27f8bcb,20.0.0-16-g111fe95+e3b38461e6,20.0.0-16-g18096c8+d1a4df0137,20.0.0-16-g233ea98+a4df35922d,20.0.0-17-ga9337b4+41f27cfd54,20.0.0-2-g4dae9ad+e3b38461e6,20.0.0-2-g7818986+85c46248f3,20.0.0-2-gec03fae+ff10c6d78d,20.0.0-28-g282f9e7e+feda6aebd8,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g6a8623c+d1a4df0137,20.0.0-3-g750bffe+f5427621ce,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-5-gfcebe35+e2b15ed341,20.0.0-52-g73d9071+9bf1eb8e0a,20.0.0-7-gcda7bf1+773ba852cb,20.0.0-8-g4540fe2a+952f6d3c43,20.0.0-9-g61a2a9a3d+14f89e4eca,w.2020.40
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.synpipe.positionGalSimFakes.PositionGalSimFakesTask Class Reference
Inheritance diagram for lsst.synpipe.positionGalSimFakes.PositionGalSimFakesTask:
lsst.pipe.tasks.fakes.BaseFakeSourcesTask lsst.pipe.base.task.Task

Public Member Functions

def __init__ (self, **kwargs)
 
def run (self, exposure, background)
 
def emptyMetadata (self)
 
def getSchemaCatalogs (self)
 
def getAllSchemaCatalogs (self)
 
def getFullMetadata (self)
 
def getFullName (self)
 
def getName (self)
 
def getTaskDict (self)
 
def makeSubtask (self, name, **keyArgs)
 
def timer (self, name, logLevel=Log.DEBUG)
 
def makeField (cls, doc)
 
def __reduce__ (self)
 

Public Attributes

 rng
 
 npRand
 
 galData
 
 bitmask
 
 metadata
 
 log
 
 config
 

Static Public Attributes

 ConfigClass
 

Detailed Description

Definition at line 50 of file positionGalSimFakes.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.synpipe.positionGalSimFakes.PositionGalSimFakesTask.__init__ (   self,
**  kwargs 
)
Initialize the Task.

Subclasses that define their own __init__ should simply forward all arguments to the base
class constructor.  They can then assume self.config is an instance of their ConfigClass.

If an external catalog is used to add sources consistently to multiple overlapping images,
that catalog should generally be loaded and attached to self here, so it can be used
multiple times by the run() method.

Reimplemented from lsst.pipe.tasks.fakes.BaseFakeSourcesTask.

Definition at line 53 of file positionGalSimFakes.py.

53  def __init__(self, **kwargs):
54  BaseFakeSourcesTask.__init__(self, **kwargs)
55  print("RNG seed:", self.config.seed)
56  self.rng = lsst.afw.math.Random(seed=self.config.seed)
57  self.npRand = np.random.RandomState(self.config.seed)
58  self.galData = fits.open(self.config.galList)[1].data
59 

Member Function Documentation

◆ __reduce__()

def lsst.pipe.base.task.Task.__reduce__ (   self)
inherited
Pickler.

Reimplemented in lsst.obs.base.defineVisits.DefineVisitsTask, lsst.obs.base.ingest.RawIngestTask, lsst.pipe.drivers.multiBandDriver.MultiBandDriverTask, and lsst.pipe.drivers.coaddDriver.CoaddDriverTask.

Definition at line 373 of file task.py.

373  def __reduce__(self):
374  """Pickler.
375  """
376  return self.__class__, (self.config, self._name, self._parentTask, None)

◆ emptyMetadata()

def lsst.pipe.base.task.Task.emptyMetadata (   self)
inherited
Empty (clear) the metadata for this Task and all sub-Tasks.

Definition at line 153 of file task.py.

153  def emptyMetadata(self):
154  """Empty (clear) the metadata for this Task and all sub-Tasks.
155  """
156  for subtask in self._taskDict.values():
157  subtask.metadata = dafBase.PropertyList()
158 

◆ getAllSchemaCatalogs()

def lsst.pipe.base.task.Task.getAllSchemaCatalogs (   self)
inherited
Get schema catalogs for all tasks in the hierarchy, combining the results into a single dict.

Returns
-------
schemacatalogs : `dict`
    Keys are butler dataset type, values are a empty catalog (an instance of the appropriate
    lsst.afw.table Catalog type) for all tasks in the hierarchy, from the top-level task down
    through all subtasks.

Notes
-----
This method may be called on any task in the hierarchy; it will return the same answer, regardless.

The default implementation should always suffice. If your subtask uses schemas the override
`Task.getSchemaCatalogs`, not this method.

Definition at line 188 of file task.py.

188  def getAllSchemaCatalogs(self):
189  """Get schema catalogs for all tasks in the hierarchy, combining the results into a single dict.
190 
191  Returns
192  -------
193  schemacatalogs : `dict`
194  Keys are butler dataset type, values are a empty catalog (an instance of the appropriate
195  lsst.afw.table Catalog type) for all tasks in the hierarchy, from the top-level task down
196  through all subtasks.
197 
198  Notes
199  -----
200  This method may be called on any task in the hierarchy; it will return the same answer, regardless.
201 
202  The default implementation should always suffice. If your subtask uses schemas the override
203  `Task.getSchemaCatalogs`, not this method.
204  """
205  schemaDict = self.getSchemaCatalogs()
206  for subtask in self._taskDict.values():
207  schemaDict.update(subtask.getSchemaCatalogs())
208  return schemaDict
209 

◆ getFullMetadata()

def lsst.pipe.base.task.Task.getFullMetadata (   self)
inherited
Get metadata for all tasks.

Returns
-------
metadata : `lsst.daf.base.PropertySet`
    The `~lsst.daf.base.PropertySet` keys are the full task name. Values are metadata
    for the top-level task and all subtasks, sub-subtasks, etc..

Notes
-----
The returned metadata includes timing information (if ``@timer.timeMethod`` is used)
and any metadata set by the task. The name of each item consists of the full task name
with ``.`` replaced by ``:``, followed by ``.`` and the name of the item, e.g.::

    topLevelTaskName:subtaskName:subsubtaskName.itemName

using ``:`` in the full task name disambiguates the rare situation that a task has a subtask
and a metadata item with the same name.

Definition at line 210 of file task.py.

210  def getFullMetadata(self):
211  """Get metadata for all tasks.
212 
213  Returns
214  -------
215  metadata : `lsst.daf.base.PropertySet`
216  The `~lsst.daf.base.PropertySet` keys are the full task name. Values are metadata
217  for the top-level task and all subtasks, sub-subtasks, etc..
218 
219  Notes
220  -----
221  The returned metadata includes timing information (if ``@timer.timeMethod`` is used)
222  and any metadata set by the task. The name of each item consists of the full task name
223  with ``.`` replaced by ``:``, followed by ``.`` and the name of the item, e.g.::
224 
225  topLevelTaskName:subtaskName:subsubtaskName.itemName
226 
227  using ``:`` in the full task name disambiguates the rare situation that a task has a subtask
228  and a metadata item with the same name.
229  """
230  fullMetadata = dafBase.PropertySet()
231  for fullName, task in self.getTaskDict().items():
232  fullMetadata.set(fullName.replace(".", ":"), task.metadata)
233  return fullMetadata
234 

◆ getFullName()

def lsst.pipe.base.task.Task.getFullName (   self)
inherited
Get the task name as a hierarchical name including parent task names.

Returns
-------
fullName : `str`
    The full name consists of the name of the parent task and each subtask separated by periods.
    For example:

    - The full name of top-level task "top" is simply "top".
    - The full name of subtask "sub" of top-level task "top" is "top.sub".
    - The full name of subtask "sub2" of subtask "sub" of top-level task "top" is "top.sub.sub2".

Definition at line 235 of file task.py.

235  def getFullName(self):
236  """Get the task name as a hierarchical name including parent task names.
237 
238  Returns
239  -------
240  fullName : `str`
241  The full name consists of the name of the parent task and each subtask separated by periods.
242  For example:
243 
244  - The full name of top-level task "top" is simply "top".
245  - The full name of subtask "sub" of top-level task "top" is "top.sub".
246  - The full name of subtask "sub2" of subtask "sub" of top-level task "top" is "top.sub.sub2".
247  """
248  return self._fullName
249 

◆ getName()

def lsst.pipe.base.task.Task.getName (   self)
inherited
Get the name of the task.

Returns
-------
taskName : `str`
    Name of the task.

See also
--------
getFullName

Definition at line 250 of file task.py.

250  def getName(self):
251  """Get the name of the task.
252 
253  Returns
254  -------
255  taskName : `str`
256  Name of the task.
257 
258  See also
259  --------
260  getFullName
261  """
262  return self._name
263 

◆ getSchemaCatalogs()

def lsst.pipe.base.task.Task.getSchemaCatalogs (   self)
inherited
Get the schemas generated by this task.

Returns
-------
schemaCatalogs : `dict`
    Keys are butler dataset type, values are an empty catalog (an instance of the appropriate
    `lsst.afw.table` Catalog type) for this task.

Notes
-----

.. warning::

   Subclasses that use schemas must override this method. The default implemenation returns
   an empty dict.

This method may be called at any time after the Task is constructed, which means that all task
schemas should be computed at construction time, *not* when data is actually processed. This
reflects the philosophy that the schema should not depend on the data.

Returning catalogs rather than just schemas allows us to save e.g. slots for SourceCatalog as well.

See also
--------
Task.getAllSchemaCatalogs

Definition at line 159 of file task.py.

159  def getSchemaCatalogs(self):
160  """Get the schemas generated by this task.
161 
162  Returns
163  -------
164  schemaCatalogs : `dict`
165  Keys are butler dataset type, values are an empty catalog (an instance of the appropriate
166  `lsst.afw.table` Catalog type) for this task.
167 
168  Notes
169  -----
170 
171  .. warning::
172 
173  Subclasses that use schemas must override this method. The default implemenation returns
174  an empty dict.
175 
176  This method may be called at any time after the Task is constructed, which means that all task
177  schemas should be computed at construction time, *not* when data is actually processed. This
178  reflects the philosophy that the schema should not depend on the data.
179 
180  Returning catalogs rather than just schemas allows us to save e.g. slots for SourceCatalog as well.
181 
182  See also
183  --------
184  Task.getAllSchemaCatalogs
185  """
186  return {}
187 

◆ getTaskDict()

def lsst.pipe.base.task.Task.getTaskDict (   self)
inherited
Get a dictionary of all tasks as a shallow copy.

Returns
-------
taskDict : `dict`
    Dictionary containing full task name: task object for the top-level task and all subtasks,
    sub-subtasks, etc..

Definition at line 264 of file task.py.

264  def getTaskDict(self):
265  """Get a dictionary of all tasks as a shallow copy.
266 
267  Returns
268  -------
269  taskDict : `dict`
270  Dictionary containing full task name: task object for the top-level task and all subtasks,
271  sub-subtasks, etc..
272  """
273  return self._taskDict.copy()
274 

◆ makeField()

def lsst.pipe.base.task.Task.makeField (   cls,
  doc 
)
inherited
Make a `lsst.pex.config.ConfigurableField` for this task.

Parameters
----------
doc : `str`
    Help text for the field.

Returns
-------
configurableField : `lsst.pex.config.ConfigurableField`
    A `~ConfigurableField` for this task.

Examples
--------
Provides a convenient way to specify this task is a subtask of another task.

Here is an example of use::

    class OtherTaskConfig(lsst.pex.config.Config)
aSubtask = ATaskClass.makeField("a brief description of what this task does")

Definition at line 329 of file task.py.

329  def makeField(cls, doc):
330  """Make a `lsst.pex.config.ConfigurableField` for this task.
331 
332  Parameters
333  ----------
334  doc : `str`
335  Help text for the field.
336 
337  Returns
338  -------
339  configurableField : `lsst.pex.config.ConfigurableField`
340  A `~ConfigurableField` for this task.
341 
342  Examples
343  --------
344  Provides a convenient way to specify this task is a subtask of another task.
345 
346  Here is an example of use::
347 
348  class OtherTaskConfig(lsst.pex.config.Config)
349  aSubtask = ATaskClass.makeField("a brief description of what this task does")
350  """
351  return ConfigurableField(doc=doc, target=cls)
352 

◆ makeSubtask()

def lsst.pipe.base.task.Task.makeSubtask (   self,
  name,
**  keyArgs 
)
inherited
Create a subtask as a new instance as the ``name`` attribute of this task.

Parameters
----------
name : `str`
    Brief name of the subtask.
keyArgs
    Extra keyword arguments used to construct the task. The following arguments are automatically
    provided and cannot be overridden:

    - "config".
    - "parentTask".

Notes
-----
The subtask must be defined by ``Task.config.name``, an instance of pex_config ConfigurableField
or RegistryField.

Definition at line 275 of file task.py.

275  def makeSubtask(self, name, **keyArgs):
276  """Create a subtask as a new instance as the ``name`` attribute of this task.
277 
278  Parameters
279  ----------
280  name : `str`
281  Brief name of the subtask.
282  keyArgs
283  Extra keyword arguments used to construct the task. The following arguments are automatically
284  provided and cannot be overridden:
285 
286  - "config".
287  - "parentTask".
288 
289  Notes
290  -----
291  The subtask must be defined by ``Task.config.name``, an instance of pex_config ConfigurableField
292  or RegistryField.
293  """
294  taskField = getattr(self.config, name, None)
295  if taskField is None:
296  raise KeyError(f"{self.getFullName()}'s config does not have field {name!r}")
297  subtask = taskField.apply(name=name, parentTask=self, **keyArgs)
298  setattr(self, name, subtask)
299 

◆ run()

def lsst.synpipe.positionGalSimFakes.PositionGalSimFakesTask.run (   self,
  exposure,
  background 
)
Add fake sources to the given Exposure, making use of the given BackgroundList if desired.

If pixels in the Exposure are replaced, not added to, extra care should be taken with the background,
mask, and variance planes.  The Exposure as given is background-subtracted (using the supplied
background model) and should be returned in the same state.

Reimplemented from lsst.pipe.tasks.fakes.BaseFakeSourcesTask.

Definition at line 60 of file positionGalSimFakes.py.

60  def run(self, exposure, background):
61  self.log.info("Adding fake galaxies at real positions")
62  PARENT = lsst.afw.image.PARENT
63  psf = exposure.getPsf()
64  md = exposure.getMetadata()
65  calib = exposure.getCalib()
66  expBBox = exposure.getBBox(PARENT)
67  wcs = exposure.getWcs()
68 
69  """Deal with the skipped ones."""
70  skipLog = 'runAddFake.skipped'
71  if not os.path.isfile(skipLog):
72  os.system('touch ' + skipLog)
73 
74  if self.config.galType == 'cosmos':
75  import galsim
76  exLevel = self.config.exclusionLevel
77  cosmosCat = galsim.COSMOSCatalog(exclusion_level=exLevel)
78  else:
79  cosmosCat = None
80 
81  for igal, gal in enumerate(self.galData):
82  try:
83  galident = gal["ID"]
84  except KeyError:
85  galident = igal + 1
86 
87  try:
88  flux = calib.getFlux(float(gal['mag']))
89  except KeyError:
90  raise KeyError("No mag column in %s" % self.config.galList)
91 
92  try:
93  galCoord = lsst.afw.geom.SpherePoint(gal['RA'], gal['DEC'], lsst.afw.geom.degrees)
94  except KeyError:
95  raise KeyError("No RA/DEC column in {} table".format(self.config.galList))
96 
97  skyToPixelMatrix = wcs.linearizeSkyToPixel(galCoord, lsst.afw.geom.degrees)
98  skyToPixelMatrix = skyToPixelMatrix.getLinear().getParameterVector() / 3600.0
99 
100  galXY = wcs.skyToPixel(galCoord)
101  bboxI = exposure.getBBox(PARENT)
102  bboxI.grow(self.config.maxMargin)
103  if not bboxI.contains(lsst.afw.geom.Point2I(galXY)):
104  # Will just skip this object
105  continue
106 
107  # Check the magnitude
108  if gal['mag'] <= 0:
109  self.log.info("Mag <= 0: Skipping %d" % galident)
110  self.log.info(" mag: %7.3d" % gal['mag'])
111  with open(skipLog, "a") as slog:
112  try:
113  fcntl.flock(slog, fcntl.LOCK_EX)
114  slog.write("%8d , negMag\n" % galident)
115  fcntl.flock(slog, fcntl.LOCK_UN)
116  except IOError:
117  continue
118  continue
119 
120  # This is extrapolating for the PSF, probably not a good idea
121  # Return an Image of the PSF, in a form suitable for convolution.
122  # The returned image is normalized to sum to unity.
123  try:
124  psfImage = psf.computeKernelImage(galXY)
125  except Exception:
126  # There may not be any data at this point, and the object
127  # should be skipped
128  continue
129  try:
130  addShear = self.config.addShear
131  prec = self.config.sersic_prec
132  galType = self.config.galType
133  if self.config.galType != 'cosmos':
134  galArray = makeFake.makeGalaxy(flux, gal,
135  psfImage.getArray(),
136  galType=galType,
137  cosmosCat=None,
138  calib=None,
139  addShear=addShear,
140  transform=skyToPixelMatrix)
141  else:
142  galArray = makeFake.makeGalaxy(flux, gal,
143  psfImage.getArray(),
144  cosmosCat=cosmosCat,
145  calib=calib,
146  galType=galType,
147  addShear=addShear,
148  sersic_prec=prec,
149  transform=skyToPixelMatrix)
150  except IndexError as ierr:
151  self.log.info("GalSim Index Error: Skipping %d" % galident)
152  self.log.info(ierr.message)
153  with open(skipLog, "a") as slog:
154  try:
155  fcntl.flock(slog, fcntl.LOCK_EX)
156  slog.write("%8d , galsimI\n" % galident)
157  fcntl.flock(slog, fcntl.LOCK_UN)
158  except IOError:
159  continue
160  continue
161  except KeyError as kerr:
162  self.log.info("GalSim Key Error: Skipping %d" % galident)
163  self.log.info(kerr.message)
164  with open(skipLog, "a") as slog:
165  try:
166  fcntl.flock(slog, fcntl.LOCK_EX)
167  slog.write("%8d , galsimK\n" % galident)
168  fcntl.flock(slog, fcntl.LOCK_UN)
169  except IOError:
170  continue
171  continue
172  except ValueError as verr:
173  self.log.info("GalSim Value Error: Skipping %d" % galident)
174  self.log.info(verr.message)
175  with open(skipLog, "a") as slog:
176  try:
177  fcntl.flock(slog, fcntl.LOCK_EX)
178  slog.write("%8d , galsimV\n" % galident)
179  fcntl.flock(slog, fcntl.LOCK_UN)
180  except IOError:
181  continue
182  continue
183  except RuntimeError as rerr:
184  self.log.info("GalSim Runtime Error: Skipping %d" % galident)
185  self.log.info(rerr.message)
186  with open(skipLog, "a") as slog:
187  try:
188  fcntl.flock(slog, fcntl.LOCK_EX)
189  slog.write("%8d , galsimR\n" % galident)
190  fcntl.flock(slog, fcntl.LOCK_UN)
191  except IOError:
192  continue
193  continue
194  except Exception as uerr:
195  self.log.info("Unexpected Error: Skipping %d" % galident)
196  self.log.info(uerr.message)
197  with open(skipLog, "a") as slog:
198  try:
199  fcntl.flock(slog, fcntl.LOCK_EX)
200  slog.write("%8d , Unexpected\n" % galident)
201  fcntl.flock(slog, fcntl.LOCK_UN)
202  except IOError:
203  continue
204  continue
205 
206  galImage = lsst.afw.image.ImageF(galArray.astype(np.float32))
207  galBBox = galImage.getBBox(PARENT)
208  galX0 = (galXY.getX() - galBBox.getWidth()/2.0 + 0.5)
209  galY0 = (galXY.getY() - galBBox.getHeight()/2.0 + 0.5)
210  galImage = lsst.afw.math.offsetImage(galImage,
211  galX0, galY0,
212  'lanczos3')
213  galBBox = galImage.getBBox(PARENT)
214 
215  # Check that we're within the larger exposure, otherwise crop
216  parentBox = galImage.getBBox(PARENT)
217  if expBBox.contains(parentBox) is False:
218  newBBox = galImage.getBBox(PARENT)
219  newBBox.clip(expBBox)
220  if newBBox.getArea() <= 0:
221  self.log.info("BBoxEdge Error: Skipping %d" % galident)
222  with open(skipLog, "a") as slog:
223  try:
224  fcntl.flock(slog, fcntl.LOCK_EX)
225  slog.write("%8d , bboxEdge\n" % galident)
226  fcntl.flock(slog, fcntl.LOCK_UN)
227  except IOError:
228  continue
229  continue
230  self.log.info("Cropping FAKE%d from %s to %s" % (galident,
231  str(galBBox), str(newBBox)))
232  galImage = galImage.Factory(galImage, newBBox,
233  PARENT)
234  galBBox = newBBox
235 
236  galMaskedImage = lsst.afw.image.MaskedImageF(galImage)
237 
238  # Put information of the added fake galaxies into the header
239  md.set("FAKE%s" % str(galident), "%.3f, %.3f" % (galXY.getX(),
240  galXY.getY()))
241  self.log.info("Adding fake %s at: %.1f,%.1f" % (str(galident),
242  galXY.getX(),
243  galXY.getY()))
244 
245  galMaskedImage.getMask().set(self.bitmask)
246  if not self.config.addMask:
247  try:
248  galMaskedImage.getMask().removeAndClearMaskPlane('FAKE',
249  True)
250  except Exception:
251  pass
252  try:
253  galMaskedImage.getMask().removeAndClearMaskPlane('CROSSTALK',
254  True)
255  except Exception:
256  pass
257  try:
258  galMaskedImage.getMask().removeAndClearMaskPlane('UNMASKEDNAN',
259  True)
260  except Exception:
261  pass
262 
263  maskedImage = exposure.getMaskedImage()
264  try:
265  maskedImage.getMask().removeAndClearMaskPlane('CROSSTALK',
266  True)
267  except Exception:
268  pass
269  try:
270  maskedImage.getMask().removeAndClearMaskPlane('UNMASKEDNAN',
271  True)
272  except Exception:
273  pass
274  if not self.config.addMask:
275  try:
276  maskedImage.getMask().removeAndClearMaskPlane('FAKE', True)
277  except Exception:
278  pass
279 
280  BBox = galMaskedImage.getBBox(PARENT)
281  subMaskedImage = maskedImage.Factory(exposure.getMaskedImage(),
282  BBox,
283  PARENT)
284  subMaskedImage += galMaskedImage
285 
286  """
287  #
288  galMaskedImage.getMask().set(self.bitmask)
289 
290  maskedImage = exposure.getMaskedImage()
291  try:
292  maskedImage.getMask().removeAndClearMaskPlane('CROSSTALK',
293  True)
294  except Exception:
295  pass
296  try:
297  maskedImage.getMask().removeAndClearMaskPlane('UNMASKEDNAN',
298  True)
299  except Exception:
300  pass
301  try:
302  maskedImage.getMask().removeAndClearMaskPlane('FAKE', True)
303  except Exception:
304  pass
305  """

◆ timer()

def lsst.pipe.base.task.Task.timer (   self,
  name,
  logLevel = Log.DEBUG 
)
inherited
Context manager to log performance data for an arbitrary block of code.

Parameters
----------
name : `str`
    Name of code being timed; data will be logged using item name: ``Start`` and ``End``.
logLevel
    A `lsst.log` level constant.

Examples
--------
Creating a timer context::

    with self.timer("someCodeToTime"):
pass  # code to time

See also
--------
timer.logInfo

Definition at line 301 of file task.py.

301  def timer(self, name, logLevel=Log.DEBUG):
302  """Context manager to log performance data for an arbitrary block of code.
303 
304  Parameters
305  ----------
306  name : `str`
307  Name of code being timed; data will be logged using item name: ``Start`` and ``End``.
308  logLevel
309  A `lsst.log` level constant.
310 
311  Examples
312  --------
313  Creating a timer context::
314 
315  with self.timer("someCodeToTime"):
316  pass # code to time
317 
318  See also
319  --------
320  timer.logInfo
321  """
322  logInfo(obj=self, prefix=name + "Start", logLevel=logLevel)
323  try:
324  yield
325  finally:
326  logInfo(obj=self, prefix=name + "End", logLevel=logLevel)
327 

Member Data Documentation

◆ bitmask

lsst.pipe.tasks.fakes.BaseFakeSourcesTask.bitmask
inherited

Definition at line 61 of file fakes.py.

◆ config

lsst.pipe.base.task.Task.config
inherited

Definition at line 149 of file task.py.

◆ ConfigClass

lsst.synpipe.positionGalSimFakes.PositionGalSimFakesTask.ConfigClass
static

Definition at line 51 of file positionGalSimFakes.py.

◆ galData

lsst.synpipe.positionGalSimFakes.PositionGalSimFakesTask.galData

Definition at line 58 of file positionGalSimFakes.py.

◆ log

lsst.pipe.base.task.Task.log
inherited

Definition at line 148 of file task.py.

◆ metadata

lsst.pipe.base.task.Task.metadata
inherited

Definition at line 121 of file task.py.

◆ npRand

lsst.synpipe.positionGalSimFakes.PositionGalSimFakesTask.npRand

Definition at line 57 of file positionGalSimFakes.py.

◆ rng

lsst.synpipe.positionGalSimFakes.PositionGalSimFakesTask.rng

Definition at line 56 of file positionGalSimFakes.py.


The documentation for this class was generated from the following file:
lsst::log.log.logContinued.info
def info(fmt, *args)
Definition: logContinued.py:201
lsst::daf::base::PropertyList
Class for storing ordered metadata with comments.
Definition: PropertyList.h:68
lsst.pex.config.history.format
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
lsst.pipe.base.argumentParser.getTaskDict
def getTaskDict(config, taskDict=None, baseName="")
Definition: argumentParser.py:921
lsst.pipe.tasks.assembleCoadd.run
def run(self, skyInfo, tempExpRefList, imageScalerList, weightList, altMaskList=None, mask=None, supplementaryData=None)
Definition: assembleCoadd.py:720
lsst.pipe.base.timer.logInfo
def logInfo(obj, prefix, logLevel=Log.DEBUG)
Definition: timer.py:62
lsst::afw::math::Random
A class that can be used to generate sequences of random numbers according to a number of different a...
Definition: Random.h:57
items
std::vector< SchemaItem< Flag > > * items
Definition: BaseColumnView.cc:142
lsst::afw::math::offsetImage
std::shared_ptr< ImageT > offsetImage(ImageT const &image, float dx, float dy, std::string const &algorithmName="lanczos5", unsigned int buffer=0)
Return an image offset by (dx, dy) using the specified algorithm.
Definition: offsetImage.cc:41
lsst::daf::base::PropertySet
Class for storing generic metadata.
Definition: PropertySet.h:67
set
daf::base::PropertySet * set
Definition: fits.cc:912