LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | List of all members
lsst.fgcmcal.dataIds.TractCheckDataIdContainer Class Reference
Inheritance diagram for lsst.fgcmcal.dataIds.TractCheckDataIdContainer:

Public Member Functions

def castDataIds (self, butler)
 
def makeDataRefList (self, namespace)
 

Detailed Description

A version of lsst.pipe.base.DataIdContainer that ensures that tract
is additionally set with sourceTable_visit catalogs.

Definition at line 30 of file dataIds.py.

Member Function Documentation

◆ castDataIds()

def lsst.fgcmcal.dataIds.TractCheckDataIdContainer.castDataIds (   self,
  butler 
)
Validate data IDs and cast them to the correct type
(modify self.idList in place).

This code casts the values in the data IDs dicts in `self.idList`
to the type required by the butler. Data IDs are read from the
command line as `str`, but the butler requires some values to be
other types. For example "visit" values should be `int` (which
is defined by the templates).

This is taken from lsst.pipe.base.ArgumentParser.castDataIds(),
adding in a check that the tract is an int, which must be done
explicitly because it is not in the template.

Parameters
----------
butler : `lsst.daf.persistence.Butler`
    Data butler.

Definition at line 36 of file dataIds.py.

36  def castDataIds(self, butler):
37  """Validate data IDs and cast them to the correct type
38  (modify self.idList in place).
39 
40  This code casts the values in the data IDs dicts in `self.idList`
41  to the type required by the butler. Data IDs are read from the
42  command line as `str`, but the butler requires some values to be
43  other types. For example "visit" values should be `int` (which
44  is defined by the templates).
45 
46  This is taken from lsst.pipe.base.ArgumentParser.castDataIds(),
47  adding in a check that the tract is an int, which must be done
48  explicitly because it is not in the template.
49 
50  Parameters
51  ----------
52  butler : `lsst.daf.persistence.Butler`
53  Data butler.
54  """
55  datasetType = 'sourceTable_visit'
56  try:
57  idKeyTypeDict = butler.getKeys(datasetType=datasetType, level=self.level)
58  except KeyError as e:
59  msg = f"Cannot get keys for datasetType {datasetType} at level {self.level}"
60  raise KeyError(msg) from e
61 
62  idKeyTypeDict = idKeyTypeDict.copy()
63  idKeyTypeDict['tract'] = int
64 
65  log = None
66 
67  for dataDict in self.idList:
68  for key, strVal in dataDict.items():
69  try:
70  keyType = idKeyTypeDict[key]
71  except KeyError:
72  # OK, assume that it's a valid key and guess that it's a string
73  keyType = str
74 
75  if log is None:
76  log = lsstLog.Log.getDefaultLogger()
77  log.warning("Unexpected ID %s; guessing type is \"%s\"",
78  key, 'str' if keyType == str else keyType)
79  idKeyTypeDict[key] = keyType
80 
81  if keyType != str:
82  try:
83  castVal = keyType(strVal)
84  except Exception:
85  raise TypeError(f"Cannot cast value {strVal!r} to {keyType} for ID key {key}")
86  dataDict[key] = castVal
87 

◆ makeDataRefList()

def lsst.fgcmcal.dataIds.TractCheckDataIdContainer.makeDataRefList (   self,
  namespace 
)

Definition at line 88 of file dataIds.py.

88  def makeDataRefList(self, namespace):
89  if self.datasetType is None:
90  raise RuntimeError("Must call setDatasetType first")
91 
92  tracts = set()
93  for dataId in self.idList:
94  if "tract" not in dataId:
95  raise RuntimeError("Must set tract for dataId")
96  tracts.add(dataId['tract'])
97 
98  self.refList.append(namespace.butler.dataRef(datasetType=self.datasetType,
99  dataId=dataId))
100 
101  if len(tracts) > 1:
102  raise RuntimeError("Can only run a single tract")
daf::base::PropertySet * set
Definition: fits.cc:912
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33

The documentation for this class was generated from the following file: