pypeit.dashboard.view.calibrations_view module
The Calibrations view of the PypeIt Dashboard (Stage 3).
The drill-down companion to the Status view: scope selectors (C2), a
path-aware step-button row (C3/C4/C12/C13), and a detail panel (C5–C9, C11)
for the selected step — metrics, input files, the output viewer, QA files,
and a per-slit/order table. It launches the existing inspection tools as
subprocesses via the Launcher (C8/C14/C15)
and stays thin: data via the model, colors via the palette, commands via
inspect.
Generated by JXP and Claude.
- class pypeit.dashboard.view.calibrations_view.CalibrationsView(model, launcher=None, run_lock=None, on_run_finished=None, parent=None)[source]
Bases:
QWidgetThe Calibrations tab: the per-(group, detector) calibration drill-down.
Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The reduction-state model.launcher (
Launcher, optional) – Used to launch inspection tools and (re)build runs; ifNone, the controls are built but do nothing (e.g. in headless tests).run_lock (
RunLock, optional) – The single-run lock (design X1); the (Re)Build control is disabled while it is locked.on_run_finished (callable, optional) – Called as
on_run_finished(code)when a (Re)Build run ends, so the window can refresh the state (design C15).parent (
QWidget, optional) – The parent widget.
- _GINGA_HINT_STEPS = ('bias', 'dark', 'arc', 'tiltimg', 'slits', 'scattlight', 'wv_calib')
- _add_action_row(step, group, det)[source]
Add the action row: “Inspect output” (C8) beside “(Re)Build” (C10).
Generated by JXP and Claude.
- _add_file_item(listw, path, prefix='')[source]
Add one file row to an input-file list, stashing the path.
Generated by JXP and Claude.
- _add_input_files(step, entry)[source]
Add the input-file list (C7); grouped by role for flats (S3-Q16).
Generated by JXP and Claude.
- Parameters:
step (
str) – The step name.entry – The step’s state entry (or
None).
- Returns:
None.
- _add_output_label(entry)[source]
Show the step’s output filename (Round-2 #3), so it is visible even when there is no viewer (e.g.
wv_calib).Generated by JXP and Claude.
- Parameters:
entry – The step’s state entry (or
None).- Returns:
None.
- _add_qa_files(entry)[source]
Add the QA-file list (C9); double-click opens the PNG full-view.
Generated by JXP and Claude.
- Parameters:
entry – The step’s state entry (or
None).- Returns:
None.
- _add_slit_table(step, group, det)[source]
Add the per-slit/order table (C11). For flats the table has per-correction mean/RMS columns (S3-Q14).
Generated by JXP and Claude.
- _after_rebuild(code, step, backups)[source]
Finish a (re)build: drop the backups on success, restore them on failure, keep the rebuilt step selected, then trigger the window refresh (C15, Round-1 #2, Round-2 #2).
Generated by JXP and Claude.
- _build()[source]
Build the view (edge message or full drill-down).
Generated by JXP and Claude.
- Returns:
None.
- _build_detail(step)[source]
Rebuild the detail panel for the selected step (C5–C9, C11).
Generated by JXP and Claude.
- Parameters:
step (
str) – The selected step.- Returns:
None.
- _build_output_button(step, group, det)[source]
Build the “Inspect output” button (C8).
Generated by JXP and Claude.
- _build_rebuild_button(step, group, det)[source]
Build the “(Re)Build” control (C10): launch
pypeit_run_to_calibstepfor the selected step. Styled with the distinct action color (blue, S4-Q2), and disabled while a run is in progress (the single-run lock, X1).Generated by JXP and Claude.
- _build_scope_toolbar()[source]
Build the calibration-group + detector drop-downs (C2), independent of the Status tab’s.
Generated by JXP and Claude.
- Returns:
None.
- _confirm_rebuild(step, existing)[source]
Show the clobber confirmation dialog (X2), naming the file(s) to be overwritten.
Generated by JXP and Claude.
- Parameters:
step (
str) – The step name.existing (
list) – Existing outputpathlib.Pathfiles.
- Returns:
True if the user confirmed the (re)build.
- Return type:
- _detect_theme()[source]
Detect light vs dark from the widget palette.
Generated by JXP and Claude.
- Returns:
'dark'or'light'.- Return type:
- static _fmt(value)[source]
Format a numeric metric for display.
Generated by JXP and Claude.
- Parameters:
value – The metric value (or
None).- Returns:
A short string, or an em-dash for missing values.
- Return type:
- _launch(argv, description, hint='viewer window')[source]
Launch a command via the launcher (no-op if no launcher / command).
Generated by JXP and Claude.
- _on_det_changed(_index)[source]
Handle a detector change: rebuild the button row.
Generated by JXP and Claude.
- Parameters:
_index (
int) – The new combo index (unused).- Returns:
None.
- _on_group_changed(_index)[source]
Handle a group change: reload detectors, rebuild the button row.
Generated by JXP and Claude.
- Parameters:
_index (
int) – The new combo index (unused).- Returns:
None.
- _on_input_double_clicked(item)[source]
View the double-clicked input frame via
pypeit_view_fits.Generated by JXP and Claude.
- Parameters:
item (
QListWidgetItem) – The clicked item.- Returns:
None.
- _on_qa_double_clicked(item)[source]
Open the double-clicked QA PNG in an image dialog.
Generated by JXP and Claude.
- Parameters:
item (
QListWidgetItem) – The clicked item.- Returns:
None.
- _on_rebuild(step, group, det)[source]
Confirm and launch a (re)build of the selected step (C10, X2/X3).
Shows a clobber confirmation naming the file(s) that will be overwritten (S4-Q4); on confirm, moves only the selected step’s output(s) aside (S4-Q3 option (a) — “delete-then-run”, in code) and launches
pypeit_run_to_calibstepthrough the launcher, which holds the lock and refreshes on completion (C15).The move-aside is crash-safe: each output is renamed to a
.dashboard_baksibling rather than unlinked, and_after_rebuild()restores it if the run fails (so a failed (re)build never loses the existing calibration; Round-1 #2).Generated by JXP and Claude.
- _rebuild_button_row()[source]
Rebuild the path-aware step-button row for the current scope.
Generated by JXP and Claude.
- Returns:
None.
- _reload_det_combo(select=None)[source]
Repopulate the detector drop-down for the current group.
Generated by JXP and Claude.
- Parameters:
select – Detector to select after repopulating, if present.
- Returns:
None.
- _restyle_buttons()[source]
Apply the palette fill + selected-ring to each step button.
Generated by JXP and Claude.
- Returns:
None.
- _scope_status()[source]
Return a
step -> (required, status, in_pipeline)lookup for the current scope.Generated by JXP and Claude.
- Returns:
Per-step status tuples for the selected (group, det).
- Return type:
- _select_step(step)[source]
Select a step: re-style the buttons and rebuild the detail panel.
Generated by JXP and Claude.
- Parameters:
step (
str) – The selected step.- Returns:
None.
- _set_scope(pair)[source]
Set the scoped
(group, det), syncing the drop-downs and rebuilding the button row.Generated by JXP and Claude.
- Parameters:
pair (
tuple) –(group, det).- Returns:
None.
- _style_rebuild_button(locked)[source]
Style the (Re)Build button for the lock state (Round-3 #1/#2): a distinct blue action when idle, but orange and disabled (with a “run in progress” label) while any PypeIt run is active — the visual clue that it is locked.
Generated by JXP and Claude.
- Parameters:
locked (
bool) – Whether a run is in progress.- Returns:
None.
- _viewer_hint(step)[source]
Return where a step’s output viewer shows its result, for the activity bar’s finished message (Round-1 #1).
Generated by JXP and Claude.
- refresh(model)[source]
Swap in a new model but preserve the current scope and selected step (used after a (Re)Build completes, so the rebuilt step stays selected rather than resetting to the first step; C15, Round-2 #2).
Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The freshly-acquired model.- Returns:
None.
- set_locked(locked)[source]
Restyle the (Re)Build control when the run lock changes (X1, Round-3): orange + disabled while locked, blue + enabled when idle.
Generated by JXP and Claude.
- Parameters:
locked (
bool) – Whether a run is in progress.- Returns:
None.
- set_model(model)[source]
Swap in a new model and rebuild.
Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The new model.- Returns:
None.