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


ssclib (ssclib-4.36.1) [xmmsas_20230412_1735-21.0.0]


Calculates OldPixelCorners via an Affine transform

interface calcOldPixelCornersAffine
  subroutine calcOldPixelCornersAffineDouble(oldPixelCorners &
     , oldAryEdgesInfo, newAryEdgesInfo, mtrxLinTrans, vecTranslate)
    type(Point2dT), intent(out) :: oldPixelCorners(:,:)
    type(AryEdgesInfoT), intent(in) :: oldAryEdgesInfo, newAryEdgesInfo
    real(double),   intent(in)  :: mtrxLinTrans(2,2), vecTranslate(2)
  end subroutine calcOldPixelCornersAffineDouble

  subroutine calcOldPixelCornersAffineSingle(oldPixelCorners &
     , oldAryEdgesInfo, newAryEdgesInfo, mtrxLinTrans, vecTranslate)
    type(Point2dT), intent(out) :: oldPixelCorners(:,:)
    type(AryEdgesInfoT), intent(in) :: oldAryEdgesInfo, newAryEdgesInfo
    real(single),   intent(in)  :: mtrxLinTrans(2,2), vecTranslate(2)
  end subroutine calcOldPixelCornersAffineSingle
end interface

This subroutine gives an array oldPixelCorners as an argument to pass to regridCartesian(), when an Affine transformation (A and B) as given below is the coordinate transformation used in regridding,

  ( x_new )            ( x_old )   
  (       ) =    A  *  (       )  +  B
  ( y_new )            ( y_old )   
              ( a  b ) ( x_old )     ( e ) 
            = (      ) (       )  +  (   )
              ( c  d ) ( y_old )     ( f )

where the matrix A (=mtrxLinTrans) is a component for the linear transformation and B (=vecTranslate) is for the translation (a.k.a. parallel move). Note

  ( a  b )   ( mtrxLinTrans(1,1)  mtrxLinTrans(1,2) )
  (      ) = (                                      )
  ( c  d )   ( mtrxLinTrans(2,1)  mtrxLinTrans(2,2) )

The returned oldPixelCorners can be directly passed to regridCartesian().

Note oldPixelCorners can contain the values which are out of the boundary of newAryEdgesInfo, such as zero or negative values.

Among the input arguments, the size of oldPixelCorners has to be larger by 1 than those specified in oldAryEdgesInfo%arySize.

type(Point2dT) is defined in geometric_types. type(AryEdgesInfoT) is defined in oldAryEdgesInfo and newAryEdgesInfo is defined in array_utils.

As examples,
(A) When oldAry(1:5,1:5), newAry(1:5,1:5), identical transformation.

   oldPixelCorners(1,1)\%x,y == (0.5, 0.5) 
   oldPixelCorners(6,6)\%x,y == (5.5, 5.5)
(B) When oldAry(1:5,1:5), newAry(-1:6,0:8), identical transformation.
   oldPixelCorners(1,1)\%x,y == (2.5, 1.5) 
   oldPixelCorners(3,1)\%x,y == (4.5, 1.5)
because the respective indices of 3rd and 2nd for X and Y in newAry correspond to (1,1) in oldAry.

XMM-Newton SOC -- 2023-04-16