From 2105e82eb7d5cf5e5f44d3603c0111eecfaebe40 Mon Sep 17 00:00:00 2001 From: jblum Date: Wed, 6 Aug 2008 20:11:53 +0000 Subject: set decim git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9194 221aa14e-8319-0410-a670-987f0aec2ac5 --- .../src/python/gnuradio/blks2impl/logpwrfft.py | 19 +++++++++++++++++++ .../gnuradio/blks2impl/stream_to_vector_decimator.py | 16 +++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'gnuradio-core') diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py index e96159f1d..d10246cfe 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py @@ -65,6 +65,13 @@ class _logpwrfft_base(gr.hier_block2): self.set_avg_alpha(avg_alpha) self.set_average(average) + def set_decimation(self, decim): + """! + Set the decimation on stream decimator. + @param decim the new decimation + """ + self._sd.set_decimation(decim) + def set_sample_rate(self, sample_rate): """! Set the new sampling rate @@ -97,6 +104,18 @@ class _logpwrfft_base(gr.hier_block2): """ return self._sd.sample_rate() + def decimation(self): + """! + Return the current decimation. + """ + return self._sd.decimation() + + def frame_rate(self): + """! + Return the current frame rate. + """ + return self._sd.frame_rate() + def average(self): """! Return whether or not averaging is being performed. diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py b/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py index ff3a6b955..17dd67ded 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py @@ -63,10 +63,24 @@ class stream_to_vector_decimator(gr.hier_block2): self._vec_rate = vec_rate self._update_decimator() + def set_decimation(self, decim): + """! + Set the decimation parameter directly. + @param decim the new decimation + """ + self._decim = max(1, int(round(decim))) + self.one_in_n.set_n(self._decim) + def _update_decimator(self): - self._decim = max(1, int(self._sample_rate/self._vec_len/self._vec_rate)) + self._decim = max(1, int(round(self._sample_rate/self._vec_len/self._vec_rate))) self.one_in_n.set_n(self._decim) + def decimation(self): + """! + Returns the actual decimation. + """ + return self._decim + def sample_rate(self): """! Returns configured sample rate. -- cgit