Hi Chad, thanks for re-posting your code; it's much clearer to read now. I'm not quite sure what I'm looking at now: Is this your own implementation of the yall1 minimization function, or something that can be tested? If I remember correctly, the matlab call has a matrix input, and a "target" vector, and an options argument. Is there some accessible documentation.
Other than my confusion whether this is a GNU Radio or a general yall1 question, your code looks pretty good. A few thing's I'd note: * self.alpha.shape should be right * check that input_items.shape and in0.shape are as you expect them Best regards, Marcus On 10/29/2015 01:27 PM, Chad R wrote: > Sorry. Something went wrong when I copied pasted it but my actual code is: > > import numpy > from gnuradio import gr > from 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 > <marcus.muel...@ettus.com <mailto:marcus.muel...@ettus.com>> 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 list >> Discuss-gnuradio@gnu.org <mailto:Discuss-gnuradio@gnu.org> >> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org <mailto:Discuss-gnuradio@gnu.org> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio