discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Python block with vector input and vector output


From: Chad R
Subject: [Discuss-gnuradio] Python block with vector input and vector output
Date: Thu, 29 Oct 2015 14:01:56 +0200

Good day every one

I have implemented a Python block but I am not getting the results I expected. I get the results I expect at any frequency=samp_rate/2^n where n is any integer. My block makes use of a yall1 reconstruction algorithm to reconstruct a signal from M=100 to N=1024 vector.
The code for my block is shown below:

class yall1_reconstruction_cc(gr.sync_block):
    """
    Yall1_reconstruction_block
    """
    def __init__(self,n,m):
    self.N = n
    self.M = m
    phi = np.load("/home/chad/Desktop/PROJECT/Python/Matrices/phi_mtx%(M)dx%(N)d.npy" %{"M":self.M,"N":self.N})
    psi = np.load("/home/chad/Desktop/PROJECT/Python/Matrices/psi_mtx%(N)dx%(N)d.npy" %{"N":self.N})
    self.alpha = np.dot(phi,psi)
        gr.sync_block.__init__(self,
            name="yall1_reconstruction",
            in_sig=[(np.complex64,self.M)],
            out_sig=[(np.complex64,self.N)])

    def work(self, input_items, output_items):
        in0 = input_items[0]
    size = np.shape(in0)[0]
    out = np.zeros((size,self.N),dtype = np.complex64)
    #out = yall1(self.alpha,in0[0]).reshape(self.N,)
    for i in range(0,size):
        recon = yall1(self.alpha, in0[i].reshape(self.M,1))*4.7
        out[i] = recon.reshape(self.N,)
        output_items[0][:] = out
        return len(output_items[0])

Have I implemented it right? or is my issue with my implementation? I read through the tutorials but I feel some aspects are quiet hard to follow.

Thank you in advance for your help

Chad Richs

reply via email to

[Prev in Thread] Current Thread [Next in Thread]