AmpOffsetTask¶
- class lsst.ip.isr.AmpOffsetTask(*args, **kwargs)¶
Bases:
Task
Calculate and apply amp offset corrections to an exposure.
Methods Summary
Empty (clear) the metadata for this Task and all sub-Tasks.
getAmpAssociations
(amps)Determine amp geometry and amp associations from a list of amplifiers.
getAmpEdges
(im, amps, ampSides)Calculate the amp edges for all amplifiers.
getAmpOffsets
(im, amps, associations, sides)Calculate the amp offsets for all amplifiers.
Get metadata for all tasks.
Get the task name as a hierarchical name including parent task names.
getInterfaceOffset
(ampNameA, ampNameB, ...)Calculate the amp offset for a given interface between two amplifiers.
getName
()Get the name of the task.
getNeighbors
(ampIds, ampId)Get the neighbor amplifiers and their sides for a given amplifier.
Get a dictionary of all tasks as a shallow copy.
makeField
(doc)Make a
lsst.pex.config.ConfigurableField
for this task.makeSubtask
(name, **keyArgs)Create a subtask as a new instance as the
name
attribute of this task.run
(exposure)Calculate amp offset values, determine corrective pedestals for each amp, and update the input exposure in-place.
timer
(name[, logLevel])Context manager to log performance data for an arbitrary block of code.
Methods Documentation
- getAmpAssociations(amps)¶
Determine amp geometry and amp associations from a list of amplifiers.
Parse an input list of amplifiers to determine the layout of amps within a detector, and identify all amp sides (i.e., the horizontal and vertical junctions between amps).
Returns a matrix with a shape corresponding to the geometry of the amps in the detector.
- Parameters:
- amps
list
[lsst.afw.cameraGeom.Amplifier
] List of amplifier objects used to deduce associations.
- amps
- Returns:
- ampAssociations
numpy.ndarray
An N x N matrix (N = number of amplifiers) that illustrates the connections between amplifiers within the detector layout. Each row and column index corresponds to the ampIds of a specific pair of amplifiers, and the matrix elements indicate their associations as follows:
0: No association
-1: Association exists (direction specified in the ampSides matrix)
n >= 1: Diagonal elements indicate the number of neighboring amplifiers for the corresponding ampId==row==column number.
- ampSides
numpy.ndarray
An N x N matrix (N = the number of amplifiers) representing the amp side information corresponding to the
ampAssociations
matrix. The elements are integers defined as below:-1: No side due to no association or the same amp (diagonals)
0: Side on the bottom
1: Side on the right
2: Side on the top
3: Side on the left
- ampAssociations
- getAmpEdges(im, amps, ampSides)¶
Calculate the amp edges for all amplifiers.
- Parameters:
- im
lsst.afw.image._image.ImageF
Amplifier image to extract data from.
- amps
list
[lsst.afw.cameraGeom.Amplifier
] List of amplifier objects.
- ampSides
numpy.ndarray
An N x N matrix containing amp side information, where N is the number of amplifiers.
- im
- Returns:
- ampEdges
dict
[int
,dict
[int
,numpy.ndarray
]] A dictionary containing amp edge(s) for each amplifier, corresponding to one or more potential sides, where each edge is associated with a side. The outer dictionary has integer keys representing amplifier IDs, and the inner dictionary has integer keys representing side IDs for each amplifier and values that are 1D arrays of floats representing the 1D medianified strips from the amp image, referred to as “amp edge”: {ampID: {sideID: numpy.ndarray}, …}
- ampEdges
- getAmpOffsets(im, amps, associations, sides)¶
Calculate the amp offsets for all amplifiers.
- Parameters:
- im
lsst.afw.image._image.ImageF
Amplifier image to extract data from.
- amps
list
[lsst.afw.cameraGeom.Amplifier
] List of amplifier objects.
- associationsnumpy.ndarray
An N x N matrix containing amp association information, where N is the number of amplifiers.
- sidesnumpy.ndarray
An N x N matrix containing amp side information, where N is the number of amplifiers.
- im
- Returns:
- ampsOffsets
numpy.ndarray
1D float array containing the calculated amp offsets for all amplifiers.
- interfaceOffsetDict
dict
[str
,float
] Dictionary mapping interface IDs to their corresponding raw (uncapped) offset values.
- ampsOffsets
- getFullMetadata() TaskMetadata ¶
Get metadata for all tasks.
- Returns:
- metadata
TaskMetadata
The keys are the full task name. Values are metadata for the top-level task and all subtasks, sub-subtasks, etc.
- metadata
Notes
The returned metadata includes timing information (if
@timer.timeMethod
is used) and any metadata set by the task. The name of each item consists of the full task name with.
replaced by:
, followed by.
and the name of the item, e.g.:topLevelTaskName:subtaskName:subsubtaskName.itemName
using
:
in the full task name disambiguates the rare situation that a task has a subtask and a metadata item with the same name.
- getFullName() str ¶
Get the task name as a hierarchical name including parent task names.
- Returns:
- fullName
str
The full name consists of the name of the parent task and each subtask separated by periods. For example:
The full name of top-level task “top” is simply “top”.
The full name of subtask “sub” of top-level task “top” is “top.sub”.
The full name of subtask “sub2” of subtask “sub” of top-level task “top” is “top.sub.sub2”.
- fullName
- getInterfaceOffset(ampNameA, ampNameB, edgeA, edgeB)¶
Calculate the amp offset for a given interface between two amplifiers.
- Parameters:
- ampNameAstr
Name of the first amplifier.
- ampNameBstr
Name of the second amplifier.
- edgeAnumpy.ndarray
Amp edge for the first amplifier.
- edgeBnumpy.ndarray
Amp edge for the second amplifier.
- Returns:
- interfaceOffsetfloat
The calculated amp offset value for the given interface between amps A and B.
- interfaceOffsetOriginalfloat
The original calculated amp offset value for the given interface between amps A and B.
- ampEdgeGoodFracfloat
Fraction of viable pixel rows along the amp edge.
- minFracFailbool
True if the fraction of unmasked pixel rows is below the ampEdgeMinFrac threshold.
- maxOffsetFailbool
True if the absolute offset value exceeds the ampEdgeMaxOffset threshold.
- getName() str ¶
Get the name of the task.
- Returns:
- taskName
str
Name of the task.
- taskName
See also
getFullName
Get the full name of the task.
- getNeighbors(ampIds, ampId)¶
Get the neighbor amplifiers and their sides for a given amplifier.
- Parameters:
- ampIds
numpy.ndarray
Matrix with amp side association information.
- ampId
int
The amplifier ID for which neighbor amplifiers and side IDs are to be found.
- ampIds
- Returns:
- getTaskDict() dict[str, weakref.ReferenceType[lsst.pipe.base.task.Task]] ¶
Get a dictionary of all tasks as a shallow copy.
- Returns:
- taskDict
dict
Dictionary containing full task name: task object for the top-level task and all subtasks, sub-subtasks, etc.
- taskDict
- classmethod makeField(doc: str) ConfigurableField ¶
Make a
lsst.pex.config.ConfigurableField
for this task.- Parameters:
- doc
str
Help text for the field.
- doc
- Returns:
- configurableField
lsst.pex.config.ConfigurableField
A
ConfigurableField
for this task.
- configurableField
Examples
Provides a convenient way to specify this task is a subtask of another task.
Here is an example of use:
class OtherTaskConfig(lsst.pex.config.Config): aSubtask = ATaskClass.makeField("brief description of task")
- makeSubtask(name: str, **keyArgs: Any) None ¶
Create a subtask as a new instance as the
name
attribute of this task.- Parameters:
- name
str
Brief name of the subtask.
- **keyArgs
Extra keyword arguments used to construct the task. The following arguments are automatically provided and cannot be overridden:
config
.parentTask
.
- name
Notes
The subtask must be defined by
Task.config.name
, an instance ofConfigurableField
orRegistryField
.
- run(exposure)¶
Calculate amp offset values, determine corrective pedestals for each amp, and update the input exposure in-place.
- Parameters:
- exposure: `lsst.afw.image.Exposure`
Exposure to be corrected for amp offsets.