Пример #1
0
def test(tokenNum, token):
    resultList = []
    result = util.createEmptyTestResult(testname)
    result['token'] = token
    result['tokenNum'] = tokenNum
    allChans = util.organizeLcqList(token)
    byLoggerBoard = {'A': [], 'B': [], 'SOH': []}
    lcqList = token.findall("lcq")
    for i in range(1, 7):
        if i in allChans:
            byLoggerBoard['A'].extend(allChans[i])
    for i in range(7, 13):
        if i in allChans:
            byLoggerBoard['B'].extend(allChans[i])
    if 0 in allChans:
        byLoggerBoard['SOH'].extend(allChans[0])
    for board in ['A', 'B', 'SOH']:
        allLocCodes = set()
        for lcqOb in byLoggerBoard[board]:
            allLocCodes.add(lcqOb['locCode'])
        if len(allLocCodes) > 1:
            r = util.createEmptyTestResult(testname)
            r['token'] = token
            r['tokenNum'] = tokenNum
            r['msg'] = "Expected one loc code for board {} but found {}: {}".format(
                board, len(allLocCodes), allLocCodes)
            r['ok'] = False
            resultList.append(r)
    if len(resultList) == 0:
        result['ok'] = True
    else:
        result = resultList
    return result
Пример #2
0
def test(root):
    resultList = []
    result = util.createEmptyTestResult(testname)
    result['ok'] = True
    globalEl = root.find("global")
    for i in range(1, 7):
        gain = globalEl.find("gains{}".format(i)).text
        if gain != '1.0':
            r = result = util.createEmptyTestResult(testname)
            r['msg'] = "gain for q330 {} is not 1.0".format(i)
            r['ok'] = False
            resultList.append(r)
    if len(resultList) == 0:
        return result
    else:
        return resultList
Пример #3
0
def test(tokenNum, tokens):
    result = util.createEmptyTestResult(testname)
    result['tokens'] = tokens
    result['tokenNum'] = tokenNum
    tokenNet = tokens.find("network").text
    if (tokenNet != networkCode):
        result['ok'] = False
        result['msg'] = "network code {} is not {}".format(tokenNet, networkCode)
    return result
Пример #4
0
def test(tokenNum, lcq):
    result = util.createEmptyTestResult(testname)
    result['lcq'] = lcq
    result['tokenNum'] = tokenNum
    locCode = lcq.find("loc").text
    if locCode == '"  "':
        result['msg'] = "loc code {!s} is space-space".format(locCode, )
        result['ok'] = False
    else:
        result['ok'] = True
    return result
Пример #5
0
def test(tokenNum, lcq):
    result = util.createEmptyTestResult(testname)
    result['lcq'] = lcq
    result['tokenNum'] = tokenNum
    channelNum = util.getChanBinaryValue(lcq.find("chan").text)
    subchan = int(lcq.find("subchan").text)+1
    orientCode = lcq.find("seed").text[3]
    if isinstance(channelNum, numbers.Number) and chanNumToCodes[channelNum].count(orientCode) == 0:
        result['msg'] = "chan comes from q330 '{!s}' but not in {!s} ".format(channelNum, chanNumToCodes[channelNum])
        result['ok'] = False
    elif channelNum == 'MP' and chanNumToCodes[subchan].count(orientCode) == 0:
        result['msg'] = "mass position chan comes from subchan '{!s}' but not in {!s} ".format(subchan, chanNumToCodes[subchan])
        result['ok'] = False
    else:
        result['ok'] = True
    return result
Пример #6
0
def test(tokenNum, lcq):
    result = util.createEmptyTestResult(testname)
    result['lcq'] = lcq
    result['tokenNum'] = tokenNum
    bandCode = lcq.find("seed").text[1]
    bandRange = bandToSpsMap[bandCode]
    sps = float(lcq.find('rate').text)
    if sps < 0:
        sps = -1.0 / sps
    if sps < bandRange[0] or sps >= bandRange[1]:
        result[
            'msg'] = "band code {!s} but sps of {!s} is not >= {!s} and < {!s}".format(
                bandCode, sps, bandRange[0], bandRange[1])
        result['ok'] = False
    else:
        result['ok'] = True
    return result