lsst.ip.isr
19.0.0-24-g923e380+10
|
Public Member Functions | |
def | __init__ (self, table=None, detector=None, override=False, log=None) |
def | __call__ (self, exposure) |
def | fromDetector (self, detector) |
def | fromYaml (self, yamlObject) |
def | toDict (self) |
def | readText (cls, filename) |
def | writeText (self, filename) |
def | fromTable (cls, table, tableExtTwo=None) |
def | readFits (cls, filename) |
def | toAmpTable (self, metadata) |
def | toTableDataTable (self, metadata) |
def | writeFits (self, filename) |
def | getMetadata (self) |
def | setMetadata (self, metadata=None) |
def | updateMetadata (self, date=None, detectorId=None, detectorName=None, instrumentName=None, calibId=None, serial=None) |
def | getLinearityTypeByName (self, linearityTypeName) |
def | validate (self, detector=None, amplifier=None) |
def | applyLinearity (self, image, detector=None, log=None) |
Public Attributes | |
linearityCoeffs | |
linearityType | |
linearityThreshold | |
linearityMaximum | |
linearityUnits | |
linearityBBox | |
override | |
populated | |
log | |
tableData | |
Parameter set for linearization. These parameters are included in cameraGeom.Amplifier, but should be accessible externally to allow for testing. Parameters ---------- table : `numpy.array`, optional Lookup table; a 2-dimensional array of floats: - one row for each row index (value of coef[0] in the amplifier) - one column for each image value To avoid copying the table the last index should vary fastest (numpy default "C" order) detector : `lsst.afw.cameraGeom.Detector` Detector object override : `bool`, optional Override the parameters defined in the detector/amplifier. log : `lsst.log.Log`, optional Logger to handle messages. Raises ------ RuntimeError : Raised if the supplied table is not 2D, or if the table has fewer columns than rows (indicating that the indices are swapped).
Definition at line 40 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.__init__ | ( | self, | |
table = None , |
|||
detector = None , |
|||
override = False , |
|||
log = None |
|||
) |
Definition at line 71 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.__call__ | ( | self, | |
exposure | |||
) |
Apply linearity, setting parameters if necessary. Parameters ---------- exposure : `lsst.afw.image.Exposure` Exposure to correct. Returns ------- output : `lsst.pipe.base.Struct` Linearization results: ``"numAmps"`` Number of amplifiers considered. ``"numLinearized"`` Number of amplifiers linearized.
Definition at line 99 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.applyLinearity | ( | self, | |
image, | |||
detector = None , |
|||
log = None |
|||
) |
Apply the linearity to an image. If the linearity parameters are populated, use those, otherwise use the values from the detector. Parameters ---------- image : `~lsst.afw.image.image` Image to correct. detector : `~lsst.afw.cameraGeom.detector` Detector to use for linearity parameters if not already populated. log : `~lsst.log.Log`, optional Log object to use for logging.
Definition at line 575 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.fromDetector | ( | self, | |
detector | |||
) |
Read linearity parameters from a detector. Parameters ---------- detector : `lsst.afw.cameraGeom.detector` Input detector with parameters to use.
Definition at line 117 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.fromTable | ( | cls, | |
table, | |||
tableExtTwo = None |
|||
) |
Read linearity from a FITS file. Parameters ---------- table : `lsst.afw.table` afwTable read from input file name. tableExtTwo: `lsst.afw.table`, optional afwTable read from second extension of input file name Returns ------- linearity : `~lsst.ip.isr.linearize.Linearizer`` Linearity parameters. Notes ----- The method reads a FITS file with 1 or 2 extensions. The metadata is read from the header of extension 1, which must exist. Then the table is loaded, and the ['AMPLIFIER_NAME', 'TYPE', 'COEFFS', 'BBOX_X0', 'BBOX_Y0', 'BBOX_DX', 'BBOX_DY'] columns are read and used to set each dictionary by looping over rows. Eextension 2 is then attempted to read in the try block (which only exists for lookup tables). It has a column named 'LOOKUP_VALUES' that contains a vector of the lookup entries in each row.
Definition at line 242 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.fromYaml | ( | self, | |
yamlObject | |||
) |
Read linearity parameters from a dict. Parameters ---------- yamlObject : `dict` Dictionary containing detector and amplifier information.
Definition at line 137 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.getLinearityTypeByName | ( | self, | |
linearityTypeName | |||
) |
Determine the linearity class to use from the type name. Parameters ---------- linearityTypeName : str String name of the linearity type that is needed. Returns ------- linearityType : `~lsst.ip.isr.linearize.LinearizeBase` The appropriate linearity class to use. If no matching class is found, `None` is returned.
Definition at line 495 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.getMetadata | ( | self | ) |
Retrieve metadata associated with this `Linearizer`. Returns ------- meta : `lsst.daf.base.PropertyList` Metadata. The returned `~lsst.daf.base.PropertyList` can be modified by the caller and the changes will be written to external files.
Definition at line 431 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.readFits | ( | cls, | |
filename | |||
) |
Read linearity from a FITS file. Parameters ---------- filename : `str` Name of the file containing the linearity definition. Returns ------- linearity : `~lsst.ip.isr.linearize.Linearizer`` Linearity parameters. Notes ----- This method and `fromTable` read a FITS file with 1 or 2 extensions. The metadata is read from the header of extension 1, which must exist. Then the table is loaded, and the ['AMPLIFIER_NAME', 'TYPE', 'COEFFS', 'BBOX_X0', 'BBOX_Y0', 'BBOX_DX', 'BBOX_DY'] columns are read and used to set each dictionary by looping over rows. Extension 2 is then attempted to read in the try block (which only exists for lookup tables). It has a column named 'LOOKUP_VALUES' that contains a vector of the lookup entries in each row.
Definition at line 305 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.readText | ( | cls, | |
filename | |||
) |
Read linearity from text file. Parameters ---------- filename : `str` Name of the file containing the linearity definition. Returns ------- linearity : `~lsst.ip.isr.linearize.Linearizer`` Linearity parameters.
Definition at line 192 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.setMetadata | ( | self, | |
metadata = None |
|||
) |
Store a copy of the supplied metadata with the `Linearizer`. Parameters ---------- metadata : `lsst.daf.base.PropertyList`, optional Metadata to associate with the linearizer. Will be copied and overwrite existing metadata. If not supplied the existing metadata will be reset.
Definition at line 443 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.toAmpTable | ( | self, | |
metadata | |||
) |
Produce linearity catalog Parameters ---------- metadata : `lsst.daf.base.PropertyList` Linearizer metadata Returns ------- catalog : `lsst.afw.table.BaseCatalog` Catalog to write
Definition at line 334 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.toDict | ( | self | ) |
Return linearity parameters as a dict. Returns ------- outDict : `dict`:
Definition at line 165 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.toTableDataTable | ( | self, | |
metadata | |||
) |
Produce linearity catalog from table data Parameters ---------- metadata : `lsst.daf.base.PropertyList` Linearizer metadata Returns ------- catalog : `lsst.afw.table.BaseCatalog` Catalog to write
Definition at line 377 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.updateMetadata | ( | self, | |
date = None , |
|||
detectorId = None , |
|||
detectorName = None , |
|||
instrumentName = None , |
|||
calibId = None , |
|||
serial = None |
|||
) |
Update metadata keywords with new values. Parameters ---------- date : `datetime.datetime`, optional detectorId : `int`, optional detectorName: `str`, optional instrumentName : `str`, optional calibId: `str`, optional serial: detector serial, `str`, optional
Definition at line 461 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.validate | ( | self, | |
detector = None , |
|||
amplifier = None |
|||
) |
Validate linearity for a detector/amplifier. Parameters ---------- detector : `lsst.afw.cameraGeom.Detector`, optional Detector to validate, along with its amplifiers. amplifier : `lsst.afw.cameraGeom.Amplifier`, optional Single amplifier to validate. Raises ------ RuntimeError : Raised if there is a mismatch in linearity parameters, and the cameraGeom parameters are not being overridden.
Definition at line 518 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.writeFits | ( | self, | |
filename | |||
) |
Write the linearity model to a FITS file. Parameters ---------- filename : `str` Name of the file to write. Notes ----- The file is written to YAML format and will include any metadata associated with the `Linearity`.
Definition at line 406 of file linearize.py.
def lsst.ip.isr.linearize.Linearizer.writeText | ( | self, | |
filename | |||
) |
Write the linearity model to a text file. Parameters ---------- filename : `str` Name of the file to write. Returns ------- used : `str` The name of the file used to write the data. Raises ------ RuntimeError : Raised if filename does not end in ".yaml". Notes ----- The file is written to YAML format and will include any metadata associated with the `Linearity`.
Definition at line 209 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.linearityBBox |
Definition at line 82 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.linearityCoeffs |
Definition at line 77 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.linearityMaximum |
Definition at line 80 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.linearityThreshold |
Definition at line 79 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.linearityType |
Definition at line 78 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.linearityUnits |
Definition at line 81 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.log |
Definition at line 86 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.override |
Definition at line 84 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.populated |
Definition at line 85 of file linearize.py.
lsst.ip.isr.linearize.Linearizer.tableData |
Definition at line 88 of file linearize.py.