diff --git a/src/nqrduck_autotm/controller.py b/src/nqrduck_autotm/controller.py index 8002c76..288d714 100644 --- a/src/nqrduck_autotm/controller.py +++ b/src/nqrduck_autotm/controller.py @@ -39,10 +39,12 @@ class AutoTMController(ModuleController): def start_frequency_sweep(self, start_frequency : str, stop_frequency : str) -> None: """ This starts a frequency sweep on the device in the specified range. + The minimum start and stop frequency are specific to the AD4351 based frequency generator. Args: start_frequency (str): The start frequency in MHz. stop_frequency (str): The stop frequency in MHz. + """ FREQUENCY_STEP = 50000 # Hz MIN_FREQUENCY = 35e6 # Hz diff --git a/src/nqrduck_autotm/model.py b/src/nqrduck_autotm/model.py index fe3bab2..7d69c0d 100644 --- a/src/nqrduck_autotm/model.py +++ b/src/nqrduck_autotm/model.py @@ -11,7 +11,8 @@ class S11Data: # Conversion factors - the data is generally sent and received in mV # These values are used to convert the data to dB and degrees - CENTER_POINT = 900 # mV + CENTER_POINT_MAGNITUDE = 900 # mV + CENTER_POINT_PHASE = 1800 # mV MAGNITUDE_SLOPE = 30 # dB/mV PHASE_SLOPE = 10 # deg/mV @@ -27,11 +28,12 @@ class S11Data: @property def return_loss_db(self): - return (self.return_loss_mv - self.CENTER_POINT) / self.MAGNITUDE_SLOPE + return (self.return_loss_mv - self.CENTER_POINT_MAGNITUDE) / self.MAGNITUDE_SLOPE @property def phase_deg(self): - return (self.phase_mv - self.CENTER_POINT) / self.PHASE_SLOPE + """Returns the absolute value of the phase in degrees""" + return (self.phase_mv - self.CENTER_POINT_PHASE) / self.PHASE_SLOPE @property def phase_rad(self): diff --git a/src/nqrduck_autotm/resources/autotm_widget.ui b/src/nqrduck_autotm/resources/autotm_widget.ui index 1890934..16d3e3c 100644 --- a/src/nqrduck_autotm/resources/autotm_widget.ui +++ b/src/nqrduck_autotm/resources/autotm_widget.ui @@ -91,17 +91,68 @@ - - - + + + 1 + + + Mechanical - - - - + + + + + + Homing + + + + + + + Electrical - - + + + + + + + + + Set Voltages + + + + + + + + + + Voltage Matching + + + + + + + Voltage Tuning + + + + + + + Voltage Resolution + + + + + + + + @@ -200,7 +251,7 @@ 0 0 273 - 189 + 83 diff --git a/src/nqrduck_autotm/view.py b/src/nqrduck_autotm/view.py index 6a1958f..8643bf2 100644 --- a/src/nqrduck_autotm/view.py +++ b/src/nqrduck_autotm/view.py @@ -172,7 +172,7 @@ class AutoTMView(ModuleView): phase_ax = self._ui_form.S11Plot.canvas.ax.twinx() phase_ax.clear() - phase_ax.set_ylabel("Phase (deg)") + phase_ax.set_ylabel("|Phase (deg)|") phase_ax.plot(frequency, phase, color="orange", linestyle="--") phase_ax.set_ylim(-180, 180) phase_ax.invert_yaxis() diff --git a/src/nqrduck_autotm/widget.py b/src/nqrduck_autotm/widget.py index 0a2c0d2..13fcc0a 100644 --- a/src/nqrduck_autotm/widget.py +++ b/src/nqrduck_autotm/widget.py @@ -58,11 +58,43 @@ class Ui_Form(object): self.titletypeLabel.setFont(font) self.titletypeLabel.setObjectName("titletypeLabel") self.verticalLayout_2.addWidget(self.titletypeLabel) - self.comboBox = QtWidgets.QComboBox(parent=Form) - self.comboBox.setObjectName("comboBox") - self.comboBox.addItem("") - self.comboBox.addItem("") - self.verticalLayout_2.addWidget(self.comboBox) + self.typeTab = QtWidgets.QTabWidget(parent=Form) + self.typeTab.setObjectName("typeTab") + self.mechTab = QtWidgets.QWidget() + self.mechTab.setObjectName("mechTab") + self.verticalLayout = QtWidgets.QVBoxLayout(self.mechTab) + self.verticalLayout.setObjectName("verticalLayout") + self.pushButton = QtWidgets.QPushButton(parent=self.mechTab) + self.pushButton.setObjectName("pushButton") + self.verticalLayout.addWidget(self.pushButton) + self.typeTab.addTab(self.mechTab, "") + self.elecTab = QtWidgets.QWidget() + self.elecTab.setObjectName("elecTab") + self.gridLayout_3 = QtWidgets.QGridLayout(self.elecTab) + self.gridLayout_3.setObjectName("gridLayout_3") + self.matchingBox = QtWidgets.QDoubleSpinBox(parent=self.elecTab) + self.matchingBox.setObjectName("matchingBox") + self.gridLayout_3.addWidget(self.matchingBox, 1, 1, 1, 1) + self.pushButton_2 = QtWidgets.QPushButton(parent=self.elecTab) + self.pushButton_2.setObjectName("pushButton_2") + self.gridLayout_3.addWidget(self.pushButton_2, 2, 0, 1, 2) + self.tuningBox = QtWidgets.QDoubleSpinBox(parent=self.elecTab) + self.tuningBox.setObjectName("tuningBox") + self.gridLayout_3.addWidget(self.tuningBox, 0, 1, 1, 1) + self.label_3 = QtWidgets.QLabel(parent=self.elecTab) + self.label_3.setObjectName("label_3") + self.gridLayout_3.addWidget(self.label_3, 1, 0, 1, 1) + self.label_2 = QtWidgets.QLabel(parent=self.elecTab) + self.label_2.setObjectName("label_2") + self.gridLayout_3.addWidget(self.label_2, 0, 0, 1, 1) + self.label_4 = QtWidgets.QLabel(parent=self.elecTab) + self.label_4.setObjectName("label_4") + self.gridLayout_3.addWidget(self.label_4, 3, 0, 1, 1) + self.resolutionBox = QtWidgets.QDoubleSpinBox(parent=self.elecTab) + self.resolutionBox.setObjectName("resolutionBox") + self.gridLayout_3.addWidget(self.resolutionBox, 3, 1, 1, 1) + self.typeTab.addTab(self.elecTab, "") + self.verticalLayout_2.addWidget(self.typeTab) self.titlefrequencyLabel = QtWidgets.QLabel(parent=Form) font = QtGui.QFont() font.setBold(True) @@ -111,7 +143,7 @@ class Ui_Form(object): self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() - self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 273, 189)) + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 273, 83)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.verticalLayout_2.addWidget(self.scrollArea) @@ -130,6 +162,7 @@ class Ui_Form(object): self.horizontalLayout_2.setStretch(1, 1) self.retranslateUi(Form) + self.typeTab.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): @@ -141,8 +174,13 @@ class Ui_Form(object): self.label_10.setText(_translate("Form", "Connected to:")) self.connectButton.setText(_translate("Form", "Connect")) self.titletypeLabel.setText(_translate("Form", "T&M Type:")) - self.comboBox.setItemText(0, _translate("Form", "Mechanical")) - self.comboBox.setItemText(1, _translate("Form", "Electrical")) + self.pushButton.setText(_translate("Form", "Homing")) + self.typeTab.setTabText(self.typeTab.indexOf(self.mechTab), _translate("Form", "Mechanical")) + self.pushButton_2.setText(_translate("Form", "Set Voltages")) + self.label_3.setText(_translate("Form", "Voltage Matching")) + self.label_2.setText(_translate("Form", "Voltage Tuning")) + self.label_4.setText(_translate("Form", "Voltage Resolution")) + self.typeTab.setTabText(self.typeTab.indexOf(self.elecTab), _translate("Form", "Electrical")) self.titlefrequencyLabel.setText(_translate("Form", "Frequency Sweep:")) self.label_8.setText(_translate("Form", "MHz")) self.label_6.setText(_translate("Form", "MHz"))