Exemplo n.º 1
0
    def __init__(self, parent):
        super(PlotTauG, self).__init__(parent)


        self.chkWarnings = QCheckBox()
        self.chkWarnings.setText("Enable Warnings")
        self.chkWarnings.setChecked(False)
        self.chkWarnings.setToolTip("Print warnings about singular group delay")

        self.layHChkBoxes = QHBoxLayout()
        self.layHChkBoxes.addStretch(10)
        self.layHChkBoxes.addWidget(self.chkWarnings)

        self.mplwidget = MplWidget(self)
        
        self.mplwidget.layVMainMpl.addLayout(self.layHChkBoxes)
        
        self.setLayout(self.mplwidget.layVMainMpl)

        # make this the central widget, taking all available space:
#        self.setCentralWidget(self.mplwidget)

        
        self._init_axes()

        self.draw() # initial drawing of tau_g

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.chkWarnings.clicked.connect(self.draw)
Exemplo n.º 2
0
    def __init__(self, parent): 
        super(PlotPZ, self).__init__(parent)

        layHControls = QHBoxLayout()
        layHControls.addStretch(10)
        
        # This widget encompasses all control subwidgets:
#        self.frmControls = QFrame(self)
#        self.frmControls.setLayout(layHControls)


        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        self.mplwidget = MplWidget(self)
        self.mplwidget.layVMainMpl.addLayout(layHControls)
        self.mplwidget.layVMainMpl.setContentsMargins(*params['wdg_margins'])
        self.setLayout(self.mplwidget.layVMainMpl)

        # make this the central widget, taking all available space:
 #       self.setCentralWidget(self.mplwidget)
        
        self._init_axes()

        self.draw() # calculate and draw poles and zeros
Exemplo n.º 3
0
    def __init__(self, parent):
        super(PlotTauG, self).__init__(parent)
        self.verbose = False  # suppress warnings

        # =============================================================================
        # #### not needed at the moment ###
        #         self.chkWarnings = QCheckBox("Enable Warnings", self)
        #         self.chkWarnings.setChecked(False)
        #         self.chkWarnings.setToolTip("Print warnings about singular group delay")
        #
        #         layHControls = QHBoxLayout()
        #         layHControls.addStretch(10)
        #         layHControls.addWidget(self.chkWarnings)
        #
        #         # This widget encompasses all control subwidgets:
        #         self.frmControls = QFrame(self)
        #         self.frmControls.setObjectName("frmControls")
        #         self.frmControls.setLayout(layHControls)
        #
        # =============================================================================
        self.mplwidget = MplWidget(self)
        #        self.mplwidget.layVMainMpl.addWidget(self.frmControls)
        self.mplwidget.layVMainMpl.setContentsMargins(*params['wdg_margins'])
        self.setLayout(self.mplwidget.layVMainMpl)

        self.init_axes()
        self.draw()  # initial drawing of tau_g

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.mplwidget.mplToolbar.sigEnabled.connect(self.enable_ui)
Exemplo n.º 4
0
    def __init__(self, parent):
        super(PlotTauG, self).__init__(parent)

        self.chkWarnings = QCheckBox("Enable Warnings", self)
        self.chkWarnings.setChecked(False)
        self.chkWarnings.setToolTip(
            "Print warnings about singular group delay")

        layHControls = QHBoxLayout()
        layHControls.addStretch(10)
        layHControls.addWidget(self.chkWarnings)

        # This widget encompasses all control subwidgets:
        self.frmControls = QFrame(self)
        self.frmControls.setObjectName("frmControls")
        self.frmControls.setLayout(layHControls)

        self.mplwidget = MplWidget(self)
        self.mplwidget.layVMainMpl.addWidget(self.frmControls)
        self.mplwidget.layVMainMpl.setContentsMargins(*params['wdg_margins'])
        self.setLayout(self.mplwidget.layVMainMpl)

        self.ax = self.mplwidget.fig.add_subplot(111)

        self.draw()  # initial drawing of tau_g

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.chkWarnings.clicked.connect(self.draw)
Exemplo n.º 5
0
    def __init__(self, parent):
        super(PlotPhi, self).__init__(parent)

        self.cmbUnitsPhi = QComboBox(self)
        units = ["rad", "rad/pi",  "deg"]
        scales = [1.,   1./ np.pi, 180./np.pi]
        for unit, scale in zip(units, scales):
            self.cmbUnitsPhi.addItem(unit, scale)
        self.cmbUnitsPhi.setObjectName("cmbUnitsA")
        self.cmbUnitsPhi.setToolTip("Set unit for phase.")
        self.cmbUnitsPhi.setCurrentIndex(0)
        self.cmbUnitsPhi.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        self.chkWrap = QCheckBox("Wrapped Phase", self)
        self.chkWrap.setChecked(False)
        self.chkWrap.setToolTip("Plot phase wrapped to +/- pi")
        
        layHControls = QHBoxLayout()
#        layHControls.addStretch(10)
        layHControls.addWidget(self.cmbUnitsPhi)
        layHControls.addWidget(self.chkWrap)
        layHControls.addStretch(10)
        
        # This widget encompasses all control subwidgets:
        self.frmControls = QFrame(self)
        self.frmControls.setObjectName("frmControls")
        self.frmControls.setLayout(layHControls)


        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        self.mplwidget = MplWidget(self)
        self.mplwidget.layVMainMpl.addWidget(self.frmControls)
        self.mplwidget.layVMainMpl.setContentsMargins(*params['wdg_margins'])
        self.setLayout(self.mplwidget.layVMainMpl)

        self.init_axes()

        self.draw() # initial drawing

#        #=============================================
#        # Signals & Slots
#        #=============================================
        self.chkWrap.clicked.connect(self.draw)
        self.cmbUnitsPhi.currentIndexChanged.connect(self.draw)
        self.mplwidget.mplToolbar.sigEnabled.connect(self.enable_ui)        
Exemplo n.º 6
0
    def __init__(self, parent):
        super(PlotPhi, self).__init__(parent)

        self.cmbUnitsPhi = QtGui.QComboBox(self)
        units = ["rad", "rad/pi", "deg"]
        scales = [1., 1. / np.pi, 180. / np.pi]
        for unit, scale in zip(units, scales):
            self.cmbUnitsPhi.addItem(unit, scale)
        self.cmbUnitsPhi.setObjectName("cmbUnitsA")
        self.cmbUnitsPhi.setToolTip("Set unit for phase.")
        self.cmbUnitsPhi.setCurrentIndex(0)
        self.cmbUnitsPhi.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)

        self.lblWrap = QtGui.QLabel("Wrapped Phase")
        self.btnWrap = QtGui.QCheckBox()
        self.btnWrap.setChecked(False)
        self.btnWrap.setToolTip("Plot phase wrapped to +/- pi")
        self.layHChkBoxes = QtGui.QHBoxLayout()
        self.layHChkBoxes.addStretch(10)
        self.layHChkBoxes.addWidget(self.cmbUnitsPhi)
        self.layHChkBoxes.addWidget(self.lblWrap)
        self.layHChkBoxes.addWidget(self.btnWrap)
        self.layHChkBoxes.addStretch(10)

        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        self.mplwidget = MplWidget(self)

        self.mplwidget.layVMainMpl.addLayout(self.layHChkBoxes)

        self.setLayout(self.mplwidget.layVMainMpl)

        #        self.mplwidget.setFocus()
        # make this the central widget, taking all available space:
        #        self.setCentralWidget(self.mplwidget)

        self._init_axes()

        self.draw()  # initial drawing

        #        #=============================================
        #        # Signals & Slots
        #        #=============================================
        self.btnWrap.clicked.connect(self.draw)
        self.cmbUnitsPhi.currentIndexChanged.connect(self.draw)
Exemplo n.º 7
0
    def __init__(self, parent):
        super(PlotPZ, self).__init__(parent)

        self.layHChkBoxes = QtGui.QHBoxLayout()
        self.layHChkBoxes.addStretch(10)

        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        self.mplwidget = MplWidget(self)

        self.mplwidget.layVMainMpl.addLayout(self.layHChkBoxes)

        self.setLayout(self.mplwidget.layVMainMpl)

        # make this the central widget, taking all available space:
        #       self.setCentralWidget(self.mplwidget)

        self._init_axes()

        self.draw()  # calculate and draw poles and zeros
Exemplo n.º 8
0
    def _init_UI(self):
        self.chkLog = QCheckBox(self)
        self.chkLog.setObjectName("chkLog")
        self.chkLog.setToolTip("<span>Logarithmic scale for y-axis.</span>")
        self.chkLog.setChecked(False)
        self.lblLog = QLabel("Log. y-axis", self)

        self.lblLogBottom = QLabel("Bottom = ", self)
        self.ledLogBottom = QLineEdit(self)
        self.ledLogBottom.setText("-80")
        self.ledLogBottom.setToolTip("Minimum display value for log. scale.")
        self.lbldB = QLabel("dB")

        self.lblPltStim = QLabel(self)
        self.lblPltStim.setText("Stimulus:")
        self.chkPltStim = QCheckBox("Show", self)
        self.chkPltStim.setChecked(False)
        self.chkPltStim.setToolTip("Show stimulus signal.")

        self.lblStimulus = QLabel("Type = ", self)
        self.cmbStimulus = QComboBox(self)
        self.cmbStimulus.addItems([
            "Pulse", "Step", "StepErr", "Sine", "Rect", "Saw", "RandN", "RandU"
        ])
        self.cmbStimulus.setToolTip("Select stimulus type.")

        self.lblFreq = QLabel("<i>f</i>&nbsp; =", self)

        self.ledFreq = QLineEdit(self)
        self.ledFreq.setText(str(self.stim_freq))
        self.ledFreq.setToolTip("Stimulus frequency.")

        self.lblFreqUnit = QLabel("f_S", self)

        self.lblNPoints = QLabel("<i>N</i>&nbsp; =", self)

        self.ledNPoints = QLineEdit(self)
        self.ledNPoints.setText("0")
        self.ledNPoints.setToolTip(
            "Number of points to calculate and display.\n"
            "N = 0 selects automatically.")

        layHControls = QHBoxLayout()

        layHControls.addWidget(self.lblNPoints)
        layHControls.addWidget(self.ledNPoints)
        layHControls.addStretch(2)
        layHControls.addWidget(self.chkLog)
        layHControls.addWidget(self.lblLog)
        layHControls.addStretch(1)
        layHControls.addWidget(self.lblLogBottom)
        layHControls.addWidget(self.ledLogBottom)
        layHControls.addWidget(self.lbldB)
        layHControls.addStretch(2)
        layHControls.addWidget(self.lblPltStim)
        layHControls.addWidget(self.chkPltStim)
        layHControls.addStretch(1)
        layHControls.addWidget(self.lblStimulus)
        layHControls.addWidget(self.cmbStimulus)
        layHControls.addStretch(2)
        layHControls.addWidget(self.lblFreq)
        layHControls.addWidget(self.ledFreq)
        layHControls.addWidget(self.lblFreqUnit)

        layHControls.addStretch(10)

        # This widget encompasses all control subwidgets:
        self.frmControls = QFrame(self)
        self.frmControls.setObjectName("frmControls")
        self.frmControls.setLayout(layHControls)

        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        self.mplwidget = MplWidget(self)
        self.mplwidget.layVMainMpl.addWidget(self.frmControls)
        self.mplwidget.layVMainMpl.setContentsMargins(*params['wdg_margins'])
        self.setLayout(self.mplwidget.layVMainMpl)

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.chkLog.clicked.connect(self.draw)
        self.ledNPoints.editingFinished.connect(self.draw)
        self.ledLogBottom.editingFinished.connect(self.draw)
        self.chkPltStim.clicked.connect(self.draw)
        #        self.cmbStimulus.currentIndexChanged.connect(self.draw)
        self.cmbStimulus.activated.connect(self.draw)
        self.ledFreq.installEventFilter(self)

        self.draw()  # initial calculation and drawing
Exemplo n.º 9
0
    def _init_UI(self):
        self.chkLog = QtGui.QCheckBox(self)
        self.chkLog.setText("Log.")
        self.chkLog.setObjectName("chkLog")
        self.chkLog.setToolTip("Logarithmic scale")
        self.chkLog.setChecked(False)

        self.chkPolar = QtGui.QCheckBox(self)
        self.chkPolar.setText("Polar")
        self.chkPolar.setObjectName("chkPolar")
        self.chkPolar.setToolTip("Polar coordinates")
        self.chkPolar.setChecked(False)

        self.lblBottom = QtGui.QLabel("Bottom =")
        self.ledBottom = QtGui.QLineEdit(self)
        self.ledBottom.setObjectName("ledBottom")
        self.ledBottom.setText(str(self.zmin))
        self.ledBottom.setToolTip("Minimum display value.")

        self.lblTop = QtGui.QLabel("Top:")
        self.ledTop = QtGui.QLineEdit(self)
        self.ledTop.setObjectName("ledTop")
        self.ledTop.setText(str(self.zmax))
        self.ledTop.setToolTip("Maximum display value.")
        #        self.ledTop.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum)

        self.chkUC = QtGui.QCheckBox(self)
        self.chkUC.setText("UC")
        self.chkUC.setObjectName("chkUC")
        self.chkUC.setToolTip("Plot unit circle")
        self.chkUC.setChecked(True)

        self.chkPZ = QtGui.QCheckBox(self)
        self.chkPZ.setText("P/Z")
        self.chkPZ.setObjectName("chkPZ")
        self.chkPZ.setToolTip("Plot poles and zeros")
        self.chkPZ.setChecked(True)

        self.chkHf = QtGui.QCheckBox(self)
        self.chkHf.setText("H(f)")
        self.chkHf.setObjectName("chkHf")
        self.chkHf.setToolTip("Plot H(f) along the unit circle")
        self.chkHf.setChecked(True)

        modes = ['None', 'Mesh', 'Surf', 'Contour']
        self.cmbMode3D = QtGui.QComboBox(self)
        self.cmbMode3D.addItems(modes)
        self.cmbMode3D.setObjectName("cmbShow3D")
        self.cmbMode3D.setToolTip("Select 3D-plot mode.")
        self.cmbMode3D.setCurrentIndex(0)
        self.cmbMode3D.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)

        self.chkColormap_r = QtGui.QCheckBox(self)
        self.chkColormap_r.setText("reverse")
        self.chkColormap_r.setToolTip("reverse colormap")
        self.chkColormap_r.setChecked(True)

        self.cmbColormap = QtGui.QComboBox(self)
        self._init_cmb_colormap()
        self.cmbColormap.setToolTip("Select colormap")

        self.chkColBar = QtGui.QCheckBox(self)
        self.chkColBar.setText("Colorbar")
        self.chkColBar.setObjectName("chkColBar")
        self.chkColBar.setToolTip("Show colorbar")
        self.chkColBar.setChecked(False)

        self.chkLighting = QtGui.QCheckBox(self)
        self.chkLighting.setText("Lighting")
        self.chkLighting.setObjectName("chkLighting")
        self.chkLighting.setToolTip("Enable light source")
        self.chkLighting.setChecked(False)

        self.lblAlpha = QtGui.QLabel("Alpha")
        self.diaAlpha = QtGui.QDial(self)
        self.diaAlpha.setRange(0., 10.)
        self.diaAlpha.setValue(10)
        self.diaAlpha.setTracking(False)  # produce less events when turning
        self.diaAlpha.setFixedHeight(30)
        self.diaAlpha.setFixedWidth(30)
        self.diaAlpha.setWrapping(False)
        self.diaAlpha.setToolTip(
            "Set transparency for surf and 3D-contour plot.")

        self.lblHatch = QtGui.QLabel("Stride")
        self.diaHatch = QtGui.QDial(self)
        self.diaHatch.setRange(0., 9.)
        self.diaHatch.setValue(5)
        self.diaHatch.setTracking(False)  # produce less events when turning
        self.diaHatch.setFixedHeight(30)
        self.diaHatch.setFixedWidth(30)
        self.diaHatch.setWrapping(False)
        self.diaHatch.setToolTip("Set hatching for H(jw).")

        self.chkContour2D = QtGui.QCheckBox(self)
        self.chkContour2D.setText("Contour2D")
        self.chkContour2D.setObjectName("chkContour2D")
        self.chkContour2D.setToolTip("Plot 2D-contours at z =0")
        self.chkContour2D.setChecked(False)

        #----------------------------------------------------------------------
        # LAYOUT for UI widgets
        #----------------------------------------------------------------------
        spc = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding,
                                QtGui.QSizePolicy.Minimum)
        self.layGSelect = QtGui.QGridLayout()
        self.layGSelect.setObjectName('plotSpecSelect')
        self.layGSelect.addWidget(self.chkLog, 0, 0)
        self.layGSelect.addWidget(self.chkPolar, 1, 0)
        self.layGSelect.addWidget(self.lblTop, 0, 2)
        self.layGSelect.addWidget(self.lblBottom, 1, 2)
        self.layGSelect.addWidget(self.ledTop, 0, 4)
        self.layGSelect.addWidget(self.ledBottom, 1, 4)
        self.layGSelect.addItem(spc, 0, 5)

        self.layGSelect.addWidget(self.chkUC, 0, 6)
        self.layGSelect.addWidget(self.chkHf, 1, 6)
        self.layGSelect.addWidget(self.chkPZ, 0, 8)
        self.layGSelect.addWidget(self.cmbColormap, 0, 10, 1, 1)
        self.layGSelect.addWidget(self.chkColormap_r, 1, 10)
        self.layGSelect.addWidget(self.cmbMode3D, 0, 12)
        self.layGSelect.addWidget(self.chkContour2D, 1, 12)
        self.layGSelect.addWidget(self.chkLighting, 0, 14)
        self.layGSelect.addWidget(self.chkColBar, 1, 14)

        self.layGSelect.addWidget(self.diaAlpha, 0, 16)
        self.layGSelect.addWidget(self.lblAlpha, 0, 15)
        self.layGSelect.addWidget(self.diaHatch, 1, 16)
        self.layGSelect.addWidget(self.lblHatch, 1, 15)

        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        self.mplwidget = MplWidget(self)

        self.mplwidget.layVMainMpl.addLayout(self.layGSelect)

        self.setLayout(self.mplwidget.layVMainMpl)

        #        self.mplwidget.setFocus()
        # make this the central widget, taking all available space:
        #        self.setCentralWidget(self.mplwidget)

        self._init_grid()  # initialize grid and do initial plot

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.chkLog.clicked.connect(self._log_clicked)
        self.ledBottom.editingFinished.connect(self._log_clicked)
        self.ledTop.editingFinished.connect(self._log_clicked)

        self.chkPolar.clicked.connect(self._init_grid)
        self.chkUC.clicked.connect(self.draw)
        self.chkHf.clicked.connect(self.draw)
        self.chkPZ.clicked.connect(self.draw)
        self.cmbMode3D.currentIndexChanged.connect(self.draw)
        self.chkColBar.clicked.connect(self.draw)

        self.cmbColormap.currentIndexChanged.connect(self.draw)
        self.chkColormap_r.clicked.connect(self._init_cmb_colormap)

        self.chkLighting.clicked.connect(self.draw)
        self.diaAlpha.valueChanged.connect(self.draw)
        self.diaHatch.valueChanged.connect(self.draw)
        self.chkContour2D.clicked.connect(self.draw)

        logger.debug("UI initialized")
Exemplo n.º 10
0
    def _construct_UI(self):
        self.chkLog = QCheckBox("Log.", self)
        self.chkLog.setObjectName("chkLog")
        self.chkLog.setToolTip("Logarithmic scale")
        self.chkLog.setChecked(False)

        self.chkPolar = QCheckBox("Polar", self)
        self.chkPolar.setObjectName("chkPolar")
        self.chkPolar.setToolTip("Polar coordinate range")
        self.chkPolar.setChecked(False)

        self.lblBottom = QLabel("Bottom =", self)
        self.ledBottom = QLineEdit(self)
        self.ledBottom.setObjectName("ledBottom")
        self.ledBottom.setText(str(self.zmin))
        self.ledBottom.setToolTip("Minimum display value.")

        self.lblTop = QLabel("Top:", self)
        self.ledTop = QLineEdit(self)
        self.ledTop.setObjectName("ledTop")
        self.ledTop.setText(str(self.zmax))
        self.ledTop.setToolTip("Maximum display value.")

        self.chkUC = QCheckBox("UC", self)
        self.chkUC.setObjectName("chkUC")
        self.chkUC.setToolTip("Plot unit circle")
        self.chkUC.setChecked(True)

        self.chkPZ = QCheckBox("P/Z", self)
        self.chkPZ.setObjectName("chkPZ")
        self.chkPZ.setToolTip("Plot poles and zeros")
        self.chkPZ.setChecked(True)

        self.chkHf = QCheckBox("H(f)", self)
        self.chkHf.setObjectName("chkHf")
        self.chkHf.setToolTip("Plot H(f) along the unit circle")
        self.chkHf.setChecked(True)

        modes = ['None', 'Mesh', 'Surf', 'Contour']
        self.cmbMode3D = QComboBox(self)
        self.cmbMode3D.addItems(modes)
        self.cmbMode3D.setObjectName("cmbShow3D")
        self.cmbMode3D.setToolTip("Select 3D-plot mode.")
        self.cmbMode3D.setCurrentIndex(0)
        self.cmbMode3D.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        self.chkColormap_r = QCheckBox("reverse", self)
        self.chkColormap_r.setToolTip("reverse colormap")
        self.chkColormap_r.setChecked(True)

        self.cmbColormap = QComboBox(self)
        self._init_cmb_colormap()
        self.cmbColormap.setToolTip("Select colormap")

        self.chkColBar = QCheckBox("Colorbar", self)
        self.chkColBar.setObjectName("chkColBar")
        self.chkColBar.setToolTip("Show colorbar")
        self.chkColBar.setChecked(False)

        self.chkLighting = QCheckBox("Lighting", self)
        self.chkLighting.setObjectName("chkLighting")
        self.chkLighting.setToolTip("Enable light source")
        self.chkLighting.setChecked(False)

        self.lblAlpha = QLabel("Alpha", self)
        self.diaAlpha = QDial(self)
        self.diaAlpha.setRange(0., 10.)
        self.diaAlpha.setValue(10)
        self.diaAlpha.setTracking(False)  # produce less events when turning
        self.diaAlpha.setFixedHeight(30)
        self.diaAlpha.setFixedWidth(30)
        self.diaAlpha.setWrapping(False)
        self.diaAlpha.setToolTip(
            "Set transparency for surf and 3D-contour plot.")

        self.lblHatch = QLabel("Stride", self)
        self.diaHatch = QDial(self)
        self.diaHatch.setRange(0., 9.)
        self.diaHatch.setValue(5)
        self.diaHatch.setTracking(False)  # produce less events when turning
        self.diaHatch.setFixedHeight(30)
        self.diaHatch.setFixedWidth(30)
        self.diaHatch.setWrapping(False)
        self.diaHatch.setToolTip("Set hatching for H(jw).")

        self.chkContour2D = QCheckBox("Contour2D", self)
        self.chkContour2D.setObjectName("chkContour2D")
        self.chkContour2D.setToolTip("Plot 2D-contours at z =0")
        self.chkContour2D.setChecked(False)

        #----------------------------------------------------------------------
        # LAYOUT for UI widgets
        #----------------------------------------------------------------------

        layGControls = QGridLayout()
        layGControls.addWidget(self.chkLog, 0, 0)
        layGControls.addWidget(self.chkPolar, 1, 0)
        layGControls.addWidget(self.lblTop, 0, 2)
        layGControls.addWidget(self.lblBottom, 1, 2)
        layGControls.addWidget(self.ledTop, 0, 4)
        layGControls.addWidget(self.ledBottom, 1, 4)
        layGControls.setColumnStretch(5, 1)

        layGControls.addWidget(self.chkUC, 0, 6)
        layGControls.addWidget(self.chkHf, 1, 6)
        layGControls.addWidget(self.chkPZ, 0, 8)

        layGControls.addWidget(self.cmbMode3D, 0, 10)
        layGControls.addWidget(self.chkContour2D, 1, 10)
        layGControls.addWidget(self.cmbColormap, 0, 12, 1, 1)
        layGControls.addWidget(self.chkColormap_r, 1, 12)

        layGControls.addWidget(self.chkLighting, 0, 14)
        layGControls.addWidget(self.chkColBar, 1, 14)

        layGControls.addWidget(self.lblAlpha, 0, 15)
        layGControls.addWidget(self.diaAlpha, 0, 16)

        layGControls.addWidget(self.lblHatch, 1, 15)
        layGControls.addWidget(self.diaHatch, 1, 16)

        # This widget encompasses all control subwidgets
        self.frmControls = QFrame(self)
        self.frmControls.setObjectName("frmControls")
        self.frmControls.setLayout(layGControls)

        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        # This is the plot pane widget, encompassing the other widgets
        self.mplwidget = MplWidget(self)
        self.mplwidget.layVMainMpl.addWidget(self.frmControls)
        self.mplwidget.layVMainMpl.setContentsMargins(*params['wdg_margins'])
        self.setLayout(self.mplwidget.layVMainMpl)

        self._init_grid()  # initialize grid and do initial plot

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.chkLog.clicked.connect(self._log_clicked)
        self.ledBottom.editingFinished.connect(self._log_clicked)
        self.ledTop.editingFinished.connect(self._log_clicked)

        self.chkPolar.clicked.connect(self._init_grid)
        self.chkUC.clicked.connect(self.draw)
        self.chkHf.clicked.connect(self.draw)
        self.chkPZ.clicked.connect(self.draw)
        self.cmbMode3D.currentIndexChanged.connect(self.draw)
        self.chkColBar.clicked.connect(self.draw)

        self.cmbColormap.currentIndexChanged.connect(self.draw)
        self.chkColormap_r.clicked.connect(self._init_cmb_colormap)

        self.chkLighting.clicked.connect(self.draw)
        self.diaAlpha.valueChanged.connect(self.draw)
        self.diaHatch.valueChanged.connect(self.draw)
        self.chkContour2D.clicked.connect(self.draw)

        self.mplwidget.mplToolbar.enable_update(
            state=False)  # disable initially
Exemplo n.º 11
0
    def _init_UI(self):
        self.lblLog = QLabel(self)
        self.lblLog.setText("Log:")
        self.chkLog = QCheckBox(self)
        self.chkLog.setObjectName("chkLog")
        self.chkLog.setToolTip("Show logarithmic impulse / step response.")
        self.chkLog.setChecked(False)

        self.lblLogBottom = QLabel("Bottom = ")
        self.ledLogBottom = QLineEdit(self)
        self.ledLogBottom.setText("-80")
        self.ledLogBottom.setToolTip("Minimum display value for log. scale.")
        self.lbldB = QLabel("dB")
        
        self.lblPltStim = QLabel(self)
        self.lblPltStim.setText("Stimulus:  Show")
        self.chkPltStim = QCheckBox(self)
        self.chkPltStim.setChecked(False)
        
        self.lblStimulus = QLabel("Type = ")
        self.cmbStimulus = QComboBox(self)
        self.cmbStimulus.addItems(["Pulse","Step","StepErr", "Sine", "Rect", "Saw"])
        self.cmbStimulus.setToolTip("Select stimulus type.")
        
        self.lblFreq = QLabel("<i>f</i>&nbsp; =")

        self.ledFreq = QLineEdit(self)
        self.ledFreq.setText(str(self.stim_freq))
        self.ledFreq.setToolTip("Stimulus frequency.")
        
        self.lblFreqUnit = QLabel("f_S")

        self.lblNPoints = QLabel("<i>N</i>&nbsp; =")

        self.ledNPoints = QLineEdit(self)
        self.ledNPoints.setText("0")
        self.ledNPoints.setToolTip("Number of points to calculate and display.\n"
                                   "N = 0 chooses automatically.")

        self.layHChkBoxes = QHBoxLayout()
        self.layHChkBoxes.addStretch(10)
        
        self.layHChkBoxes.addWidget(self.lblNPoints)
        self.layHChkBoxes.addWidget(self.ledNPoints)
        self.layHChkBoxes.addStretch(2)
        self.layHChkBoxes.addWidget(self.lblLog)
        self.layHChkBoxes.addWidget(self.chkLog)
        self.layHChkBoxes.addStretch(1)
        self.layHChkBoxes.addWidget(self.lblLogBottom)
        self.layHChkBoxes.addWidget(self.ledLogBottom)
        self.layHChkBoxes.addWidget(self.lbldB)
        self.layHChkBoxes.addStretch(2)
        self.layHChkBoxes.addWidget(self.lblPltStim)
        self.layHChkBoxes.addWidget(self.chkPltStim)
        self.layHChkBoxes.addStretch(1)
        self.layHChkBoxes.addWidget(self.lblStimulus)
        self.layHChkBoxes.addWidget(self.cmbStimulus)
        self.layHChkBoxes.addStretch(2)
        self.layHChkBoxes.addWidget(self.lblFreq)
        self.layHChkBoxes.addWidget(self.ledFreq)
        self.layHChkBoxes.addWidget(self.lblFreqUnit)

        self.layHChkBoxes.addStretch(10)

        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        self.mplwidget = MplWidget(self)

        self.mplwidget.layVMainMpl.addLayout(self.layHChkBoxes)

        self.setLayout(self.mplwidget.layVMainMpl)

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.chkLog.clicked.connect(self.draw)
        self.ledNPoints.editingFinished.connect(self.draw)
        self.ledLogBottom.editingFinished.connect(self.draw)
        self.chkPltStim.clicked.connect(self.draw)
        self.cmbStimulus.currentIndexChanged.connect(self.draw)
        self.ledFreq.installEventFilter(self) 
#        self.ledFreq.editingFinished.connect(self.draw)

        self.draw() # initial calculation and drawing
Exemplo n.º 12
0
    def __init__(self, parent):
        super(PlotHf, self).__init__(parent)

        modes = ['| H |', 're{H}', 'im{H}']
        self.cmbShowH = QComboBox(self)
        self.cmbShowH.addItems(modes)
        self.cmbShowH.setObjectName("cmbUnitsH")
        self.cmbShowH.setToolTip(
            "Show magnitude, real / imag. part of H or H \n"
            "without linear phase (acausal system).")
        self.cmbShowH.setCurrentIndex(0)

        self.lblIn = QLabel("in")

        units = ['dB', 'V', 'W', 'Auto']
        self.cmbUnitsA = QComboBox(self)
        self.cmbUnitsA.addItems(units)
        self.cmbUnitsA.setObjectName("cmbUnitsA")
        self.cmbUnitsA.setToolTip(
            "Set unit for y-axis:\n"
            "dB is attenuation (positive values)\nV and W are less than 1.")
        self.cmbUnitsA.setCurrentIndex(0)

        self.cmbShowH.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        self.cmbUnitsA.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        self.lblLinphase = QLabel("Acausal system")
        self.chkLinphase = QCheckBox()
        self.chkLinphase.setToolTip(
            "Remove linear phase according to filter order.\n"
            "Attention: this makes no sense for a non-linear phase system!")

        self.lblInset = QLabel("Inset")

        self.cmbInset = QComboBox(self)
        self.cmbInset.addItems(['off', 'edit', 'fixed'])
        self.cmbInset.setObjectName("cmbInset")
        self.cmbInset.setToolTip("Display/edit second inset plot")
        self.cmbInset.setCurrentIndex(0)
        self.inset_idx = 0  # store previous index for comparison

        self.lblSpecs = QLabel("Show Specs")
        self.chkSpecs = QCheckBox()
        self.chkSpecs.setChecked(False)
        self.chkSpecs.setToolTip("Display filter specs as hatched regions")

        self.lblPhase = QLabel("Phase")
        self.chkPhase = QCheckBox()
        self.chkPhase.setToolTip("Overlay phase")

        self.layHChkBoxes = QHBoxLayout()
        self.layHChkBoxes.addStretch(10)
        self.layHChkBoxes.addWidget(self.cmbShowH)
        self.layHChkBoxes.addWidget(self.lblIn)
        self.layHChkBoxes.addWidget(self.cmbUnitsA)
        self.layHChkBoxes.addStretch(1)
        self.layHChkBoxes.addWidget(self.lblLinphase)
        self.layHChkBoxes.addWidget(self.chkLinphase)
        self.layHChkBoxes.addStretch(1)
        self.layHChkBoxes.addWidget(self.lblInset)
        self.layHChkBoxes.addWidget(self.cmbInset)
        self.layHChkBoxes.addStretch(1)
        self.layHChkBoxes.addWidget(self.lblSpecs)
        self.layHChkBoxes.addWidget(self.chkSpecs)
        self.layHChkBoxes.addStretch(1)
        self.layHChkBoxes.addWidget(self.lblPhase)
        self.layHChkBoxes.addWidget(self.chkPhase)
        self.layHChkBoxes.addStretch(10)

        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        self.mplwidget = MplWidget(self)

        self.mplwidget.layVMainMpl.addLayout(self.layHChkBoxes)

        self.setLayout(self.mplwidget.layVMainMpl)

        self.init_axes()

        self.draw()  # calculate and draw |H(f)|

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.cmbUnitsA.currentIndexChanged.connect(self.draw)
        self.cmbShowH.currentIndexChanged.connect(self.draw)

        self.chkLinphase.clicked.connect(self.draw)
        self.cmbInset.currentIndexChanged.connect(self.draw_inset)

        self.chkSpecs.clicked.connect(self.draw)
        self.chkPhase.clicked.connect(self.draw)
Exemplo n.º 13
0
    def __init__(self, parent):
        super(PlotHf, self).__init__(parent)

        modes = ['| H |', 're{H}', 'im{H}']
        self.cmbShowH = QComboBox(self)
        self.cmbShowH.addItems(modes)
        self.cmbShowH.setObjectName("cmbUnitsH")
        self.cmbShowH.setToolTip(
            "Show magnitude, real / imag. part of H or H \n"
            "without linear phase (acausal system).")
        self.cmbShowH.setCurrentIndex(0)

        self.lblIn = QLabel("in", self)

        units = ['dB', 'V', 'W', 'Auto']
        self.cmbUnitsA = QComboBox(self)
        self.cmbUnitsA.addItems(units)
        self.cmbUnitsA.setObjectName("cmbUnitsA")
        self.cmbUnitsA.setToolTip(
            "<span>Set unit for y-axis:\n"
            "dB is attenuation (positive values), V and W are gain (less than 1).</span>"
        )
        self.cmbUnitsA.setCurrentIndex(0)

        self.cmbShowH.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        self.cmbUnitsA.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        self.chkLinphase = QCheckBox("Zero phase", self)
        self.chkLinphase.setToolTip(
            "<span>Subtract linear phase according to filter order.\n"
            "Attention: this makes no sense for a non-linear phase system!</span>"
        )

        self.lblInset = QLabel("Inset", self)
        self.cmbInset = QComboBox(self)
        self.cmbInset.addItems(['off', 'edit', 'fixed'])
        self.cmbInset.setObjectName("cmbInset")
        self.cmbInset.setToolTip("Display/edit second inset plot")
        self.cmbInset.setCurrentIndex(0)
        self.inset_idx = 0  # store previous index for comparison

        self.chkSpecs = QCheckBox("Show Specs", self)
        self.chkSpecs.setChecked(False)
        self.chkSpecs.setToolTip("Display filter specs as hatched regions")

        self.chkPhase = QCheckBox("Phase", self)
        self.chkPhase.setToolTip("Overlay phase")

        layHControls = QHBoxLayout()
        layHControls.addStretch(10)
        layHControls.addWidget(self.cmbShowH)
        layHControls.addWidget(self.lblIn)
        layHControls.addWidget(self.cmbUnitsA)
        layHControls.addStretch(1)
        layHControls.addWidget(self.chkLinphase)
        layHControls.addStretch(1)
        layHControls.addWidget(self.lblInset)
        layHControls.addWidget(self.cmbInset)
        layHControls.addStretch(1)
        layHControls.addWidget(self.chkSpecs)
        layHControls.addStretch(1)
        layHControls.addWidget(self.chkPhase)
        layHControls.addStretch(10)

        # This widget encompasses all control subwidgets:
        self.frmControls = QFrame(self)
        self.frmControls.setObjectName("frmControls")
        self.frmControls.setLayout(layHControls)

        #----------------------------------------------------------------------
        # mplwidget
        #----------------------------------------------------------------------
        # This is the plot pane widget, encompassing the other widgets
        self.mplwidget = MplWidget(self)
        self.mplwidget.layVMainMpl.addWidget(self.frmControls)
        self.mplwidget.layVMainMpl.setContentsMargins(*params['wdg_margins'])
        self.setLayout(self.mplwidget.layVMainMpl)

        self.init_axes()

        self.draw()  # calculate and draw |H(f)|

        #----------------------------------------------------------------------
        # SIGNALS & SLOTs
        #----------------------------------------------------------------------
        self.cmbUnitsA.currentIndexChanged.connect(self.draw)
        self.cmbShowH.currentIndexChanged.connect(self.draw)

        self.chkLinphase.clicked.connect(self.draw)
        self.cmbInset.currentIndexChanged.connect(self.draw_inset)

        self.chkSpecs.clicked.connect(self.draw)
        self.chkPhase.clicked.connect(self.draw)
        self.mplwidget.mplToolbar.sigEnabled.connect(self.enable_ui)