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


ssclib (ssclib-4.36.1) [xmmsas_20230412_1735-21.0.0]

integrateRanges

This is a function to perform numerical integration of y(x) (using the trapezoid rule) over a set of discrete ranges specified via the xRanges argument.

NOTE! (i) The values in the vector x() should be in increasing order. (ii) The ranges may occur in any order, but are otherwise assumed to be well-formed. (iii) If any upper range bound is undefined, the upper x value is used instead for that range bound; likewise for undefined lower bounds.

!*** should change it so that the ranges are required to be well-formed. This would make the routine less general but makes the accepted properties of ranges simpler.

  interface integrateRanges
    function integrateRangesScalar(x, y, xRange) result(approxIntegral)
      real(single), intent(in) :: x(:), y(size(x))
      type(RangeT), intent(in) :: xRange
      real(single) :: approxIntegral
    end function integrateRangesScalar

    function integrateRangesVector(x, y, xRanges) result(approxIntegral)
      real(single), intent(in) :: x(:), y(size(x))
      type(RangeT), intent(in) :: xRanges(:)
      real(single) :: approxIntegral
    end function integrateRangesVector
  end interface



XMM-Newton SOC -- 2023-04-16