GUI: updated formatting of total time in rotation and added to simple
This commit is contained in:
1 parent
60a36f37a8
commit
382afcc0c0
2 files changed
+32
-9
No files matched your search
@@ -100,10 +100,9 @@ class RotationDataCollectionPanel(ScanSettingsPanel):
|
||||
self._layout.addWidget(QLabel("s", parent=self), 12, 4)
|
||||
|
||||
self._layout.addWidget(QLabel("Total measurement time", parent=self), 13, 0)
|
||||
self.total_time = QLabel(f"{self.__total_time}")
|
||||
self.total_time = QLabel(f"{self.__total_time} min 0 s")
|
||||
self.total_time.setAlignment(Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter)
|
||||
self._layout.addWidget(self.total_time, 13, 1, 1, 3)
|
||||
self._layout.addWidget(QLabel("min", parent=self), 13, 4)
|
||||
|
||||
self.total_angle.newValue.connect(self.calculate_measurement_time)
|
||||
self.image_angle.newValue.connect(self.calculate_measurement_time)
|
||||
@@ -174,13 +173,22 @@ class RotationDataCollectionPanel(ScanSettingsPanel):
|
||||
|
||||
return round(total_angle / image_angle)
|
||||
|
||||
def update_total_time_label(self):
|
||||
mins = int(self.__total_time // 60)
|
||||
secs = int(round(self.__total_time % 60))
|
||||
if secs == 60:
|
||||
mins += 1
|
||||
secs = 0
|
||||
self.total_time.setText(f"{mins} min {secs} s")
|
||||
|
||||
|
||||
def calculate_measurement_time(self):
|
||||
if self.image_angle.value <= 0 or self.total_angle.value <= 0 or self.image_time_enter.value < 0:
|
||||
self.__total_time = 0.0
|
||||
self.total_time.setText("0.0")
|
||||
self.update_total_time_label()
|
||||
return
|
||||
self.__total_time = (self.total_angle.value / self.image_angle.value) * self.image_time_enter.value
|
||||
self.total_time.setText(f"{self.__total_time / 60:.2f}")
|
||||
self.update_total_time_label()
|
||||
|
||||
@Slot(str)
|
||||
def update_filename(self, filename: str):
|
||||
|
||||
@@ -36,6 +36,7 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
self.__omega = 0
|
||||
self._wilson_b = None
|
||||
self.flux_ph_s = None
|
||||
self.total_time_s = 0
|
||||
self.parameters = SimpleScanParameters()
|
||||
self._prev_params = SimpleScanParameters()
|
||||
|
||||
@@ -174,14 +175,19 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
self._layout.addWidget(self.calculated_dose_label, 19, 1, 1, 3)
|
||||
self._layout.addWidget(QLabel("MGy", parent=self), 19, 4)
|
||||
|
||||
self._layout.addWidget(QLabel("Total measurement time", parent=self), 20, 0)
|
||||
self.total_time = QLabel(f"{self.total_time_s} min 0 s")
|
||||
self.total_time.setAlignment(Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter)
|
||||
self._layout.addWidget(self.total_time, 20, 1, 1, 3)
|
||||
|
||||
# add vertical stretch between detector distance and the run button
|
||||
self._layout.addItem(QSpacerItem(0, 0, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding), 20, 0, 1, 6)
|
||||
self._layout.addItem(QSpacerItem(0, 0, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding), 21, 0, 1, 6)
|
||||
|
||||
# Run rotation button
|
||||
self.run_rotation_button = QPushButton("Run rotation", parent=self)
|
||||
self.run_rotation_button.setStyleSheet("color: rgb(78, 154, 6);")
|
||||
self.run_rotation_button.clicked.connect(self.run_measurement)
|
||||
self._layout.addWidget(self.run_rotation_button, 21, 0, 1, 6)
|
||||
self._layout.addWidget(self.run_rotation_button, 22, 0, 1, 6)
|
||||
|
||||
@Slot(DAQStatusModel)
|
||||
def update_daq_status(self, s: DAQStatusModel):
|
||||
@@ -251,6 +257,14 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
def update_omega_start(self):
|
||||
self.start_angle_enter.update_value(self.__omega)
|
||||
|
||||
def update_total_time_label(self):
|
||||
mins = int(self.total_time_s // 60)
|
||||
secs = int(round(self.total_time_s % 60))
|
||||
if secs == 60:
|
||||
mins += 1
|
||||
secs = 0
|
||||
self.total_time.setText(f"{mins} min {secs} s")
|
||||
|
||||
def update_calculated_labels(self):
|
||||
if self.__d is None:
|
||||
return
|
||||
@@ -293,13 +307,14 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
self.calculated_dose_rate_label.setText(f"{self.dose_rate_MGy_s:.2f}")
|
||||
self.xtal_size_dose_label.setText(f"{self.xtal_size_dose_rate_MGy_s:.2f}")
|
||||
|
||||
total_time_s = self.target_dose_MGy / self.dose_rate_MGy_s
|
||||
self.total_time_s = self.target_dose_MGy / self.dose_rate_MGy_s
|
||||
self.update_total_time_label()
|
||||
|
||||
self.calculated_dose_label.setText(f"<b>{self.xtal_size_dose_rate_MGy_s*total_time_s:.2f}</b>")
|
||||
self.calculated_dose_label.setText(f"<b>{self.xtal_size_dose_rate_MGy_s*self.total_time_s:.2f}</b>")
|
||||
if image_angle == 0.0:
|
||||
image_angle = 0.001
|
||||
self.n_images = round(total_angle / image_angle)
|
||||
self.image_time_s = total_time_s / self.n_images
|
||||
self.image_time_s = self.total_time_s / self.n_images
|
||||
if self.image_time_s < 0.01:
|
||||
self.transmission = self.image_time_s / 0.01
|
||||
self.image_time_s = 0.01
|
||||
|
||||
Reference in new issue
Block a user