Hello all!
I wrote a script in python that takes a binary file (output of the usrp_rx_cfile.py), convert it in a sequence of complex values and applies a variable threshold in order to convert that complex sequence in a square wave. The complex sequence already represent a square wave, but with a noise and distortions that I want to clean. Now I would like to merge what I've done with the gnuradio language, and this is what I tried: class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) def block_cplx_to_sq (matrice): output1 = [] d = ds = 0; de = len(matrice); while (d < de): [sequence of 'if..else' to find the correct value of [min,max]] threshold = mean(matrice[min,max]); stad = std(matrice[min_std,max_std]); if stad <= 50: threshold = threshold - 100; soglia_f.append(threshold); if abs(matrice[d]) >= threshold: output1.append(1); else: output1.append(0); d = d + 1; return output1; src = gr.file_source(gr.complex, "Acq_petit", TRUE) BLCK = block_cplx_to_sq (); self.connect(src, BLCK) The problem is that the program still requires something as input of block_cplx_to_sq (and it should be the output of the file_source...). Does anyone have any idea to help me? (maybe some gnuradio function that I don't know that does something like this) Thank you in advance, Kind regards, Marco _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio