LSSTApplications  19.0.0-14-gb0260a2+64befe7c1c,20.0.0+0b340dd7c4,20.0.0+1540ce6389,20.0.0+7c6b12c2f9,20.0.0+ae956f52c5,20.0.0+be870186d9,20.0.0+e2e26847c2,20.0.0-1-g04bee24+7c6b12c2f9,20.0.0-1-g10df615+fbe45b1aff,20.0.0-1-g253301a+7c6b12c2f9,20.0.0-1-g2b7511a+46a6078777,20.0.0-1-g4d801e7+9d50d6c21a,20.0.0-1-g5b95a8c+8ebfc75efb,20.0.0-1-gb058bd0+46a6078777,20.0.0-1-gb88604f+acecce4127,20.0.0-1-gc96f8cb+016e330d09,20.0.0-1-gedffbd8+83814edeba,20.0.0-10-g0891cd99+a5f14e9acb,20.0.0-10-g9a20bd332+576ca7b471,20.0.0-17-gcdbda88+0e26bfb1e6,20.0.0-2-g4dae9ad+016e330d09,20.0.0-2-g61b8584+85c46248f3,20.0.0-2-gb780d76+f45b7d88f4,20.0.0-21-g9bbb7f7+016e330d09,20.0.0-22-gc512666+f30f3883a7,20.0.0-23-g8900aa8+68630f7098,20.0.0-3-g1653f94+85c46248f3,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g750bffe+e05f822de9,20.0.0-3-gbd60e8c+ff10c6d78d,20.0.0-32-g15a0e07c+a4c9d0309b,20.0.0-4-g97dc21a+68630f7098,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-6-g9a5b7a1+b0f8c2be93,20.0.0-60-gad89340+e4dd172200,20.0.0-7-gcda7bf1+673816f70c,w.2020.43
LSSTDataManagementBasePackage
Classes | Functions
lsst.pipe.drivers.constructCalibs Namespace Reference

Classes

class  BiasConfig
 
class  BiasTask
 
class  CalibArgumentParser
 
class  CalibCombineConfig
 
class  CalibCombineTask
 
class  CalibConfig
 
class  CalibIdAction
 
class  CalibStatsConfig
 
class  CalibStatsTask
 
class  CalibTask
 Base class for constructing calibs. More...
 
class  CalibTaskRunner
 
class  DarkConfig
 
class  DarkTask
 
class  FlatConfig
 
class  FlatTask
 
class  FringeConfig
 
class  FringeTask
 
class  SkyConfig
 
class  SkyTask
 

Functions

def getSize (dimList)
 
def dictToTuple (dict_, keys)
 Return a tuple of specific values from a dict. More...
 
def getCcdIdListFromExposures (expRefList, level="sensor", ccdKeys=["ccd"])
 Determine a list of CCDs from exposure references. More...
 
def mapToMatrix (pool, func, ccdIdLists, *args, **kwargs)
 

Function Documentation

◆ dictToTuple()

def lsst.pipe.drivers.constructCalibs.dictToTuple (   dict_,
  keys 
)

Return a tuple of specific values from a dict.

This provides a hashable representation of the dict from certain keywords. This can be useful for creating e.g., a tuple of the values in the DataId that identify the CCD.

Parameters
dict_dict to parse
keyskeys to extract (order is important)
Returns
tuple of values

Definition at line 185 of file constructCalibs.py.

185 def dictToTuple(dict_, keys):
186  """!Return a tuple of specific values from a dict
187 
188  This provides a hashable representation of the dict from certain keywords.
189  This can be useful for creating e.g., a tuple of the values in the DataId
190  that identify the CCD.
191 
192  @param dict_ dict to parse
193  @param keys keys to extract (order is important)
194  @return tuple of values
195  """
196  return tuple(dict_[k] for k in keys)
197 
198 

◆ getCcdIdListFromExposures()

def lsst.pipe.drivers.constructCalibs.getCcdIdListFromExposures (   expRefList,
  level = "sensor",
  ccdKeys = ["ccd"] 
)

Determine a list of CCDs from exposure references.

This essentially inverts the exposure-level references (which provides a list of CCDs for each exposure), by providing a dataId list for each CCD. Consider an input list of exposures [e1, e2, e3], and each exposure has CCDs c1 and c2. Then this function returns:

{(c1,): [e1c1, e2c1, e3c1], (c2,): [e1c2, e2c2, e3c2]}

This is a dict whose keys are tuples of the identifying values of a CCD (usually just the CCD number) and the values are lists of dataIds for that CCD in each exposure. A missing dataId is given the value None.

Parameters
expRefListList of data references for exposures
levelLevel for the butler to generate CCDs
ccdKeysDataId keywords that identify a CCD
Returns
dict of data identifier lists for each CCD; keys are values of ccdKeys in order

Definition at line 199 of file constructCalibs.py.

199 def getCcdIdListFromExposures(expRefList, level="sensor", ccdKeys=["ccd"]):
200  """!Determine a list of CCDs from exposure references
201 
202  This essentially inverts the exposure-level references (which
203  provides a list of CCDs for each exposure), by providing
204  a dataId list for each CCD. Consider an input list of exposures
205  [e1, e2, e3], and each exposure has CCDs c1 and c2. Then this
206  function returns:
207 
208  {(c1,): [e1c1, e2c1, e3c1], (c2,): [e1c2, e2c2, e3c2]}
209 
210  This is a dict whose keys are tuples of the identifying values of a
211  CCD (usually just the CCD number) and the values are lists of dataIds
212  for that CCD in each exposure. A missing dataId is given the value
213  None.
214 
215  @param expRefList List of data references for exposures
216  @param level Level for the butler to generate CCDs
217  @param ccdKeys DataId keywords that identify a CCD
218  @return dict of data identifier lists for each CCD;
219  keys are values of ccdKeys in order
220  """
221  expIdList = [[ccdRef.dataId for ccdRef in expRef.subItems(
222  level)] for expRef in expRefList]
223 
224  # Determine what additional keys make a CCD from an exposure
225  if len(ccdKeys) != len(set(ccdKeys)):
226  raise RuntimeError("Duplicate keys found in ccdKeys: %s" % ccdKeys)
227  ccdNames = set() # Set of tuples which are values for each of the CCDs in an exposure
228  for ccdIdList in expIdList:
229  for ccdId in ccdIdList:
230  name = dictToTuple(ccdId, ccdKeys)
231  ccdNames.add(name)
232 
233  # Turn the list of CCDs for each exposure into a list of exposures for
234  # each CCD
235  ccdLists = {}
236  for n, ccdIdList in enumerate(expIdList):
237  for ccdId in ccdIdList:
238  name = dictToTuple(ccdId, ccdKeys)
239  if name not in ccdLists:
240  ccdLists[name] = []
241  ccdLists[name].append(ccdId)
242 
243  for ccd in ccdLists:
244  # Sort the list by the dataId values (ordered by key)
245  ccdLists[ccd] = sorted(ccdLists[ccd], key=lambda dd: dictToTuple(dd, sorted(dd.keys())))
246 
247  return ccdLists
248 
249 

◆ getSize()

def lsst.pipe.drivers.constructCalibs.getSize (   dimList)
Determine a consistent size, given a list of image sizes

Definition at line 176 of file constructCalibs.py.

176 def getSize(dimList):
177  """Determine a consistent size, given a list of image sizes"""
178  dim = set((w, h) for w, h in dimList)
179  dim.discard(None)
180  if len(dim) != 1:
181  raise RuntimeError("Inconsistent dimensions: %s" % dim)
182  return dim.pop()
183 
184 

◆ mapToMatrix()

def lsst.pipe.drivers.constructCalibs.mapToMatrix (   pool,
  func,
  ccdIdLists,
args,
**  kwargs 
)
Generate a matrix of results using pool.map

The function should have the call signature:
    func(cache, dataId, *args, **kwargs)

We return a dict mapping 'ccd name' to a list of values for
each exposure.

@param pool  Process pool
@param func  Function to call for each dataId
@param ccdIdLists  Dict of data identifier lists for each CCD name
@return matrix of results

Definition at line 250 of file constructCalibs.py.

250 def mapToMatrix(pool, func, ccdIdLists, *args, **kwargs):
251  """Generate a matrix of results using pool.map
252 
253  The function should have the call signature:
254  func(cache, dataId, *args, **kwargs)
255 
256  We return a dict mapping 'ccd name' to a list of values for
257  each exposure.
258 
259  @param pool Process pool
260  @param func Function to call for each dataId
261  @param ccdIdLists Dict of data identifier lists for each CCD name
262  @return matrix of results
263  """
264  dataIdList = sum(ccdIdLists.values(), [])
265  resultList = pool.map(func, dataIdList, *args, **kwargs)
266  # Piece everything back together
267  data = dict((ccdName, [None] * len(expList)) for ccdName, expList in ccdIdLists.items())
268  indices = dict(sum([[(tuple(dataId.values()) if dataId is not None else None, (ccdName, expNum))
269  for expNum, dataId in enumerate(expList)]
270  for ccdName, expList in ccdIdLists.items()], []))
271  for dataId, result in zip(dataIdList, resultList):
272  if dataId is None:
273  continue
274  ccdName, expNum = indices[tuple(dataId.values())]
275  data[ccdName][expNum] = result
276  return data
277 
278 
lsst.pipe.drivers.constructCalibs.getCcdIdListFromExposures
def getCcdIdListFromExposures(expRefList, level="sensor", ccdKeys=["ccd"])
Determine a list of CCDs from exposure references.
Definition: constructCalibs.py:199
ast::append
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33
lsst.pipe.drivers.constructCalibs.dictToTuple
def dictToTuple(dict_, keys)
Return a tuple of specific values from a dict.
Definition: constructCalibs.py:185
lsst.pipe.drivers.constructCalibs.mapToMatrix
def mapToMatrix(pool, func, ccdIdLists, *args, **kwargs)
Definition: constructCalibs.py:250
set
daf::base::PropertySet * set
Definition: fits.cc:912
lsst.pipe.drivers.constructCalibs.getSize
def getSize(dimList)
Definition: constructCalibs.py:176