From 6e4d3240e8c92d040a9bd0b22204845551137cc4 Mon Sep 17 00:00:00 2001 From: Rune Broberg Date: Tue, 8 Oct 2019 13:49:38 +0200 Subject: [PATCH] - Corrected roll-off calculation --- NanoVNASaver/Analysis.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/NanoVNASaver/Analysis.py b/NanoVNASaver/Analysis.py index b0e4e30..7668c55 100644 --- a/NanoVNASaver/Analysis.py +++ b/NanoVNASaver/Analysis.py @@ -577,10 +577,11 @@ class BandPassAnalysis(Analysis): self.upper_six_db_label.setText(NanoVNASaver.formatFrequency(upper_six_db_cutoff_frequency)) upper_six_db_attenuation = NanoVNASaver.gain(self.app.data21[upper_six_db_location]) - upper_max_attenuation = NanoVNASaver.gain(self.app.data21[0]) - frequency_factor = self.app.data21[0].freq / upper_six_db_cutoff_frequency + upper_max_attenuation = NanoVNASaver.gain(self.app.data21[len(self.app.data21)-1]) + frequency_factor = upper_six_db_cutoff_frequency / self.app.data21[len(self.app.data21)-1].freq upper_attenuation = (upper_max_attenuation - upper_six_db_attenuation) - logger.debug("Measured points: %d Hz and %d Hz", upper_six_db_cutoff_frequency, self.app.data21[0].freq) + logger.debug("Measured points: %d Hz and %d Hz", upper_six_db_cutoff_frequency, + self.app.data21[len(self.app.data21)-1].freq) logger.debug("%d dB over %f factor", upper_attenuation, frequency_factor) octave_attenuation = upper_attenuation / (math.log10(frequency_factor) / math.log10(2)) self.upper_db_per_octave_label.setText(str(round(octave_attenuation, 3)) + " dB / octave")