def test_GPSL2Prn_init_f(): ''' GPS L2 C object init (CL=error) ''' try: GPSL2PrnCode(1, '02') assert False except ValueError: pass
def test_GPSL2Prn_init1(): ''' GPS L2 C object init (CL=1) ''' code = GPSL2PrnCode(1, '1') assert code.prnNo == 1 assert (code.bitLookup == [1, -1]).all() assert (code.binCode[1::2] == 1).all() for i in range(0, 767250, 10230): assert (code.binCode[i * 2:(i + 10230) * 2:2] == GPSL2CMCodes[0]).all()
def test_GPSL2Prn_combineData1(): ''' GPS L2 C data combination (CL=1) ''' code = GPSL2PrnCode(1, '1') dataBits = numpy.zeros(10230 * 2, dtype=numpy.uint8) chipIndex_all = numpy.linspace(0, 20459, 20460, dtype=numpy.long) data = code.combineData(chipIndex_all, dataBits) binData = (data < 0).astype(numpy.uint8) assert binData.shape == (20460, ) assert (binData[1::2] == 1).all() assert (binData[::2] == GPSL2CMCodes[0]).all()