test_singleshot_filter.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:Auspex 作者: BBN-Q 项目源码 文件源码
def generate_fake_data(alpha, phi, sigma, N = 5000, plot=False):

    N_samples = 256
    data_start = 3
    data_length = 100
    gnd_mean = np.array([alpha*np.cos(phi), alpha*np.sin(phi)])
    ex_mean = np.array([alpha*np.cos(phi + np.pi), alpha*np.sin(phi + np.pi)])
    gndIQ = np.vectorize(complex)(np.random.normal(gnd_mean[0], sigma, N),
                                 np.random.normal(gnd_mean[1], sigma, N))
    exIQ = np.vectorize(complex)(np.random.normal(ex_mean[0], sigma, N),
                                 np.random.normal(ex_mean[1], sigma, N))
    gnd = np.zeros((N_samples, N), dtype=np.complex128)
    ex = np.zeros((N_samples, N), dtype=np.complex128)
    for idx, x in enumerate(zip(gndIQ, exIQ)):
        gnd[data_start:data_start+data_length, idx] = x[0]
        ex[data_start:data_start+data_length, idx] = x[1]

    gnd += sigma/50 * (np.random.randn(N_samples, N) + 1j * np.random.randn(N_samples, N))
    ex += sigma/50 * (np.random.randn(N_samples, N) + 1j * np.random.randn(N_samples, N))

    if plot:
        plt.figure()
        plt.plot(np.real(gndIQ), np.imag(gndIQ), 'b.')
        plt.plot(np.real(exIQ), np.imag(exIQ), 'r.')
        plt.draw()
        plt.show()

        plt.figure()
        plt.plot(np.real(gnd[:,15]), 'b.')
        plt.plot(np.real(ex[:,15]), 'r.')
        plt.draw()
        plt.show()
    return gnd, ex
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号