XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


ssclib (ssclib-4.36.1) [xmmsas_20230412_1735-21.0.0]


Regrids in the Cartesian coordinates

interface regridCartesian
  subroutine regridScalar(oldPixelCorners, oldImage, newImage, status&
  , testFlagArg, averagingStyle)
    real(single),   intent(in)            :: oldImage(:,:)
    type(Point2dT), intent(in)            :: oldPixelCorners(size(oldImage,1)+1&
                                                            ,size(oldImage,2)+1)
    real(single),   intent(out)           :: newImage(:,:)
    integer,        intent(out), optional :: status
    logical(bool),  intent(in),  optional :: testFlagArg
    character(*),   intent(in),  optional :: averagingStyle
  end subroutine regridScalar

  subroutine regridScalarDouble(oldPixelCorners, oldImage, newImage, status&
  , testFlagArg, averagingStyle)
    real(single),       intent(in)            :: oldImage(:,:)
    type(Point2dDbleT), intent(in)            :: oldPixelCorners(&
                                                   size(oldImage,1)+1,&
                                                   size(oldImage,2)+1)
    real(single),       intent(out)           :: newImage(:,:)
    integer,            intent(out), optional :: status
    logical(bool),      intent(in),  optional :: testFlagArg
    character(*),       intent(in),  optional :: averagingStyle
  end subroutine regridScalarDouble

  subroutine regridVector(oldPixelCorners, oldImages, newImages, status&
  , testFlagArg, averagingStyle)
    real(single),   intent(in)            :: oldImages(:,:,:)
    type(Point2dT), intent(in)            :: oldPixelCorners(&
                                               size(oldImages,2)+1,&
                                               size(oldImages,3)+1&
                                             )
    real(single),   intent(out)           :: newImages(:,:,:)
    integer,        intent(out), optional :: status
    logical(bool),  intent(in),  optional :: testFlagArg
    character(*),   intent(in),  optional :: averagingStyle
  end subroutine regridVector
end interface

This subroutine is intended to allow rebinning of an image from one cartesian coordinate system to another. Now, we define here an image as a two-dimensional array of uniform rectangular pixels. If we change the coordinate system, this image becomes distorted. It is nice to be able to convert it once again to an array of rectangular pixels, but this time in the new coordinate system. This involves taking each of the old, distorted pixels and dividing its contents up among the new pixels. It is assumed here that (i) the distorted pixel still has straight 'sides', ie it is a quadrilateral (a polygon for generality); (ii) that the value within the old pixel is evenly distributed through the pixel (this assumption MAY BE INVALID for extremely nonlinear distortions); (iii) that the distorted pixel is not folded over – ie that no two of its sides cross; (iv) that the old pixels are not greatly larger than the new - the present algorithm still works ok in such a regime, but the result will look `steppy.' In this case an interpolation algorithm would yield smoother-looking results.

The relation between the old and new coordinate systems is here entirely contained within the input array oldPixelCorners. This gives the coordinates of each pixel in the array oldImage, expressed in the wcs `pixel' system of newImage. What does `wcs pixel system' mean? It means that the width and height of pixels in newImage are both equal to 1.0 and the centre of the pixel newImage(1,1) is at (1.0, 1.0).

NOTE newImages is NOT defined if any error is detected before processing.

Note type(Point2dT) is defined in geometric_types.

XMM-Newton SOC -- 2023-04-16