diff options
author | Marcus Müller <marcus@hostalia.de> | 2018-08-24 23:00:55 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-11-02 22:15:53 +0100 |
commit | 797994a11ac5ec6bee9ea01c092947d0c34115f1 (patch) | |
tree | 7381f53008ba56e6b93398fa92be482d12da4f43 /gr-dtv | |
parent | e07751acc8424f4dd987f79c32dd247ed347902c (diff) |
Replace scipy/pylab where numpy/pyplot is sufficient
This should reduce the number of times users are prompted to install
pylab || scipy when they'd actually get away with functionality fully
contained in numpy and matplotlib.
This only solves the obvious cases. There's some usage of `pylab.mlab`
that would need more than 20s of consideration.
Diffstat (limited to 'gr-dtv')
-rw-r--r-- | gr-dtv/examples/atsc_ctrlport_monitor.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gr-dtv/examples/atsc_ctrlport_monitor.py b/gr-dtv/examples/atsc_ctrlport_monitor.py index 5329da2d44..9f233d9ff5 100644 --- a/gr-dtv/examples/atsc_ctrlport_monitor.py +++ b/gr-dtv/examples/atsc_ctrlport_monitor.py @@ -28,8 +28,8 @@ matplotlib.use("QT4Agg") import matplotlib.pyplot as plt import matplotlib.animation as animation from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient -import scipy -from scipy import fftpack +import numpy +from numpy.fft import fftpack """ If a host is running the ATSC receiver chain with ControlPort @@ -51,7 +51,7 @@ class atsc_ctrlport_monitor(object): vt_init_key = 'dtv_atsc_viterbi_decoder0::decoder_metrics' data = self.radio.getKnobs([vt_init_key])[vt_init_key] - init_metric = scipy.mean(data.value) + init_metric = numpy.mean(data.value) self._viterbi_metric = 100*[init_metric,] table_col_labels = ('Num Packets', 'Error Rate', 'Packet Error Rate', @@ -102,7 +102,7 @@ class atsc_ctrlport_monitor(object): vt_decoder_metrics = data[vt_metrics_key] snr_est = data[snr_key] - vt_decoder_metrics = scipy.mean(vt_decoder_metrics.value) + vt_decoder_metrics = numpy.mean(vt_decoder_metrics.value) self._viterbi_metric.pop() self._viterbi_metric.insert(0, vt_decoder_metrics) @@ -117,9 +117,9 @@ class atsc_ctrlport_monitor(object): self._sp0.set_ylim(min(eqdata.value), max(eqdata.value)) fs = 6.25e6 - freq = scipy.linspace(-fs / 2, fs / 2, 10000) - H = fftpack.fftshift(fftpack.fft(eqdata.value, 10000)) - HdB = 20.0*scipy.log10(abs(H)) + freq = numpy.linspace(-fs / 2, fs / 2, 10000) + H = numpy.fft.fftshift(fftpack.fft(eqdata.value, 10000)) + HdB = 20.0*numpy.log10(abs(H)) psd.set_ydata(HdB) psd.set_xdata(freq) self._sp1.set_xlim(0, fs / 2) @@ -139,7 +139,7 @@ class atsc_ctrlport_monitor(object): table._cells[(1,0)]._text.set_text("{0}".format(rs_num_packets.value)) table._cells[(1,1)]._text.set_text("{0:.2g}".format(ber)) table._cells[(1,2)]._text.set_text("{0:.2g}".format(per)) - table._cells[(1,3)]._text.set_text("{0:.1f}".format(scipy.mean(self._viterbi_metric))) + table._cells[(1,3)]._text.set_text("{0:.1f}".format(numpy.mean(self._viterbi_metric))) table._cells[(1,4)]._text.set_text("{0:.4f}".format(snr_est.value[0])) return (taps, psd, syms, table) |