Exemple #1
0
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)
Exemple #2
0
def gps_l2_cl(initial_state):
    """
    Generates the L2 CL code given the initial shift register state.
    """
    state = initial_state
    sequence = zeros((CL_LENGTH, ))
    for i in range(CL_LENGTH):
        state = shift_state(state)
        sequence[i] = state & 0x1
    return Code(sequence, 511500)
Exemple #3
0
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)
Exemple #4
0
def gps_l1ca(svid):
    """Generates GPS L1 CA PRN code for given SV id.
    
    Parameters
    ----------
    sv_id : int
        the id of the satellite for which the 

    Returns
    -------
    output : ndarray of shape(1023,)
        the complete code sequence

    Notes
    -----
    """
    ps = L1_CODE_PHASE_ASSIGNMENTS[svid].ca_phase_select
    g1 = gold_code([2, 9], [9])
    g2 = gold_code([1, 2, 5, 7, 8, 9], [ps[0] - 1, ps[1] - 1])
    return Code((g1 + g2) % 2, CODE_RATE)
Exemple #5
0
def gps_l2c(svid):
    phase_assignment = L2_CODE_PHASE_ASSIGNMENTS[svid]
    cm = gps_l2_cm(phase_assignment.cm_initial_state)
    cl = gps_l2_cl(phase_assignment.cl_initial_state)
    return Code.time_multiplex(cm, cl)
Exemple #6
0
def gps_l2c(svid):
    phase_assignment = L2_CODE_PHASE_ASSIGNMENTS[svid]
    cm = gps_l2_cm(phase_assignment.cm_initial_state)
    cl = gps_l2_cl(phase_assignment.cl_initial_state)
    return Code.time_multiplex(cm, cl)