LSSTApplications  17.0+115,17.0+12,17.0+65,18.0.0+14,18.0.0+29,18.0.0+6,18.0.0+70,18.0.0-4-g68ffd23+1,18.1.0-1-g0001055+9,18.1.0-1-g03d53ef+2,18.1.0-1-g1349e88+44,18.1.0-1-g2505f39+35,18.1.0-1-g5315e5e+2,18.1.0-1-g5e4b7ea+11,18.1.0-1-g7e8fceb+2,18.1.0-1-g85f8cd4+38,18.1.0-1-gd55f500+25,18.1.0-13-gfe4edf0b,18.1.0-14-g259bd21+9,18.1.0-14-gd04256d+35,18.1.0-2-g4903023+12,18.1.0-2-g5f9922c+13,18.1.0-2-gd3b74e5+3,18.1.0-2-gfbf3545+22,18.1.0-2-gfefb8b5+34,18.1.0-22-g936f6a9b4,18.1.0-23-g364d03b8,18.1.0-23-g52ab674,18.1.0-3-g52aa583+17,18.1.0-3-g8f4a2b1+32,18.1.0-3-gb69f684+30,18.1.0-4-g1ee41a7+2,18.1.0-5-g6dbcb01+31,18.1.0-5-gc286bb7+4,18.1.0-6-g857e778+4,18.1.0-7-gae09a6d+18,18.1.0-8-g42b2ab3+10,18.1.0-8-gc69d46e+17,18.1.0-9-gee19f03+2,w.2019.44
LSSTDataManagementBasePackage
Public Member Functions | List of all members
lsst.afw.cameraGeom.fitsUtils.HeaderAmpMap Class Reference
Inheritance diagram for lsst.afw.cameraGeom.fitsUtils.HeaderAmpMap:
lsst.afw.cameraGeom.fitsUtils.HeaderMap

Public Member Functions

def addEntry (self, keyname, attribute_name, default=None, transform=lambda x:x)
 
def setAttributes (self, obj, metadata, doRaise=True)
 

Detailed Description

Class to hold mapping of header cards to AmpInfoTable attributes
    The amp info is stored using setters, thus calling the attribute as a function.

Definition at line 137 of file fitsUtils.py.

Member Function Documentation

◆ addEntry()

def lsst.afw.cameraGeom.fitsUtils.HeaderMap.addEntry (   self,
  keyname,
  attribute_name,
  default = None,
  transform = lambda x: x 
)
inherited
Adds an entry to the registry.

Parameters
----------
keyname : `str`
    Key used to retrieve the header record.
attribute_name : `str`
    Name of the attribute to store the value in.
default : `object`
    Default value to store if the header card is not available.
transform : `callable`
    Transform to apply to the header value before assigning it to the
    attribute.

Definition at line 81 of file fitsUtils.py.

81  def addEntry(self, keyname, attribute_name, default=None, transform=lambda x: x):
82  """Adds an entry to the registry.
83 
84  Parameters
85  ----------
86  keyname : `str`
87  Key used to retrieve the header record.
88  attribute_name : `str`
89  Name of the attribute to store the value in.
90  default : `object`
91  Default value to store if the header card is not available.
92  transform : `callable`
93  Transform to apply to the header value before assigning it to the
94  attribute.
95  """
96  self.__setitem__(attribute_name, {'keyName': keyname,
97  'default': default,
98  'transform': transform})
99 

◆ setAttributes()

def lsst.afw.cameraGeom.fitsUtils.HeaderMap.setAttributes (   self,
  obj,
  metadata,
  doRaise = True 
)
inherited
Sets the attributes on the given object given a metadata object.

Parameters
----------
obj : `object`
    Object on which to operate in place.
metadata : `lsst.daf.base.PropertySet`
    Metadata object used for applying the mapping.
doRaise : `bool`
    Raise exceptions on calling methods on the input object that
    do not exist?

Definition at line 100 of file fitsUtils.py.

100  def setAttributes(self, obj, metadata, doRaise=True):
101  """Sets the attributes on the given object given a metadata object.
102 
103  Parameters
104  ----------
105  obj : `object`
106  Object on which to operate in place.
107  metadata : `lsst.daf.base.PropertySet`
108  Metadata object used for applying the mapping.
109  doRaise : `bool`
110  Raise exceptions on calling methods on the input object that
111  do not exist?
112  """
113  for key, attrDict in self.items():
114  try:
115  value = getByKey(metadata, attrDict['keyName'])
116  # if attrDict['keyName'] == "RDCRNR" and value == 0:
117  # import ipdb; ipdb.set_trace()
118  if value is not None:
119  self._applyVal(obj, value, key, attrDict['transform'])
120  else:
121  # Only apply transform if the metadata has a value for this key
122  # otherwise assume the default value is transformed.
123  value = attrDict['default']
124  if value is not None:
125  self._applyVal(obj, value, key, lambda x: x)
126  except Exception as e:
127  if doRaise:
128  raise
129  else:
130  warnings.warn('WARNING: Failed to set %s attribute with %s value: %s' %
131  (key, value, str(e)))
132 
def getByKey(metadata, key)
Definition: fitsUtils.py:36

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