mirror of
https://github.com/nqrduck/nqrduck-autotm.git
synced 2024-12-21 15:20:27 +00:00
Adjusted widget for tm type.
This commit is contained in:
parent
519b4ddcfa
commit
2fdcb1d0c5
5 changed files with 115 additions and 22 deletions
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -91,17 +91,68 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<widget class="QTabWidget" name="typeTab">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mechTab">
|
||||
<attribute name="title">
|
||||
<string>Mechanical</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Homing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="elecTab">
|
||||
<attribute name="title">
|
||||
<string>Electrical</string>
|
||||
</property>
|
||||
</item>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="matchingBox"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Set Voltages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="tuningBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Voltage Matching</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Voltage Tuning</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Voltage Resolution</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="resolutionBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -200,7 +251,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>273</width>
|
||||
<height>189</height>
|
||||
<height>83</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"))
|
||||
|
|
Loading…
Reference in a new issue