GUI: reformatted total_time label on rotation, raster and smart
This commit is contained in:
@@ -116,10 +116,9 @@ class RasterDataCollectionPanel(ScanSettingsPanel):
|
||||
self._layout.addItem(horizontal_spacer, 10, 0, 1, 5)
|
||||
|
||||
self._layout.addWidget(QLabel("Measurement time", parent=self), 11, 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, 11, 1, 1, 3)
|
||||
self._layout.addWidget(QLabel("min", parent=self), 11, 4)
|
||||
|
||||
self.image_time_enter.newValue.connect(self.exp_time_s)
|
||||
self.calculate_total_time()
|
||||
@@ -188,7 +187,7 @@ class RasterDataCollectionPanel(ScanSettingsPanel):
|
||||
self.size_x_label.setText(f"{self.__size_x * self.__n_x:.1f}")
|
||||
self.n_y_label.setText(str(self.__n_y))
|
||||
self.size_y_label.setText(f"{self.__size_y * self.__n_y:.1f}")
|
||||
self.total_time.setText(f"{(self.__total_time / 60.0):.2f}")
|
||||
self.update_total_time_label()
|
||||
try:
|
||||
self.exp_time_s(self.image_time_enter.value)
|
||||
except ValueError as e:
|
||||
@@ -206,14 +205,22 @@ class RasterDataCollectionPanel(ScanSettingsPanel):
|
||||
# Add other raster-specific parameters here as needed
|
||||
]
|
||||
|
||||
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_total_time(self):
|
||||
if self.__n_x <= 0 or self.__n_y <= 0 or self.image_time_enter.value < 0:
|
||||
self.__total_time = 0.0
|
||||
else:
|
||||
self.__total_time = self.__n_x * self.__n_y * self.image_time_enter.value
|
||||
self.__total_time = self.__n_x * self.__n_y * self.image_time_enter.value * 1.3
|
||||
#30% buffer added
|
||||
# Show minutes
|
||||
self.total_time.setText(f"{(self.__total_time/60.0):.2f}")
|
||||
|
||||
self.update_total_time_label()
|
||||
|
||||
@Slot()
|
||||
def _on_evaluate_clicked(self):
|
||||
|
||||
@@ -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,23 @@ 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.0011:
|
||||
self.transmission = self.image_time_s / 0.0011
|
||||
self.image_time_s = 0.0011
|
||||
|
||||
Reference in New Issue
Block a user