1 Star 0 Fork 0

alfar/GNSS-DSP-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
squaring.py 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
Peter Monta 提交于 2015-10-16 20:24 . fix Python 3 x==None warning
#!/usr/bin/env python
import sys
import numpy as np
import gnsstools.nco as nco
import gnsstools.io as io
import gnsstools.squaring as squaring
# parse command-line arguments
# example:
# ./squaring.py /dev/stdin 69984000 -9334875 | baudline -reset -stdin -fftsize 16384 -samplerate 43740 -channels 2 -format le16 -quadrature -flipcomplex
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/alfar999/GNSS-DSP-tools.git
git@gitee.com:alfar999/GNSS-DSP-tools.git
alfar999
GNSS-DSP-tools
GNSS-DSP-tools
master

搜索帮助