blot_image

drizzle.resample.blot_image(data, pixmap, pix_ratio=<object object>, exptime=<object object>, output_pixel_shape=<object object>, out_img=None, fillval=0.0, iscale=1.0, interp='poly5', sinscl=1.0)[source]

Resample the data input image onto an output grid defined by the pixmap array. blot_image performs resampling using one of the several interpolation algorithms and, unlike the “drizzle” algorithm with ‘square’, ‘turbo’, and ‘point’ kernels, this resampling is not flux-conserving.

This method works best for with well sampled images and thus it is typically used to resample the output of Drizzle back to the coordinate grids of input images of Drizzle.add_image(). The output of Drizzle are usually well sampled images especially if it was created from a set of dithered images.

Parameters:
  • data (2D array) – Input numpy array of the source image in units of ‘cps’.

  • pixmap (3D array) – A mapping from input image (data) coordinates to resampled (out_img) coordinates. pixmap must be an array of shape (Ny, Nx, 2) where (Ny, Nx) is the shape of the input image. pixmap[..., 0] forms a 2D array of X-coordinates of input pixels in the output frame and pixmap[..., 1] forms a 2D array of Y-coordinates of input pixels in the output coordinate frame.

  • pix_ratio (float) –

    Ratio of the input image pixel scale to the output image pixel scale as used in the drizzle context: input is a distorted image that was “drizzled” onto the output image. That is, it is the ratio of the scale of the pixels in the input data argument to the scale of pixels of the image array returned by blot_image(). It is used to scale the input image intensities to account for the change in pixel area.

    Warning

    Deprecated since version 3.0 and will be removed in a future release. Use iscale instead and set iscale=1.0 / pix_ratio**2 to achieve the same effect as with pix_ratio.

  • exptime (float) –

    The exposure time of the input image. If provided it is used to scale the output image values.

    Warning

    Deprecated since version 3.0 and will be removed in a future release. Use iscale instead and set iscale=exptime or exptime / pix_ratio**2 to achieve the same effect as with exptime (and pix_ratio).

  • output_pixel_shape (tuple of int) –

    A tuple of two integer numbers indicating the dimensions of the output image (Nx, Ny).

    Warning

    Deprecated since version 3.0 and will be removed in a future release. It is not needed since the output image shape can be inferred from pixmap.

  • output_image (2D array of float32, None, optional) – A 2D numpy array to hold the output image produced by resampling the input image (data). If None, a new array will be allocated.

  • fillval (float, optional) – The value of output pixels that did not have contributions from input image’ pixels.

  • iscale (float, optional) – A multiplicative factor used to rescale output image data by iscale. Depending on specific needs, it may make sense to rescale output image by inverse of squared pixel scale ratio (the linear dimension of a side of a resampled/drizzled (input) pixel as seen in the distorted (output) image’s coordinate frame) depending on the units of the input image, i.e., counts (flux) vs surface brightness. For more details see section “Scaling of input image data” in Drizzle.

  • interp (str, optional) –

    The type of interpolation used in the resampling. The possible values are:

    • ”nearest” (nearest neighbor interpolation);

    • ”linear” (bilinear interpolation);

    • ”poly3” (cubic polynomial interpolation);

    • ”poly5” (quintic polynomial interpolation);

    • ”sinc” (sinc interpolation);

    • ”lan3” (3rd order Lanczos interpolation); and

    • ”lan5” (5th order Lanczos interpolation).

    Warning

    The “sinc” interpolation is currently investigated for possible issues, see https://github.com/spacetelescope/drizzle/issues/209, and its use is not recommended. Furthermore, sinc interpolation may be removed in future releases.

  • sincscl (float, optional) – The scaling factor for “sinc” interpolation.

Returns:

out_img – A 2D numpy array containing the resampled image data.

Return type:

2D numpy.ndarray