Sorry. Something went wrong when I copied pasted it but my actual code is:
import numpyfrom gnuradio import grfrom yall1 import *
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.6
out[i] = recon.reshape(self.N,)
output_items[0][:] = out
return len(output_items[0])
On Thu, Oct 29, 2015 at 2:08 PM, Marcus Müller <[email protected]>
wrote:
> Hi Chad,
>
> there's something wrong with the indention of the lines between "def
> __init__" and "g.sync_block", and the same goes for your work function; so
> that's my first stab at explaining misbehaviour.
>
>
> Best regards,
> Marcus
>
>
> On 29.10.2015 13:01, Chad R wrote:
>
> 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
>
>
> _______________________________________________
> Discuss-gnuradio mailing
> [email protected]https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio