LSST Applications g04c3c9f7ca+2075667efa,g1e125bf412+5f448d5fcf,g2079a07aa2+3e9fd84d81,g2305ad1205+b635cf1488,g2bbee38e9b+6c6beb4891,g337abbeb29+6c6beb4891,g33d1c0ed96+6c6beb4891,g3a166c0a6a+6c6beb4891,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+42f171e1e6,g5c3423f6d4+d536b04327,g607f77f49a+d536b04327,g6f43f06aed+ca1339dc19,g858d7b2824+d536b04327,g8ee334c5b4+d7f9608c2f,g9963eaa53e+b3dc1655d3,g998f4353bf+d536b04327,g99cad8db69+8ef2408349,g9ddcbc5298+9a081db1e4,ga1e77700b3+2cbb763275,gadfd92a7e4+aec2f3b930,gae0086650b+585e252eca,gb0e22166c9+0e73c8378f,gb3b7280ab2+cb5fdb229e,gbb8dafda3b+a327199e22,gc120e1dc64+88074880ea,gc28159a63d+6c6beb4891,gcdd4ae20e8+bd241b2308,gcde1bda545+903e937d91,gcf0d15dbbd+bd241b2308,gdaeeff99f8+f9a426f77a,gddc38dedce+585e252eca,ge79ae78c31+6c6beb4891,gfbcc870c63+b310236976,w.2024.23
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Protected Attributes | List of all members
lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve Class Reference
Inheritance diagram for lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve:
lsst.ip.isr.calibType.IsrCalib lsst.ip.isr.transmissionCurve.IntermediateAtmosphereTransmissionCurve lsst.ip.isr.transmissionCurve.IntermediateFilterTransmissionCurve lsst.ip.isr.transmissionCurve.IntermediateOpticsTransmissionCurve lsst.ip.isr.transmissionCurve.IntermediateSensorTransmissionCurve lsst.ip.isr.transmissionCurve.IntermediateSystemTransmissionCurve

Public Member Functions

 __init__ (self, filename=None)
 
 setMetadata (self, metadata)
 
 fromTable (cls, tableList)
 
 setTransmissionCurveRepresentation (self)
 
 getTransmissionCurve (self)
 
 writeFits (self, outputFilename)
 

Public Attributes

 data
 
 transmissionCurve
 
 isSpatiallyConstant
 

Static Protected Attributes

str _OBSTYPE = "transmission_curve"
 
str _SCHEMA = ""
 
float _VERSION = 1.0
 

Detailed Description

Definition for the TransmissionCurve format used as inputs.

Parameters
----------
filename : `str`
    Filename of a transmission curve dataset.

Definition at line 37 of file transmissionCurve.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.__init__ ( self,
filename = None )

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 50 of file transmissionCurve.py.

50 def __init__(self, filename=None):
51 self.data = None
52 self.transmissionCurve = None
53 self.isSpatiallyConstant = True
54 super().__init__()
55
56 # Because we are not persisting this calib as itself, we
57 # should skip adding any other attributes.
58 self.requiredAttributes.update(['isSpatiallyConstant'])
59

Member Function Documentation

◆ fromTable()

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.fromTable ( cls,
tableList )
Construct intermediate transmission curve from a list of input
tables.  Only the first table is used.

Parameters
----------
tableList : `list` [`astropy.table.Table`]
    List containing input tables.

Returns
-------
calib : `lsst.ip.isr.IntermediateTransmissionCurve`
    The final calibration.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 65 of file transmissionCurve.py.

65 def fromTable(cls, tableList):
66 """Construct intermediate transmission curve from a list of input
67 tables. Only the first table is used.
68
69 Parameters
70 ----------
71 tableList : `list` [`astropy.table.Table`]
72 List containing input tables.
73
74 Returns
75 -------
76 calib : `lsst.ip.isr.IntermediateTransmissionCurve`
77 The final calibration.
78 """
79 calib = cls()
80
81 metadata = tableList[0].meta
82 calib.setMetadata(metadata)
83 calib.updateMetadata()
84
85 calib.data = tableList[0]
86 calib.setTransmissionCurveRepresentation()
87 return calib
88

◆ getTransmissionCurve()

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.getTransmissionCurve ( self)

Definition at line 164 of file transmissionCurve.py.

164 def getTransmissionCurve(self):
165 if self.transmissionCurve is None and self.data is None:
166 raise RuntimeError("No transmission curve data found.")
167 if self.transmissionCurve is None:
168 self.setTransmissionCurveRepresentation()
169 return self.transmissionCurve
170

◆ setMetadata()

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.setMetadata ( self,
metadata )
Store a copy of the supplied metadata with this calibration.

Parameters
----------
metadata : `lsst.daf.base.PropertyList`
    Metadata to associate with the calibration.  Will be copied and
    overwrite existing metadata.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 60 of file transmissionCurve.py.

60 def setMetadata(self, metadata):
61 # Inherits from lsst.ip.isr.IsrCalib.setMetadata.
62 super().setMetadata(metadata)
63

◆ setTransmissionCurveRepresentation()

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.setTransmissionCurveRepresentation ( self)
Construct transmission curve representation from the data that was
read.

Raises
------
RuntimeError
    This is raised if no table data exists in the calibration,
    if there are array length mismatches, or if the wavelength
    sampling for multi-amp tables differ.

Definition at line 89 of file transmissionCurve.py.

89 def setTransmissionCurveRepresentation(self):
90 """Construct transmission curve representation from the data that was
91 read.
92
93 Raises
94 ------
95 RuntimeError
96 This is raised if no table data exists in the calibration,
97 if there are array length mismatches, or if the wavelength
98 sampling for multi-amp tables differ.
99 """
100 if self.data is None:
101 raise RuntimeError("No table data was found to convert to a transmission curve!")
102
103 throughputKey = None
104 if 'wavelength' not in self.data.columns:
105 raise RuntimeError("Expected column [wavelength] not found.")
106 if 'efficiency' in self.data.columns:
107 throughputKey = 'efficiency'
108 elif 'throughput' in self.data.columns:
109 throughputKey = 'throughput'
110 else:
111 raise RuntimeError("Expected columns [throughput|efficiency] not found.")
112
113 doAverageCurves = False
114 if 'amp_name' in self.data.columns:
115 doAverageCurves = True
116
117 # These will be used to construct the
118 # ``lsst.afw.image.TransmissionCurve`` object.
119 wavelengths = None
120 throughput = None
121
122 if doAverageCurves:
123 curveStack = None
124 amplifierNames = set(self.data['amp_name'])
125 comparisonIndices = np.where(self.data['amp_name'] == next(iter(amplifierNames)))
126 wavelengths = self.data[comparisonIndices]['wavelength']
127
128 for amplifier in amplifierNames:
129 indices = np.where(self.data['amp_name'] == amplifier)
130 if len(self.data[indices]) != len(self.data[comparisonIndices]):
131 raise RuntimeError("Incompatible lengths in average.")
132 if not np.array_equal(self.data[indices]['wavelength'], wavelengths):
133 raise RuntimeError("Mismatch in wavelength samples.")
134
135 if curveStack is not None:
136 curveStack = np.column_stack((curveStack, self.data[indices][throughputKey]))
137 else:
138 curveStack = self.data[indices][throughputKey]
139 throughput = np.mean(curveStack, 1)
140
141 # This averaging operation has stripped units.
142 throughput = throughput * self.data[throughputKey].unit
143 else:
144 wavelengths = self.data['wavelength']
145 throughput = self.data[throughputKey]
146
147 # Convert units:
148 # import pdb; pdb.set_trace()
149 with cds.enable():
150 # These need to be in Angstroms, for consistency.
151 wavelengths = wavelengths.to(u.Angstrom).to_value()
152
153 if throughput.unit != u.dimensionless_unscaled and throughput.unit != u.UnrecognizedUnit('-'):
154 # These need to be fractions, not percent.
155 throughput = throughput.to(u.dimensionless_unscaled).to_value()
156
157 self.transmissionCurve = TransmissionCurve.makeSpatiallyConstant(
158 throughput.astype(np.float64),
159 wavelengths.astype(np.float64),
160 throughputAtMin=0.0,
161 throughputAtMax=0.0
162 )
163
daf::base::PropertySet * set
Definition fits.cc:931

◆ writeFits()

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.writeFits ( self,
outputFilename )
Write the transmission curve data to a file.

Parameters
----------
outputFilename : `str`
    Destination filename.

Returns
-------
outputFilename : `str`
    The output filename actually used.

Raises
------
RuntimeError
    Raised if no transmission curve can be created.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 171 of file transmissionCurve.py.

171 def writeFits(self, outputFilename):
172 """Write the transmission curve data to a file.
173
174 Parameters
175 ----------
176 outputFilename : `str`
177 Destination filename.
178
179 Returns
180 -------
181 outputFilename : `str`
182 The output filename actually used.
183
184 Raises
185 ------
186 RuntimeError
187 Raised if no transmission curve can be created.
188 """
189 if self.transmissionCurve is None and self.data is None:
190 raise RuntimeError("No transmission curve data found.")
191 if self.transmissionCurve is None:
192 self.setTransmissionCurveRepresentation()
193
194 return self.transmissionCurve.writeFits(outputFilename)
195
196

Member Data Documentation

◆ _OBSTYPE

str lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve._OBSTYPE = "transmission_curve"
staticprotected

Definition at line 46 of file transmissionCurve.py.

◆ _SCHEMA

str lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve._SCHEMA = ""
staticprotected

Definition at line 47 of file transmissionCurve.py.

◆ _VERSION

float lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve._VERSION = 1.0
staticprotected

Definition at line 48 of file transmissionCurve.py.

◆ data

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.data

Definition at line 51 of file transmissionCurve.py.

◆ isSpatiallyConstant

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.isSpatiallyConstant

Definition at line 53 of file transmissionCurve.py.

◆ transmissionCurve

lsst.ip.isr.transmissionCurve.IntermediateTransmissionCurve.transmissionCurve

Definition at line 52 of file transmissionCurve.py.


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