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


ssclib (ssclib-4.30) [xmmsas_20160201_1833-15.0.0]

Integer (index) scalar integers Integer (index) scalar integers Return the indices (i,j) Home Index

Meta Index / Home Page / General-purpose array-processing utilities / Integer (index) scalar integers


Return the axes (array) for the input (i,j) for an array

  interface getAxesFromIndices
    function getAxesFromIndicesDouble(indices, iLbound, iUbound, lEdge, uEdge) result(axes)
      real(double), intent(in) :: indices(:)
      integer,      intent(in) :: iLbound(size(indices)), iUbound(size(indices))
      real(double), intent(in)           :: lEdge(size(indices))
      real(double), intent(in), optional :: uEdge(size(indices))
      real(double) :: axes(size(indices))	! result
    end function getAxesFromIndicesDouble

    function getAxesFromIndicesSingle(indices, iLbound, iUbound, lEdge, uEdge) result(axes)
      real(single), intent(in) :: indices(:)
      integer,      intent(in) :: iLbound(size(indices)), iUbound(size(indices))
      real(single), intent(in)           :: lEdge(size(indices))
      real(single), intent(in), optional :: uEdge(size(indices))
      real(single) :: axes(size(indices))	! result
    end function getAxesFromIndicesSingle

    function getAxesFromIndicesEdgesDouble(indices, aryEdgesInfo) result(axes)
      real(double), intent(in) :: indices(:)
      type(AryEdgesInfoT), intent(in) :: aryEdgesInfo
      real(double) :: axes(size(indices))	! result
    end function getAxesFromIndicesEdgesDouble

    function getAxesFromIndicesEdgesSingle(indices, aryEdgesInfo) result(axes)
      real(single), intent(in) :: indices(:)
      type(AryEdgesInfoT), intent(in) :: aryEdgesInfo
      real(single) :: axes(size(indices))	! result
    end function getAxesFromIndicesEdgesSingle
  end interface

In the arguments, indices(:) are the coordinates in unit of the index of the array of interest. i(L|U)bound(:) are the array of (l|u)bound of the array of interest. (l|u)Edge(:) are the array of the lower/upper bounds in unit of physically meaningful values of the array of interest; e.g.,

 lEdge=(0.5,0.5) uEdge=(256.5,256.5)
etc.

If uEdge is not given, it is assumed that the width of axes is the same as the size of the array (= abs(iUbound-iLbound) for each axis).

The following is a few examples.

Case 1
The axes for the indices (i, j)=(3, 3) in the array (1:5, 1:5) with the edge (0.5:5.5, 0.5:5.5) is (3.0, 3.0).
Case 2
The axes for the indices (i, j)=(3, 3) in the array (1:5, 1:5) with the edge (2.5:7.5, 2.5:7.5) is (5.0, 5.0).
Case 3
The axes for the indices (i, j)=(3, 3) in the array (1:5, 1:5) with the edge (0.0:10, 0.0:10) is (5, 5).
Case 4
The axes for the indices (i, j)=(3, 3) in the array (1:5, 1:5) with the edge (-10:0.0, -10:0.0) is (-5, -5).
Case 5
The axes for the indices (i, j)=(5, 5) in the array (3:7, 3:7) with the edge (0.0:10, 0.0:10) is (5, 5).


Integer (index) scalar integers Integer (index) scalar integers Return the indices (i,j) Home Index

XMM-Newton SOC/SSC -- 2016-02-01