getHistIndex Function

public function getHistIndex(val, minVal, nPoints, windowSize) result(ind)

For a given value, get the position in a histogram of given window sizes @param[in] val value to get the position @param[in] minVal smallest value appearing in the histogram @param[in] nPoints number of bins in the histogram @param[in] windowSize size of each bin @return ind index of val in the histogram

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: val
real(kind=dp), intent(in) :: minVal
integer, intent(in) :: nPoints
real(kind=dp), intent(in) :: windowSize

Return Value integer


Contents

Source Code


Source Code

    function getHistIndex(val, minVal, nPoints, windowSize) result(ind)
        implicit none
        real(dp), intent(in) :: val, minVal, windowSize
        integer, intent(in) :: nPoints
        integer :: ind

        if(val <= minVal) then
            ind = 1
        else if(val > minVal + nPoints*windowSize) then
            ind = nPoints
        else
            ind = ceiling((val - minVal) / windowSize)
        end if
    end function getHistIndex