Skip to content
Snippets Groups Projects
Commit af4d6924 authored by esarrey's avatar esarrey
Browse files

Live tab comments

parent bf35e0c8
No related branches found
No related tags found
No related merge requests found
{
"docwriter.style": "GoDoc",
"docwriter.progress.trackFunctions": true,
"docwriter.progress.trackMethods": true,
"docwriter.progress.trackClasses": true,
"docwriter.progress.trackTypes": true
}
\ No newline at end of file
......@@ -13,9 +13,16 @@ class HallSensorThread(QThread):
sensor_data_signal = pyqtSignal(float)
def __init__(self):
"""
Constructor method for the hall sensor thread.
"""
super().__init__()
def run(self):
"""
The function continuously reads sensor data from a hall sensor and emits a signal with the data
if the sensor is not reserved to be displayed in this tab.
"""
while True:
if not hall_sensor.reserved:
sensor_data = hall_sensor.read_mT()
......@@ -24,6 +31,9 @@ class HallSensorThread(QThread):
sleep(1)
def zero_sensor_value(self):
"""
Zero the Hall sensor and logs the completion.
"""
QApplication.setOverrideCursor(Qt.WaitCursor)
hall_sensor.zeroing()
QApplication.restoreOverrideCursor()
......@@ -33,9 +43,18 @@ class VoltageThread(QThread):
balanced_diodes_signal = pyqtSignal(dict)
def __init__(self):
"""
Constructor method for a the voltage thread.
"""
super().__init__()
def run(self):
"""
The function continuously checks if the DAC is not reserved and if the status setup is not complete,
then it sets up the acquisition and starts the tasks, reads the data from the DAC, calculates the
mean of the balanced diodes data and intensity diode data, and emits a signal with the output
to be lived display in this tab.
"""
while True:
if not dac.reserved:
if not dac.status_setup:
......@@ -49,6 +68,13 @@ class VoltageThread(QThread):
class LiveTab(TabWidget, QWidget):
def __init__(self, name, parent=None):
"""
The function initializes a GUI tab with labels and values for balanced diodes voltage, intensity
diode voltage, and magnetic field.
Args:
name (str): the name of the tab
"""
super().__init__(parent)
self.name = name
......@@ -100,8 +126,23 @@ class LiveTab(TabWidget, QWidget):
def update_sensor_value(self, sensor_value):
"""
The function updates the value of a hall sensor and displays it in a text field.
Args:
sensor_value (float): the value of the sensor reading in millitesla (mT)
"""
self.hall_sensor_value.setText(f'{sensor_value:.6f}mT')
def update_voltage_value(self, voltage_value):
def update_voltage_value(self, voltage_value):
"""
The function `update_voltage_value` updates the text values of `bd_value` and `id_value` with the
corresponding voltage values in millivolts.
Args:
voltage_value (dict) : a dictionary that contains two keys: "bd" and "id". The values
associated with these keys represent the voltage values of the
balanced and intensity diodes respectively.
"""
self.bd_value.setText(f'{(voltage_value["bd"]*1000.):.1f} mV')
self.id_value.setText(f'{(voltage_value["id"]*1000.):.1f} mV')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment