LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
lsst.afw.math.warper.Warper Class Reference
Inheritance diagram for lsst.afw.math.warper.Warper:

Public Member Functions

def __init__
 
def fromConfig
 
def getWarpingKernel
 
def getMaskWarpingKernel
 
def warpExposure
 
def warpImage
 

Static Public Attributes

 ConfigClass = WarperConfig
 

Private Member Functions

def _computeDestBBox
 

Private Attributes

 _warpingControl
 

Detailed Description

Warp images

Definition at line 98 of file warper.py.

Constructor & Destructor Documentation

def lsst.afw.math.warper.Warper.__init__ (   self,
  warpingKernelName,
  interpLength = _DefaultInterpLength,
  cacheSize = _DefaultCacheSize,
  maskWarpingKernelName = "",
  devicePreference = afwGpu.DEFAULT_DEVICE_PREFERENCE,
  growFullMask = afwImage.MaskU.getPlaneBitMask("EDGE") 
)
Create a Warper

Inputs:
- warpingKernelName: argument to lsst.afw.math.makeWarpingKernel
- interpLength: interpLength argument to lsst.afw.warpExposure
- cacheSize: size of computeCache
- maskWarpingKernelName: name of mask warping kernel (if "" then use warpingKernelName);
    an argument to lsst.afw.math.makeWarpingKernel

Definition at line 109 of file warper.py.

110  ):
111  """Create a Warper
112 
113  Inputs:
114  - warpingKernelName: argument to lsst.afw.math.makeWarpingKernel
115  - interpLength: interpLength argument to lsst.afw.warpExposure
116  - cacheSize: size of computeCache
117  - maskWarpingKernelName: name of mask warping kernel (if "" then use warpingKernelName);
118  an argument to lsst.afw.math.makeWarpingKernel
119  """
120  self._warpingControl = mathLib.WarpingControl(
121  warpingKernelName, maskWarpingKernelName, cacheSize, interpLength, devicePreference, growFullMask)

Member Function Documentation

def lsst.afw.math.warper.Warper._computeDestBBox (   self,
  destWcs,
  srcImage,
  srcWcs,
  border,
  maxBBox,
  destBBox 
)
private
Process destBBox argument for warpImage and warpExposure

@param destWcs: WCS of warped image
@param srcImage: image or masked image to warp
@param srcWcs: WCS of image
@param border: grow bbox of warped image by this amount in all directions (int pixels);
    if negative then the bbox is shrunk;
    border is applied before maxBBox;
    ignored if destBBox is not None
@param maxBBox: maximum allowed parent bbox of warped image (an afwGeom.Box2I or None);
    if None then the warped image will be just big enough to contain all warped pixels;
    if provided then the warped image may be smaller, and so missing some warped pixels;
    ignored if destBBox is not None
@param destBBox: exact parent bbox of warped image (an afwGeom.Box2I or None);
    if None then border and maxBBox are used to determine the bbox,
    otherwise border and maxBBox are ignored

Definition at line 211 of file warper.py.

212  def _computeDestBBox(self, destWcs, srcImage, srcWcs, border, maxBBox, destBBox):
213  """Process destBBox argument for warpImage and warpExposure
214 
215  @param destWcs: WCS of warped image
216  @param srcImage: image or masked image to warp
217  @param srcWcs: WCS of image
218  @param border: grow bbox of warped image by this amount in all directions (int pixels);
219  if negative then the bbox is shrunk;
220  border is applied before maxBBox;
221  ignored if destBBox is not None
222  @param maxBBox: maximum allowed parent bbox of warped image (an afwGeom.Box2I or None);
223  if None then the warped image will be just big enough to contain all warped pixels;
224  if provided then the warped image may be smaller, and so missing some warped pixels;
225  ignored if destBBox is not None
226  @param destBBox: exact parent bbox of warped image (an afwGeom.Box2I or None);
227  if None then border and maxBBox are used to determine the bbox,
228  otherwise border and maxBBox are ignored
229  """
230  if destBBox is None: # warning: == None fails due to Box2I.__eq__
231  destBBox = computeWarpedBBox(destWcs, srcImage.getBBox(afwImage.PARENT), srcWcs)
232  if border:
233  destBBox.grow(border)
234  if maxBBox is not None:
235  destBBox.clip(maxBBox)
236  return destBBox
def lsst.afw.math.warper.Warper.fromConfig (   cls,
  config 
)
Create a Warper from a config

@param config: an instance of Warper.ConfigClass

Definition at line 123 of file warper.py.

124  def fromConfig(cls, config):
125  """Create a Warper from a config
126 
127  @param config: an instance of Warper.ConfigClass
128  """
129  return cls(
130  warpingKernelName = config.warpingKernelName,
131  maskWarpingKernelName = config.maskWarpingKernelName,
132  interpLength = config.interpLength,
133  cacheSize = config.cacheSize,
134  devicePreference = config.devicePreference,
135  growFullMask = config.growFullMask,
136  )
def lsst.afw.math.warper.Warper.getMaskWarpingKernel (   self)
Get the mask warping kernel

Definition at line 141 of file warper.py.

142  def getMaskWarpingKernel(self):
143  """Get the mask warping kernel"""
144  return self._warpingControl.getMaskWarpingKernel()
def lsst.afw.math.warper.Warper.getWarpingKernel (   self)
Get the warping kernel

Definition at line 137 of file warper.py.

138  def getWarpingKernel(self):
139  """Get the warping kernel"""
140  return self._warpingControl.getWarpingKernel()
def lsst.afw.math.warper.Warper.warpExposure (   self,
  destWcs,
  srcExposure,
  border = 0,
  maxBBox = None,
  destBBox = None 
)
Warp an exposure

@param destWcs: WCS of warped exposure
@param srcExposure: exposure to warp
@param border: grow bbox of warped exposure by this amount in all directions (int pixels);
    if negative then the bbox is shrunk;
    border is applied before maxBBox;
    ignored if destBBox is not None
@param maxBBox: maximum allowed parent bbox of warped exposure (an afwGeom.Box2I or None);
    if None then the warped exposure will be just big enough to contain all warped pixels;
    if provided then the warped exposure may be smaller, and so missing some warped pixels;
    ignored if destBBox is not None
@param destBBox: exact parent bbox of warped exposure (an afwGeom.Box2I or None);
    if None then border and maxBBox are used to determine the bbox,
    otherwise border and maxBBox are ignored

@return destExposure: warped exposure (of same type as srcExposure)

@note: calls mathLib.warpExposure insted of self.warpImage because the former
copies attributes such as Calib, and that should be done in one place

Definition at line 145 of file warper.py.

146  def warpExposure(self, destWcs, srcExposure, border=0, maxBBox=None, destBBox=None):
147  """Warp an exposure
148 
149  @param destWcs: WCS of warped exposure
150  @param srcExposure: exposure to warp
151  @param border: grow bbox of warped exposure by this amount in all directions (int pixels);
152  if negative then the bbox is shrunk;
153  border is applied before maxBBox;
154  ignored if destBBox is not None
155  @param maxBBox: maximum allowed parent bbox of warped exposure (an afwGeom.Box2I or None);
156  if None then the warped exposure will be just big enough to contain all warped pixels;
157  if provided then the warped exposure may be smaller, and so missing some warped pixels;
158  ignored if destBBox is not None
159  @param destBBox: exact parent bbox of warped exposure (an afwGeom.Box2I or None);
160  if None then border and maxBBox are used to determine the bbox,
161  otherwise border and maxBBox are ignored
162 
163  @return destExposure: warped exposure (of same type as srcExposure)
164 
165  @note: calls mathLib.warpExposure insted of self.warpImage because the former
166  copies attributes such as Calib, and that should be done in one place
167  """
168  destBBox = self._computeDestBBox(
169  destWcs = destWcs,
170  srcImage = srcExposure.getMaskedImage(),
171  srcWcs = srcExposure.getWcs(),
172  border = border,
173  maxBBox = maxBBox,
174  destBBox = destBBox,
175  )
176  destExposure = srcExposure.Factory(destBBox, destWcs)
177  mathLib.warpExposure(destExposure, srcExposure, self._warpingControl)
178  return destExposure
def lsst.afw.math.warper.Warper.warpImage (   self,
  destWcs,
  srcImage,
  srcWcs,
  border = 0,
  maxBBox = None,
  destBBox = None 
)
Warp an image or masked image

@param destWcs: WCS of warped image
@param srcImage: image or masked image to warp
@param srcWcs: WCS of image
@param border: grow bbox of warped image by this amount in all directions (int pixels);
    if negative then the bbox is shrunk;
    border is applied before maxBBox;
    ignored if destBBox is not None
@param maxBBox: maximum allowed parent bbox of warped image (an afwGeom.Box2I or None);
    if None then the warped image will be just big enough to contain all warped pixels;
    if provided then the warped image may be smaller, and so missing some warped pixels;
    ignored if destBBox is not None
@param destBBox: exact parent bbox of warped image (an afwGeom.Box2I or None);
    if None then border and maxBBox are used to determine the bbox,
    otherwise border and maxBBox are ignored

@return destImage: warped image or masked image (of same type as srcImage)

Definition at line 179 of file warper.py.

180  def warpImage(self, destWcs, srcImage, srcWcs, border=0, maxBBox=None, destBBox=None):
181  """Warp an image or masked image
182 
183  @param destWcs: WCS of warped image
184  @param srcImage: image or masked image to warp
185  @param srcWcs: WCS of image
186  @param border: grow bbox of warped image by this amount in all directions (int pixels);
187  if negative then the bbox is shrunk;
188  border is applied before maxBBox;
189  ignored if destBBox is not None
190  @param maxBBox: maximum allowed parent bbox of warped image (an afwGeom.Box2I or None);
191  if None then the warped image will be just big enough to contain all warped pixels;
192  if provided then the warped image may be smaller, and so missing some warped pixels;
193  ignored if destBBox is not None
194  @param destBBox: exact parent bbox of warped image (an afwGeom.Box2I or None);
195  if None then border and maxBBox are used to determine the bbox,
196  otherwise border and maxBBox are ignored
197 
198  @return destImage: warped image or masked image (of same type as srcImage)
199  """
200  destBBox = self._computeDestBBox(
201  destWcs = destWcs,
202  srcImage = srcImage,
203  srcWcs = srcWcs,
204  border = border,
205  maxBBox = maxBBox,
206  destBBox = destBBox,
207  )
208  destImage = srcImage.Factory(destBBox)
209  mathLib.warpImage(destImage, destWcs, srcImage, srcWcs, self._warpingControl)
210  return destImage

Member Data Documentation

lsst.afw.math.warper.Warper._warpingControl
private

Definition at line 119 of file warper.py.

lsst.afw.math.warper.Warper.ConfigClass = WarperConfig
static

Definition at line 101 of file warper.py.


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