diff --git a/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py b/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py index 778928c..9e1b9a8 100644 --- a/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py +++ b/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py @@ -758,11 +758,14 @@ class TomoParamsWidget(BECWidget, QWidget): job.get("label", f"job_{row}"), status, str(params.get("tomo_type", "?")), - f"{params.get('fovx', '?')} × {params.get('fovy', '?')}", + _format_projections(params), + _fmt_num(params.get("tomo_countingtime")), + _fmt_num(params.get("tomo_shellstep")), job.get("added_at", ""), ] for col, text in enumerate(cells): item = QTableWidgetItem(text) + item.setTextAlignment(Qt.AlignmentFlag.AlignCenter) item.setForeground(table.palette().text() if col != 2 else _color_from_hex(color)) table.setItem(row, col, item) @@ -976,9 +979,18 @@ class TomoQueueDialog(QDialog): vbox = QVBoxLayout(self) vbox.setSpacing(6) - self._table = QTableWidget(0, 6) + self._table = QTableWidget(0, 8) self._table.setHorizontalHeaderLabels( - ["#", "Label", "Status", "Type", "FOV x×y (µm)", "Added at"] + [ + "#", + "Label", + "Status", + "Type", + "Projections", + "Exp (s)", + "Step (µm)", + "Added at", + ] ) self._table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch) self._table.setSelectionBehavior(QTableWidget.SelectionBehavior.SelectRows) @@ -1015,11 +1027,14 @@ class TomoQueueDialog(QDialog): job.get("label", f"job_{row}"), status, str(params.get("tomo_type", "?")), - f"{params.get('fovx', '?')} × {params.get('fovy', '?')}", + _format_projections(params), + _fmt_num(params.get("tomo_countingtime")), + _fmt_num(params.get("tomo_shellstep")), job.get("added_at", ""), ] for col, text in enumerate(cells): item = QTableWidgetItem(text) + item.setTextAlignment(Qt.AlignmentFlag.AlignCenter) if col == 2: item.setForeground(_color_from_hex(color)) self._table.setItem(row, col, item) @@ -1126,6 +1141,53 @@ def _compute_type1(angle_range: int, stepsize: float) -> tuple[int, float, float return actual_total, achievable_step, stepsize +def _format_projections(params: dict) -> str: + """ + Human-readable projection count for a queued job, mirroring the CLI's + per-type logic: + - type 1: int(angle_range / stepsize) * 8 (8 equally spaced sub-tomos) + - type 3: int(180 / stepsize) * 8 (equally spaced, golden start) + - type 2: golden ratio has no fixed count -> configured max, or ∞ if unset + """ + try: + tomo_type = int(params.get("tomo_type", 1)) + stepsize = float(params.get("tomo_angle_stepsize", 0) or 0) + + if tomo_type == 1: + angle_range = int(params.get("tomo_angle_range", 180)) + actual_total, _, _ = _compute_type1(angle_range, stepsize) + return str(actual_total) + + if tomo_type == 3: + if stepsize <= 0: + return "?" + return str(int(180.0 / stepsize) * 8) + + if tomo_type == 2: + max_prj = params.get("golden_max_number_of_projections", 0) or 0 + try: + max_prj = int(float(max_prj)) + except (TypeError, ValueError): + return "∞" + return str(max_prj) if max_prj > 0 else "∞" + + return "?" + except Exception: + return "?" + + +def _fmt_num(val) -> str: + """Compact numeric formatting for table cells; blank for None.""" + if val is None: + return "" + try: + f = float(val) + except (TypeError, ValueError): + return str(val) + # trim trailing zeros: 0.100 -> 0.1, 1.0 -> 1 + return f"{f:g}" + + def _color_from_hex(hex_color: str): from qtpy.QtGui import QColor