From: Tom Rondeau Date: Sat, 15 Jan 2011 22:21:14 +0000 (-0500) Subject: Using .min and .max on scipy arrays instead of min() max(); seems to be more portable. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=7b5095514204a524afbf6fd97bb70511519e5b35;p=debian%2Fgnuradio Using .min and .max on scipy arrays instead of min() max(); seems to be more portable. --- diff --git a/gr-utils/src/python/gr_plot_psd.py b/gr-utils/src/python/gr_plot_psd.py index b386d35a..1b653d61 100755 --- a/gr-utils/src/python/gr_plot_psd.py +++ b/gr-utils/src/python/gr_plot_psd.py @@ -94,7 +94,7 @@ class gr_plot_psd: print "End of File" else: tstep = 1.0 / self.sample_rate - self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))] + self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))]) self.iq_psd, self.freq = self.dopsd(self.iq) @@ -154,13 +154,14 @@ class gr_plot_psd: imags = self.iq.imag self.plot_iq[0].set_data([self.time, reals]) self.plot_iq[1].set_data([self.time, imags]) - self.sp_iq.set_xlim(min(self.time), max(self.time)) - self.sp_iq.set_ylim([1.5*min([min(reals), min(imags)]), - 1.5*max([max(reals), max(imags)])]) + self.sp_iq.set_xlim(self.time.min(), self.time.max()) + self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]), + 1.5*max([reals.max(), imags.max()])]) def draw_psd(self): self.plot_psd[0].set_data([self.freq, self.iq_psd]) - self.sp_psd.set_ylim([min(self.iq_psd)-10, max(self.iq_psd)+10]) + self.sp_psd.set_ylim([self.iq_psd.min()-10, self.iq_psd.max()+10]) + self.sp_psd.set_xlim([self.freq.min(), self.freq.max()]) def draw_spec(self): overlap = self.specfftsize/4 @@ -168,7 +169,7 @@ class gr_plot_psd: self.sp_spec.clear() self.sp_spec.specgram(self.iq, self.specfftsize, self.sample_rate, window = lambda d: d*winfunc(self.specfftsize), - noverlap = overlap, xextent=[min(self.time), max(self.time)]) + noverlap = overlap, xextent=[self.time.min(), self.time.max()]) def update_plots(self): self.draw_time() @@ -194,8 +195,8 @@ class gr_plot_psd: iq_psd, freq = self.dopsd(iq) self.plot_psd[0].set_data(freq, iq_psd) - self.sp_psd.axis([min(freq), max(freq), - min(iq_psd)-10, max(iq_psd)+10]) + self.sp_psd.axis([freq.min(), freq.max(), + iq_psd.min()-10, iq_psd.max()+10]) draw()