discuss-gnuradio
[Top][All Lists]
Advanced

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

SNR calculations


From: Al Grant
Subject: SNR calculations
Date: Mon, 1 Apr 2024 13:50:32 +1300

Hi,

I have a block of code in my wildlife tracker that detects high/low beeps in a frequency. When the signal is weak the smoothing is particularly helpful at detecting real beeps from the background - but it causing me issues with calculating beep length and SNR calculations - please let me explain:

This is my smoothing:

        # smoothing
        samples = signal.convolve(samples, [1]*189, 'same')/189

189 is the number of expected samples and after smoothing looks like this ( triangular orange line / blue line before smoothing )
90b66410-2d68-4d5f-bc29-0eb568eb077a.png 
The high/low samples detection looks like:

        # Get a boolean array for all samples higher or lower than the threshold
        self.threshold = np.median(samples) * 1.5 # go just above noise floor
        low_samples = samples < self.threshold
        high_samples = samples >= self.threshold

        # Compute the rising edge and falling edges by comparing the current value to the next with
        # the boolean operator & (if both are true the result is true) and converting this to an index
        # into the current array
        rising_edge_idx = np.nonzero(low_samples[:-1] & np.roll(high_samples, -1)[:-1])[0]
        falling_edge_idx = np.nonzero(high_samples[:-1] & np.roll(low_samples, -1)[:-1])[0]

        if len(rising_edge_idx) > 0:
            self.rising_edge = rising_edge_idx[0]

        if len(falling_edge_idx) > 0:
            self.falling_edge = falling_edge_idx[0]

While the smoothing (orange line) improves beep detection when the signal is weak, it introduces two new issues:

1. Beep length calculations are off because of the extended length of "high samples" and;
2. SNR calculations are considerably higher (and I am not sure which SNR is "correct")

Any suggestions on how to work with this issue would be appreciated greatly.

Thanks

AL





reply via email to

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