Пример #1
0
def _validateAndExpandInputs(argv):
    rtl.validateInputOrExit(argv, 3, "solution1 solution2 attribute")
    testSolution = argv[0]
    baselineSolution = argv[1]
    attribute = argv[2]
    rtl.validateFileOrExit(testSolution)
    rtl.validateFileOrExit(baselineSolution)
    return (testSolution, baselineSolution, attribute)
Пример #2
0
    for i, channelRange in enumerate(channelRanges):
        norm[i] = maxnorm( diff[:,i] ) if channelRange < 1 else maxnorm( diff[:,i] / channelRange )
        
    return norm
    
def calculateMaxNorm(testData, baselineData):
    return maxnorm(abs(testData - baselineData))
    
def calculateNorms(testData, baselineData, tolerance):
    relativeNorm = calculateMaxNormOverRange(testData, baselineData, tolerance)
    maxNorm = calculateMaxNorm(testData, baselineData)
    return relativeNorm, maxNorm
    
if __name__=="__main__":

    rtl.validateInputOrExit(sys.argv, 4, "{} test_solution baseline_solution tolerance".format(sys.argv[0]))

    testSolution = sys.argv[1]
    baselineSolution = sys.argv[2]
    tolerance = sys.argv[3]

    try:
        tolerance = float(tolerance)
    except ValueError:
        rtl.exitWithError("Error: invalid tolerance given, {}".format(tolerance))

    rtl.validateFileOrExit(testSolution)
    rtl.validateFileOrExit(baselineSolution)

    testData, testInfo, testPack = readFASTOut(testSolution)
    baselineData, baselineInfo, basePack = readFASTOut(baselineSolution)