22Gain correction storage class.
25__all__ = [
"GainCorrection"]
27from astropy.table
import Table
34 """Gain correction parameters.
38 ampNames : `list` [`str`]
39 List of amplifier names.
40 gainAdjustments : `list` [`float`]
41 List of gain adjustment parameters.
43 Additional parameters.
46 _OBSTYPE =
"gainCorrection"
47 _SCHEMA =
"GainCorrection"
50 def __init__(self, ampNames=[], gainAdjustments=[], **kwargs):
51 if len(ampNames) != len(gainAdjustments):
52 raise ValueError(
"Number of ampNames must be the same as number of gainAdjustments.")
68 """Set the parameters for the gain correction model.
72 ampNames : `list` [`str`]
73 List of amplifier names.
74 gainAdjustments : `list` [`float`]
75 List of gain adjustment parameters.
77 if len(ampNames) != len(gainAdjustments):
78 raise ValueError(
"Number of ampNames must be the same as number of gainAdjustments.")
85 """Construct a GainCorrection from a dictionary of properties.
90 Dictionary of properties.
94 calib : `lsst.ip.isr.GainCorrection`
95 Constructed calibration.
99 calib.setMetadata(dictionary[
"metadata"])
101 calib.ampNames = dictionary[
"ampNames"]
102 calib.gainAdjustments = np.asarray(dictionary[
"gainAdjustments"])
104 calib.updateMetadata()
108 """Return a dictionary containing the calibration properties.
113 Dictionary of properties.
119 outDict[
"metadata"] = metadata
128 """Construct a calibration from a list of tables.
132 tableList : `list` [`astropy.table.Table`]
133 List of table(s) to use to construct the GainCorrection.
137 calib : `lsst.ip.isr.GainCorrection`
138 The calibration defined in the table(s).
140 gainCorrectionTable = tableList[0]
144 inDict[
"metadata"] = gainCorrectionTable.meta
145 inDict[
"ampNames"] = list(gainCorrectionTable[
"AMP_NAME"])
146 inDict[
"gainAdjustments"] = np.asarray(gainCorrectionTable[
"GAIN_ADJUSTMENT"], dtype=np.float64)
151 """Construct a list of table(s) containing the GainCorrection data.
155 tableList : `list` [`astropy.table.Table`]
156 List of tables containing the GainCorrection information.
166 outMeta = {k: v
for k, v
in inMeta.items()
if v
is not None}
167 outMeta.update({k:
"" for k, v
in inMeta.items()
if v
is None})
168 catalog.meta = outMeta
169 tableList.append(catalog)
174 """Correct a dictionary of gains (in place).
178 gains : `dict` [`str`, `float`]
179 Array of gains to correct.
180 exposure : `lsst.afw.image.Exposure`, optional
181 Exposure with additional metadata for correction.
183 for i, ampName
in enumerate(self.
ampNames):
updateMetadata(self, camera=None, detector=None, filterName=None, setCalibId=False, setCalibInfo=False, setDate=False, **kwargs)
setParameters(self, *, ampNames=[], gainAdjustments=[])
__init__(self, ampNames=[], gainAdjustments=[], **kwargs)
fromTable(cls, tableList)
fromDict(cls, dictionary)
correctGains(self, gains, exposure=None)