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
variable threshold in order to convert that complex sequence in a square
The complex sequence already represent a square wave, but with a noise
distortions that I want to clean.
Now I would like to merge what I’ve done with the gnuradio language, and
what I tried:
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
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
know that does something like this)
Thank you in advance,