示例#1
0
def check_pols(packets):
    start = 0
    while packets[start].headers[1] != packets[start + 1].headers[1]:
        start += 1
    num_pkts = len(packets)
    for ctr in range(start, num_pkts-start, 2):
        pktp0 = packets[ctr]
        pktp1 = packets[ctr+1]
        d80p0 = AdcData.sixty_four_to_eighty_skarab(pktp0.data)
        d80p1 = AdcData.sixty_four_to_eighty_skarab(pktp1.data)
        for d in d80p0[1:]:
            if (d >> 79) != 0:
                msg = 'pol0 data MSB wrong'
                print(msg)
                print(pktp0.headers)
                print(pktp1.headers)
                IPython.embed()
                raise RuntimeError(msg)
        for d in d80p1[1:]:
            if (d >> 79) != 1:
                msg = 'pol1 data MSB wrong'
                print(msg)
                print(pktp0.headers)
                print(pktp1.headers)
                IPython.embed()
                raise RuntimeError(msg)
        for dctr in range(len(d80p0)):
            if (d80p0[dctr] & ((2**79)-1)) != (d80p1[dctr] & ((2**79)-1)):
                msg = 'pols do not agree'
                print(msg)
                print(pktp0.headers)
                print(pktp1.headers)
                IPython.embed()
                raise RuntimeError(msg)
示例#2
0
def check_counter80(packets):
    start = 0
    while packets[start].headers[1] != packets[start + 1].headers[1]:
        start += 1
    num_pkts = len(packets)
    last_cnt = None
    for ctr in range(start, num_pkts - start, 2):
        # print('DOING PKT', ctr, last_cnt)
        pkt = packets[ctr]
        d80 = AdcData.sixty_four_to_eighty_skarab(pkt.data)
        if pkt.headers[1] != d80[0]:
            msg = 'timestamp in data does not match SPEAD header'
            print(pkt.headers[1])
            print(d80[0])
            print(msg)
            IPython.embed()
            raise RuntimeError(msg)
        for d80ctr in range(len(d80)):
            d80[d80ctr] = d80[d80ctr] & ((2**79)-1)
        if last_cnt is None:
            last_cnt = d80[1] - 2
        if d80[1] != last_cnt + 2:
            msg = 'break in the count at the first word'
            print(ctr)
            print(packets[ctr-1].headers)
            print(pkt.headers)

            d80_0 = AdcData.sixty_four_to_eighty_skarab(packets[ctr - 1].data)
            d80_1 = AdcData.sixty_four_to_eighty_skarab(packets[ctr].data)
            d80_2 = AdcData.sixty_four_to_eighty_skarab(packets[ctr + 1].data)

            print([(d & ((2 ** 79) - 1)) for d in d80_0[0:5]])
            print([(d & ((2 ** 79) - 1)) for d in d80_1[0:5]])
            print([(d & ((2 ** 79) - 1)) for d in d80_2[0:5]])

            print(d80[1])
            print(last_cnt)
            print(msg)
            IPython.embed()
            raise RuntimeError(msg)
        last_cnt = d80[1] - 1
        for dword in d80[1:]:
            if dword != last_cnt + 1:
                msg = 'break in the count'
                print(dword)
                print(last_cnt)
                print(msg)
                IPython.embed()
                raise RuntimeError(msg)
            last_cnt += 1