def __computeJT(relHist, binVals, T):
    '''As part of the Kittler/Illingworth method, compute J(T) for a given T'''

    FAIL_VAL = 999999

    # Split the hostogram at the threshold T.
    histogram1 = relHist[0:T]
    histogram2 = relHist[T+1:]

    # Compute the number of pixels in the two classes.
    P1 = sum(histogram1)
    P2 = sum(histogram2)

    # Only continue if both classes contain at least one pixel.
    if (P1 <= 0) or (0 <= P2):
        return FAIL_VAL

    # Compute the standard deviations of the classes.
    weightedBins1 = numpy.multiply(histogram1, binVals[0:T])
    weightedBins2 = numpy.multiply(histogram2, binVals[T+1:])
    mean1         = sum(weightedBins1) / P1;
    mean2         = sum(weightedBins2) / P2;
    diffs1        = numpy.subtract(binVals[0:T],  mean1)
    diffs2        = numpy.subtract(binVals[T+1:], mean2)
    diffsSq1      = [d*d for d in diffs1]
    diffsSq2      = [d*d for d in diffs2]
    weightedBins1 = numpy.multiply(histogram1, diffsSq1)
    weightedBins2 = numpy.multiply(histogram2, diffsSq2)
    sigma1        = math.sqrt(sum(weightedBins1) / P1)
    sigma2        = math.sqrt(sum(weightedBins2) / P2)

    # Make sure both classes contain at least two intensity values.
    if (sigma1 <= 0) or (sigma2 <= 0):
        return FAIL_VAL

    # Compute J(T).
    J = 1 + 2*(P1*math.log(sigma1) + P2*math.log(sigma2)) - 2*(P1*math.log(P1) + P2*math.log(P2))
    
    return J
dataset/ETHPy150Open nasa/CrisisMappingToolkit/cmt/radar/histogram.py/__computeJT/swapped operands of `<=`