def __init__(self, grblock, *args): Qwt.QwtPlot.__init__(self, *args) self.setCanvasBackground(Qt.Qt.white) self.grblock = grblock # Initialize data self.t = np.arange(self.grblock.ntau) self.cir_real = np.zeros(self.t.size) self.cir_imag = np.zeros(self.t.size) self.setTitle("Channel Impulse Response") self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend) self.cir_real_curve = Qwt.QwtPlotCurve("CIR real") self.cir_real_curve.attach(self) self.cir_real_curve.setPen(Qt.QPen(Qt.Qt.blue)) self.cir_imag_curve = Qwt.QwtPlotCurve("CIR imag") self.cir_imag_curve.attach(self) self.cir_imag_curve.setPen(Qt.QPen(Qt.Qt.red)) # draw a black line at Y = 0 mY = Qwt.QwtPlotMarker() mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop) mY.setLineStyle(Qwt.QwtPlotMarker.HLine) mY.setYValue(0.0) mY.attach(self) self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)") scale = time_scale(self.grblock.t_symbol) self.setAxisScaleDraw(Qwt.QwtPlot.xBottom, scale) self.setAxisTitle(Qwt.QwtPlot.yLeft, "Amplitude") self.setAxisScale(Qwt.QwtPlot.yLeft, -1, 1) # zoomer self.zoomer = Qwt.QwtPlotZoomer( Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.DragSelection, Qwt.QwtPicker.AlwaysOff, self.canvas() ) self.zoomer.setRubberBandPen(Qt.QPen(Qt.Qt.green)) # picker showing the coordinates at the mouse pointer self.picker = QwtPlotPicker( self.grblock.t_symbol, Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.AlwaysOn, self.canvas(), ) self.picker.setTrackerPen(Qt.QPen(Qt.Qt.cyan))
def __init__(self, grblock, *args): Qwt.QwtPlot.__init__(self, *args) self.setCanvasBackground(Qt.Qt.white) self.grblock = grblock # Initialize data self.t = np.arange(self.grblock.ntau) self.pdp = np.zeros(self.t.size) self.setTitle("Power Delay Profile") self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend); self.pdpcurve = Qwt.QwtPlotCurve("PDP") self.pdpcurve.attach(self) self.pdpcurve.setPen(Qt.QPen(Qt.Qt.red)) mY = Qwt.QwtPlotMarker() mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop) mY.setLineStyle(Qwt.QwtPlotMarker.HLine) mY.setYValue(0.0) mY.attach(self) self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)") scale = time_scale(self.grblock.t_symbol) self.setAxisScaleDraw( Qwt.QwtPlot.xBottom, scale ) self.setAxisTitle(Qwt.QwtPlot.yLeft, "Power") self.setAxisScale(Qwt.QwtPlot.yLeft, -100, 0) # for linear scale #self.setAxisScale(Qwt.QwtPlot.yLeft, 0, 2) # zoomer self.zoomer = Qwt.QwtPlotZoomer(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.DragSelection, Qwt.QwtPicker.AlwaysOff, self.canvas()) self.zoomer.setRubberBandPen(Qt.QPen(Qt.Qt.green)) # picker showing the coordinates at the mouse pointer self.picker = QwtPlotPicker(self.grblock.t_symbol, Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.AlwaysOn, self.canvas()) self.picker.setTrackerPen(Qt.QPen(Qt.Qt.cyan))
def __init__(self, grblock, *args): Qwt.QwtPlot.__init__(self, *args) self.setCanvasBackground(Qt.Qt.white) self.grblock = grblock # Initialize data self.t = np.arange(self.grblock.ntau) self.pdp = np.zeros(self.t.size) self.setTitle("Power Delay Profile") self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend) self.pdpcurve = Qwt.QwtPlotCurve("PDP") self.pdpcurve.attach(self) self.pdpcurve.setPen(Qt.QPen(Qt.Qt.red)) mY = Qwt.QwtPlotMarker() mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop) mY.setLineStyle(Qwt.QwtPlotMarker.HLine) mY.setYValue(0.0) mY.attach(self) self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)") scale = time_scale(self.grblock.t_symbol) self.setAxisScaleDraw(Qwt.QwtPlot.xBottom, scale) self.setAxisTitle(Qwt.QwtPlot.yLeft, "Power") self.setAxisScale(Qwt.QwtPlot.yLeft, -100, 0) # for linear scale #self.setAxisScale(Qwt.QwtPlot.yLeft, 0, 2) # zoomer self.zoomer = Qwt.QwtPlotZoomer(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.DragSelection, Qwt.QwtPicker.AlwaysOff, self.canvas()) self.zoomer.setRubberBandPen(Qt.QPen(Qt.Qt.green)) # picker showing the coordinates at the mouse pointer self.picker = QwtPlotPicker(self.grblock.t_symbol, Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.AlwaysOn, self.canvas()) self.picker.setTrackerPen(Qt.QPen(Qt.Qt.cyan))
def __init__(self, grblock, *args): Qwt.QwtPlot.__init__(self, *args) self.grblock = grblock self.scatter = np.zeros( (self.grblock.nt, self.grblock.ntau) ) # set plot title self.setTitle('Scattering Function') # set plot layout self.plotLayout().setMargin(0) self.plotLayout().setCanvasMargin(0) self.plotLayout().setAlignCanvasToScales(True) # set legend legend = Qwt.QwtLegend() legend.setItemMode(Qwt.QwtLegend.ClickableItem) self.insertLegend(legend, Qwt.QwtPlot.RightLegend) # set axis titles self.setAxisTitle(Qwt.QwtPlot.xBottom, 'Delay (s)') self.setAxisTitle(Qwt.QwtPlot.yLeft, 'Doppler Spectrum (Hz)') # scale x-axis t_scale = time_scale(self.grblock.t_symbol) self.setAxisScaleDraw( Qwt.QwtPlot.xBottom, t_scale ) # scale y-axis f_scale = freq_scale( self.grblock.prf, self.grblock.nt) self.setAxisScaleDraw( Qwt.QwtPlot.yLeft, f_scale ) # create a QwtRasterData instance to store the numpy array # produced by the GNU Radio Python sink block self.scatter_data = ScatterData(self.scatter) # create a QwtPlotSpectrogram instance to plot the QwtRasterData self.plot_scatter = Qwt.QwtPlotSpectrogram() # create a greyscale colormap colorMap = Qwt.QwtLinearColorMap(Qt.Qt.black, Qt.Qt.white) self.plot_scatter.setColorMap(colorMap) # attach and pass the data self.plot_scatter.attach(self) self.plot_scatter.setData(self.scatter_data) # replot self.replot() # zoomer self.zoomer = Qwt.QwtPlotZoomer(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.DragSelection, Qwt.QwtPicker.AlwaysOff, self.canvas()) self.zoomer.setRubberBandPen(Qt.QPen(Qt.Qt.green)) # picker showing the coordinates at the mouse pointer self.picker = QwtPlotPicker(self.grblock.t_symbol, self.grblock.nt, self.grblock.prf, Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.AlwaysOn, self.canvas()) self.picker.setTrackerPen(Qt.QPen(Qt.Qt.cyan))
def __init__(self, grblock, *args): Qwt.QwtPlot.__init__(self, *args) self.grblock = grblock self.scatter = np.zeros((self.grblock.nt, self.grblock.ntau)) # set plot title self.setTitle('Scattering Function') # set plot layout self.plotLayout().setMargin(0) self.plotLayout().setCanvasMargin(0) self.plotLayout().setAlignCanvasToScales(True) # set legend legend = Qwt.QwtLegend() legend.setItemMode(Qwt.QwtLegend.ClickableItem) self.insertLegend(legend, Qwt.QwtPlot.RightLegend) # set axis titles self.setAxisTitle(Qwt.QwtPlot.xBottom, 'Delay (s)') self.setAxisTitle(Qwt.QwtPlot.yLeft, 'Doppler Spectrum (Hz)') # scale x-axis t_scale = time_scale(self.grblock.t_symbol) self.setAxisScaleDraw(Qwt.QwtPlot.xBottom, t_scale) # scale y-axis f_scale = freq_scale(self.grblock.prf, self.grblock.nt) self.setAxisScaleDraw(Qwt.QwtPlot.yLeft, f_scale) # create a QwtRasterData instance to store the numpy array # produced by the GNU Radio Python sink block self.scatter_data = ScatterData(self.scatter) # create a QwtPlotSpectrogram instance to plot the QwtRasterData self.plot_scatter = Qwt.QwtPlotSpectrogram() # create a greyscale colormap colorMap = Qwt.QwtLinearColorMap(Qt.Qt.black, Qt.Qt.white) self.plot_scatter.setColorMap(colorMap) # attach and pass the data self.plot_scatter.attach(self) self.plot_scatter.setData(self.scatter_data) # replot self.replot() # zoomer self.zoomer = Qwt.QwtPlotZoomer(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.DragSelection, Qwt.QwtPicker.AlwaysOff, self.canvas()) self.zoomer.setRubberBandPen(Qt.QPen(Qt.Qt.green)) # picker showing the coordinates at the mouse pointer self.picker = QwtPlotPicker(self.grblock.t_symbol, self.grblock.nt, self.grblock.prf, Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.AlwaysOn, self.canvas()) self.picker.setTrackerPen(Qt.QPen(Qt.Qt.cyan))