def gps_l5(xb_advance, neuman_hoffman): """ Generates the GPS L5 code (either I or Q) given the initial state of the XB shift register and the neuman_hoffman overlay code. """ indices = arange(L5_CODE_LENGTH) xa = xa_code() xb = xb_code() sequence = (xa[indices % XA_LENGTH] + xb[(xb_advance + indices) % XB_LENGTH]) % 2 # <- initial state used in index nh = Code(neuman_hoffman, NEUMAN_HOFFMAN_RATE) code = Code(sequence, L5_CODE_RATE) new_length = L5_CODE_LENGTH * len(nh.sequence) return Code.overlay(code, nh)