Forum: GNU Radio Complex signal to square wave

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Marco Bottino (Guest)
on 2009-02-16 23:29
(Received via mailing list)
Hello all!

I wrote a script in python that takes a binary file (output of the, convert it in a sequence of complex values and
applies a
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
this is
what I tried:

class my_top_block(gr.top_block):

    def __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;

                if abs(matrice[d]) >= threshold:

                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,
This topic is locked and can not be replied to.