コード例 #1
0
ファイル: windows.py プロジェクト: 232675/RTLSDR-Scanner
 def set_spectrum2(self, spectrum):
     self.spectrum2 = spectrum
     freqs, powers = split_spectrum(spectrum)
     self.plotScan2.set_xdata(freqs)
     self.plotScan2.set_ydata(powers)
     self.plot_diff()
     self.axesScan.relim()
     self.axesScan.autoscale_view()
     self.canvas.draw()
コード例 #2
0
ファイル: windows.py プロジェクト: 232675/RTLSDR-Scanner
    def plot_diff(self):
        diff = {}

        if self.spectrum1 is not None and self.spectrum2 is not None:
            set1 = set(self.spectrum1)
            set2 = set(self.spectrum2)
            intersect = set1.intersection(set2)
            for freq in intersect:
                diff[freq] = self.spectrum1[freq] - self.spectrum2[freq]
            freqs, powers = split_spectrum(diff)
            self.plotDiff.set_xdata(freqs)
            self.plotDiff.set_ydata(powers)
        elif self.spectrum1 is None:
            freqs, powers = split_spectrum(self.spectrum2)
            self.plotDiff.set_xdata(freqs)
            self.plotDiff.set_ydata([0] * len(freqs))
        else:
            freqs, powers = split_spectrum(self.spectrum1)
            self.plotDiff.set_xdata(freqs)
            self.plotDiff.set_ydata([0] * len(freqs))

        self.axesDiff.relim()
        self.axesDiff.autoscale_view()
コード例 #3
0
ファイル: plot.py プロジェクト: 232675/RTLSDR-Scanner
    def run(self):
        setup_plot(self.graph, self.settings, self.grid)

        axes = self.graph.get_axes()
        if not self.settings.retainScans:
            self.remove_plot(axes, Plot.STR_FULL)
        self.remove_plot(axes, Plot.STR_PARTIAL)

        if self.full:
            name = Plot.STR_FULL
        else:
            name = Plot.STR_PARTIAL
        self.graph.get_canvas().Name = name

        freqs, powers = split_spectrum(self.spectrum)
        axes.plot(freqs, powers, linewidth=0.4, color='b', alpha=1, gid=name)
        self.retain_plot(axes)

        if self.full:
            self.annotate(axes)

        self.graph.get_figure().tight_layout()

        wx.PostEvent(self.notify, EventThreadStatus(Event.DRAW))