discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Constant baseline between FFTs


From: Dr Cdiff
Subject: Constant baseline between FFTs
Date: Sat, 30 Dec 2023 08:20:28 +0100

Hi!

I have complex data in a file sink. I do File Source, Throttle, Stream to Vector, FFT, Multiply Conjugate, Complex to Mag² and finally a File Sink. Everything is fine, except the "jumping" baseline between FFTs. I can handle the problem by dividing by the median of every FFT (good idea?).

I could not find a block doing "Divide Vector by Median of the Vector" so I used a Python block to write my own (really simple) code. It works ... kind of. On some FFTs the "Divide Vector by Median of the Vector" does not work in the Python block. The problem is random. When I run the same GNURadio-Script on the same data again the faulty FFTs are in different places. I guess the Python Block is too slow?

"Fixing" the Python Block or the jumping Baselines makes no difference to me. Although I am a bit curious about the random errors in the Python block.

Thanks,

DrCdiff


P.S.: My Python Block:

import numpy as np
from gnuradio import gr

class blk(gr.sync_block):  # other base classes are basic_block, decim_block, interp_block
    """Embedded Python Block example - a simple multiply const"""

    def __init__(self, vectorSize=8192):  # only default arguments here
        """arguments to this function show up as parameters in GRC"""
        gr.sync_block.__init__(
            self,
            name='Divide by Median',   # will show up in GRC
            in_sig=[(np.float32,vectorSize)],
            out_sig=[(np.float32,vectorSize)]
        )
        # if an attribute with the same name as a parameter is found,
        # a callback is registered (properties work, too).
        self.vectorSize = vectorSize

    def work(self, input_items, output_items):
        """example: multiply with constant"""
        output_items[0][:] = input_items[0] / np.median(input_items[0])
        return len(output_items[0])


reply via email to

[Prev in Thread] Current Thread [Next in Thread]