# main program # # parse command-line arguments # example: # ./acquire-gps-l2cm.py /dev/stdin 69984000 -127126 filename = sys.argv[1] # input data, raw file, i/q interleaved, 8 bit signed (two's complement) fs = float(sys.argv[2]) # sampling rate, Hz coffset = float(sys.argv[3]) # offset to L1 carrier, Hz (positive or negative) # read first 75 ms of file n = int(fs*0.075) fp = open(filename,"rb") x = io.get_samples_complex(fp,n) # resample to 4.096 MHz fsr = 4096000.0/fs nco.mix(x,-coffset/fs,0) h = scipy.signal.firwin(161,1.5e6/(fs/2),window='hanning') x = scipy.signal.filtfilt(h,[1],x) xr = np.interp((1/fsr)*np.arange(75*4096),np.arange(len(x)),np.real(x)) xi = np.interp((1/fsr)*np.arange(75*4096),np.arange(len(x)),np.imag(x)) x = xr+(1j)*xi # iterate over PRNs of interest for prn in range(1,33): metric,code,doppler = search(x,prn)
filename = sys.argv[ 1] # input data, raw file, i/q interleaved, 8 bit signed (two's complement) fs = float(sys.argv[2]) # sampling rate, Hz coffset = float(sys.argv[3]) # offset to L1 carrier, Hz (positive or negative) fp = open(filename, "rb") coffset_phase = 0.0 b = 1000 n = 16 m = 100 r = np.zeros(b).astype('complex') y = np.zeros(2 * b).astype('int16') while True: x = io.get_samples_complex(fp, b * n * m) if x is None: break nco.mix(x, -coffset / fs, coffset_phase) coffset_phase = coffset_phase - len(x) * coffset / fs coffset_phase = np.mod(coffset_phase, 1) squaring.squaring(x, r, n, m) y[0:2 * b:2] = np.round(20 * np.real(r)).astype('int16') y[1:2 * b:2] = np.round(20 * np.imag(r)).astype('int16') y.tofile(sys.stdout)
# parse command-line arguments # example: # ./track-galileo-e5ai.py /dev/stdin 68873142.857 5606571.429 12 2000.0 1855.6 filename = sys.argv[1] # input data, raw file, i/q interleaved, 8 bit signed (two's complement) fs = float(sys.argv[2]) # sampling rate, Hz coffset = float(sys.argv[3]) # offset to L1 carrier, Hz (positive or negative) prn = int(sys.argv[4]) # PRN code doppler = float(sys.argv[5]) # initial doppler estimate from acquisition code_offset = float(sys.argv[6]) # initial code offset from acquisition fp = open(filename,"rb") n = int(fs*0.001*((e5ai.code_length-code_offset)/e5ai.code_length)) # align with 1 ms code boundary x = io.get_samples_complex(fp,n) code_offset += n*1000.0*e5ai.code_length/fs s = tracking_state(fs=fs, prn=prn, # initialize tracking state code_p=code_offset, code_f=e5ai.chip_rate, code_i=0, carrier_p=0, carrier_f=doppler, carrier_i=0, mode='PLL') block = 0 coffset_phase = 0.0 while True: if s.code_p<e5ai.code_length/2: n = int(fs*0.001*(e5ai.code_length-s.code_p)/e5ai.code_length) else: n = int(fs*0.001*(2*e5ai.code_length-s.code_p)/e5ai.code_length)
filename = sys.argv[1] # input data, raw file, i/q interleaved, 8 bit signed (two's complement) fs = float(sys.argv[2]) # sampling rate, Hz coffset = float(sys.argv[3]) # offset to L1 carrier, Hz (positive or negative) fp = open(filename,"rb") coffset_phase = 0.0 b = 1000 n = 16 m = 100 r = np.zeros(b).astype('complex') y = np.zeros(2*b).astype('int16') while True: x = io.get_samples_complex(fp,b*n*m) if x is None: break nco.mix(x,-coffset/fs,coffset_phase) coffset_phase = coffset_phase - len(x)*coffset/fs coffset_phase = np.mod(coffset_phase,1) squaring.squaring(x,r,n,m) y[0:2*b:2] = np.round(20*np.real(r)).astype('int16') y[1:2*b:2] = np.round(20*np.imag(r)).astype('int16') y.tofile(sys.stdout)