|
From: | Marcus Müller |
Subject: | Re: bug & SNR routine |
Date: | Fri, 4 Nov 2022 11:21:57 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 |
Hi George,
> 1) In Log Power FFT documentation 'Create a log10(abs(fft)) stream chain, with real or complex input.' it seems that is missing the ^2.
I think this is [1], right?
In that case, you're right, the block actually calculates the magnitude square. Fixed that! You can do such fixes yourself, by the way: you just need to sign up for a wiki account (had to close down the approval chain for unauthenticated edits to the wiki. Spam sucks.)
> 2) I write a generic SNR routine as a Python block. It seems OK.
Hello,
1) In Log Power FFT documentation 'Create a log10(abs(fft)) stream chain, with real or complex input.' it seems that is missing the ^2.
2) I write a generic SNR routine as a Python block. It seems OK.
import numpy as npfrom gnuradio import gr
class my_snr(gr.decim_block): # decimation = fft_size"""SNR calculation by George SV1BDS"""
def __init__(self, fft_size = 1024 ): # only default arguments here"""arguments to this function show up as parameters in GRC"""gr.decim_block.__init__(self,name='SNR', # will show up in GRCin_sig=[np.complex64],out_sig=[np.float32],decim = fft_size)self.set_relative_rate(1.0/fft_size)self.fft_size = fft_size
def work(self, input_items, output_items):"""SNR routine"""a = np.asarray(input_items[0][:])f = np.fft.fft(a)x = 10*np.log10(np.real(f*np.conj(f)))output_items[0][:] = np.amax(x)-np.mean(x)return 1Is it of general interest to include it in GNURadio ?
Best regards
[Prev in Thread] | Current Thread | [Next in Thread] |