pypeit.dashboard.view.science_view module

The Science view of the PypeIt Dashboard (Stage 6).

The science companion to the Calibrations view: a per-frame table (one row per reduced (frame, detector) exposure, science and standard, design R15/R18) with the four macro-step statuses (process / findobj / skysub / extract) as color+glyph cells, nobj, and product presence; and a per-frame detail panel with per-slit and per-object tables plus the product viewers and a (Re)Build control. It stays thin: data via the model, colors via the palette, commands via inspect, launches via the shared Launcher.

Generated by JXP and Claude.

class pypeit.dashboard.view.science_view.ScienceView(model, launcher=None, run_lock=None, on_run_finished=None, parent=None)[source]

Bases: QWidget

The Science tab: a per-frame table + per-frame detail drill-down (R15/R18).

Generated by JXP and Claude.

Parameters:
  • model (DashboardModel) – The reduction-state model.

  • launcher (Launcher, optional) – Used to launch product viewers and (Re)Build runs.

  • run_lock (RunLock, optional) – The single-run lock (X1); the (Re)Build controls are disabled while it is locked.

  • on_run_finished (callable, optional) – Called as on_run_finished(code) when a (Re)Build ends.

  • parent (QWidget, optional) – The parent widget.

_add_action_row(frame, det, entry)[source]

Add the View-2D button and the per-step (Re)Build controls.

Generated by JXP and Claude.

Parameters:
  • frame (str) – The exposure basename.

  • det – Detector (int) or mosaic.

  • entry – The ScienceFrameState (or None).

Returns:

None.

_add_object_table(frame, det, entry)[source]

Add the per-object science table; double-click a row to view that object’s 1D spectrum (S6-Q3/Q10).

Generated by JXP and Claude.

Parameters:
  • frame (str) – The exposure basename.

  • det – Detector (int) or mosaic.

  • entry – The ScienceFrameState (or None).

Returns:

None.

_add_qa_files(frame, det)[source]

Add a QA-file list for the frame (all of its obj_prof/obj_trace and spec_flex_* PNGs), mirroring the Calibrations QA list (Round-1 #3, S6-Q15(d)); double-click opens the PNG full-view.

Generated by JXP and Claude.

Parameters:
  • frame (str) – The exposure basename.

  • det – Detector (int) or mosaic.

Returns:

None.

_add_run_pypeit_button()[source]

Add the view-level “Run PypeIt” button (Round-6): launch the full reduction (run_pypeit -o) over all science/standard frames, with an overwrite warning, governed by the same single-run lock.

Generated by JXP and Claude.

Returns:

None.

_add_slit_table(frame, det)[source]

Add the per-slit science table (status + nobj).

Generated by JXP and Claude.

Parameters:
  • frame (str) – The exposure basename.

  • det – Detector (int) or mosaic.

Returns:

None.

_build()[source]

Build the view (edge message or the table + detail panel).

Generated by JXP and Claude.

Returns:

None.

_build_detail(frame, det)[source]

Rebuild the detail panel for one science frame: actions + (Re)Build, per-slit table, per-object table.

Generated by JXP and Claude.

Parameters:
  • frame (str) – The exposure basename.

  • det – Detector (int) or mosaic.

Returns:

None.

_build_rebuild_button(frame, det, entry, step)[source]

Build a (Re)Build button for a science step (S6-Q12): blue action when idle, orange + disabled while a run is active; enabled only when its prerequisite step succeeded and a raw frame is known.

Generated by JXP and Claude.

Parameters:
  • frame (str) – The exposure basename.

  • det – Detector (int) or mosaic.

  • entry – The ScienceFrameState (or None).

  • step (str) – process / findobj / extract.

Returns:

The (Re)Build button.

Return type:

QPushButton

_build_table()[source]

Build the per-frame science table (R18): flat (frame, det) rows with the four step statuses as color+glyph cells (S6-Q4/Q5/Q6).

Generated by JXP and Claude.

Returns:

None.

_detect_theme()[source]

Detect light vs dark from the widget palette.

Generated by JXP and Claude.

Returns:

'dark' or 'light'.

Return type:

str

static _fmt(value)[source]

Format a science metric cell.

Generated by JXP and Claude.

Parameters:

value – The value (or None).

Returns:

A short string, em-dash for missing.

Return type:

str

_launch(argv, description, hint='viewer window')[source]

Launch a viewer command via the launcher (no-op if unavailable).

Generated by JXP and Claude.

Parameters:
  • argv (list) – The command argv (or None).

  • description (str) – Human description for the activity bar.

  • hint (str, optional) – Where the result appears.

Returns:

None.

_on_object_double_clicked(item, spec1d)[source]

Handle a double-click in the per-object table: an obj_prof / obj_trace cell opens that object’s QA PNG (Round-1 #3); any other cell opens the object’s 1D spectrum (pypeit_show_1dspec --obj).

Generated by JXP and Claude.

Parameters:
  • item (QTableWidgetItem) – The clicked cell.

  • spec1d (str) – The frame’s spec1d product (or None).

Returns:

None.

_on_rebuild(frame, det, step)[source]

Confirm and launch a science (Re)Build (S6-Q12: re-run with a confirmation; no move-aside).

Generated by JXP and Claude.

Parameters:
  • frame (str) – The exposure basename.

  • det – Detector (int) or mosaic.

  • step (str) – The science step to (re)build.

Returns:

None.

_on_run_pypeit()[source]

Confirm (overwrite warning) and launch the full reduction (run_pypeit -o) via the launcher (Round-6).

Generated by JXP and Claude.

Returns:

None.

_on_selection_changed()[source]

Rebuild the detail panel for the selected row.

Generated by JXP and Claude.

Returns:

None.

_product_path(name)[source]

Resolve a product filename to its path under Science/.

Generated by JXP and Claude.

Parameters:

name (str) – The product basename (or full path).

Returns:

The resolved path.

Return type:

pathlib.Path

_select_pair(pair)[source]

Select the table row for (frame, det) (syncs the detail panel).

Generated by JXP and Claude.

Parameters:

pair (tuple) – (frame, det).

Returns:

None.

_set_table_row(r, row)[source]

Populate one science table row.

Generated by JXP and Claude.

Parameters:
  • r (int) – Row index.

  • row – A namedtuple row from science_table().

Returns:

None.

_style_rebuild_button(step, locked)[source]

Style one (Re)Build button for the lock state (blue idle; orange + disabled while a run is active; plain-disabled if unavailable).

Generated by JXP and Claude.

Parameters:
  • step (str) – The step whose button to style.

  • locked (bool) – Whether a run is in progress.

Returns:

None.

_style_run_pypeit_button(locked)[source]

Style the “Run PypeIt” button for the lock state: a distinct indigo action when idle (set apart from the per-step blue (Re)Build), orange + disabled “⏳ Run in progress” while any run is active.

Generated by JXP and Claude.

Parameters:

locked (bool) – Whether a run is in progress.

Returns:

None.

refresh(model)[source]

Swap in a new model but preserve the selected frame (used by the live monitor / completion refresh).

Generated by JXP and Claude.

Parameters:

model (DashboardModel) – New model.

Returns:

None.

select_frame(frame, det)[source]

Publicly select a (frame, det) row (used when the Status-view science navigator activates a frame; Round-1 #1).

Generated by JXP and Claude.

Parameters:
  • frame (str) – The exposure basename.

  • det – Detector (int) or mosaic.

Returns:

None.

set_locked(locked)[source]

Restyle the (Re)Build controls and the “Run PypeIt” button when the run lock changes (X1).

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 from scratch.

Generated by JXP and Claude.

Parameters:

model (DashboardModel) – New model.

Returns:

None.

pypeit.dashboard.view.science_view._clear_layout(layout)[source]

Remove and delete every item from a Qt layout.

Generated by JXP and Claude.

Parameters:

layout (QLayout) – The layout to empty.

Returns:

None.

pypeit.dashboard.view.science_view._text_on(hexcolor)[source]

Pick a readable text color (black/white) for a background hex color.

Generated by JXP and Claude.

Parameters:

hexcolor (str) – Background color, e.g. #1565C0.

Returns:

'#000000' or '#FFFFFF'.

Return type:

str