pypeit.dashboard.inspect module
Build the command lines that launch PypeIt’s existing inspection tools for a calibration step (Qt-free, so it is unit-testable without a display).
The dashboard does not embed plots; it launches the existing CLI tools (pypeit_chk_* / pypeit_view_fits) as subprocesses (design C8/C14). Those scripts have non-uniform signatures, so this module exposes per-step command builders rather than a flat map (S3-Q12):
bias/dark/arc/tiltimg— processed calibration images, opened directly in ``ginga`` (Stage 4 Round-2 #1; these already-oriented PypeIt FITS do not display correctly throughpypeit_view_fits).slits—pypeit_chk_edges <Edges_*>(the Edges file, not theslitsstep’sSlits_*output).wv_calib/tilts/flats/align— a single output file with the matchingpypeit_chk_*tool.scattlight—pypeit_chk_scattlight <ScatteredLight_*> <Slits_*> --det.
Stage 4 adds run_command(), which builds the pypeit_run_to_calibstep
argv used by the Calibrations view’s (Re)Build control (design C10).
Each builder takes the DashboardModel (for the
Calibrations/ directory, the spectrograph, and file resolution) and returns
an argv list, or None if the command cannot be built.
Generated by JXP and Claude.
- pypeit.dashboard.inspect._det_run_arg(det)[source]
Format a detector/mosaic for
pypeit_run_to_calibstep --det, which parses its value withpypeit.core.parse.eval_detectors(): a single integer ("1") is one detector; a parenthesized tuple ("(1,2)") is a mosaic.Generated by JXP and Claude.
- Parameters:
det – Detector (int) or mosaic (tuple/list of ints).
- Returns:
The
--detargument string.- Return type:
- pypeit.dashboard.inspect._edges_file(model, group, det)[source]
Path to the
Edges_*file, derived from theslitsstep’s recordedSlits_*output (so it is correct even when calibrations are shared across groups and named*_all_*, as for fixed-format echelle).Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.group (
int) – Calibration group ID.det – Detector (int) or mosaic (tuple/list).
- Returns:
pathlib.Pathor None.
- pypeit.dashboard.inspect._slits_output(model, group, det)[source]
Path to the
slitsstep’sSlits_*output, orNone.Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.group (
int) – Calibration group ID.det – Detector (int) or mosaic (tuple/list).
- Returns:
pathlib.Pathor None.
- pypeit.dashboard.inspect._spectrograph(model)[source]
Return the spectrograph name for the model, or
None.Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.- Returns:
The spectrograph name.
- Return type:
str or None
- pypeit.dashboard.inspect.output_command(model, step, group, det)[source]
Build the
argvto inspect a step’s processed output (C8).Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.step (
str) – Calibration step name.group (
int) – Calibration group ID.det – Detector (int) or mosaic (tuple/list).
- Returns:
The command
argv, orNoneif it cannot be built (e.g. no output file / unknown spectrograph / step not viewable).- Return type:
list or None
- pypeit.dashboard.inspect.output_target(model, step, group, det)[source]
Return the primary file the “Inspect output” command will open, so the view can enable the control only when that file exists on disk.
Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.step (
str) – Calibration step name.group (
int) – Calibration group ID.det – Detector (int) or mosaic (tuple/list).
- Returns:
The file that would be opened, or
Noneif there is no viewer for this step.- Return type:
pathlib.Pathor None
- pypeit.dashboard.inspect.run_command(model, step, group, det)[source]
Build the
argvto (re)build a calibration step via the existingpypeit_run_to_calibstepscript (design C10).The dashboard always fixes the calibration group and detector (the scope drop-downs), so it passes
--calib_groupand--det(never the script’s alternative--science_frameform) plus--redux_pathso the run writes to the same reduction directory.run_to_calibstepgenerates the requested step and every step that precedes it, reusing the ones already on disk.Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.step (
str) – Calibration step name (e.g.wv_calib).group (
int) – Calibration group ID.det – Detector (int) or mosaic (tuple/list).
- Returns:
The
pypeit_run_to_calibstepcommandargv, orNoneif the model has no.pypeitfile.- Return type:
list or None
- pypeit.dashboard.inspect.run_pypeit_command(model)[source]
Build the
argvto run the full reduction viarun_pypeit -o(Round-6): process every science/standard frame, overwriting the existing outputs. This is the science analogue of a “build everything” action, distinct from the per-step (Re)Build controls.Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.- Returns:
The
run_pypeitcommandargv(with-oto overwrite and--redux_pathto write to the reduction directory), orNoneif the model has no.pypeitfile.- Return type:
list or None
- pypeit.dashboard.inspect.science_object_name(spat_pixpos, slitid, det_name)[source]
Reconstruct a 1D object’s extension name (
SPAT####-SLIT####-DET##), matchingpypeit.specobj.SpecObj.set_name(), sopypeit_show_1dspeccan be pointed at a specific object (Stage 6, S6-Q10 option (a)).Generated by JXP and Claude.
- pypeit.dashboard.inspect.science_run_command(model, frame, det, step)[source]
Build the
argvto (re)build a science step via the existingpypeit_reduce_by_stepscript (Stage 6, design R15).reduce_by_steptakes a raw frame filename (not the combined basename), so the raw frame is taken from the science entry’s recordedraw_files.Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.frame (
str) – The science exposure basename (table key).det – Detector (int) or mosaic (tuple/list).
step (
str) – One ofprocess/findobj/extract.
- Returns:
The
pypeit_reduce_by_stepcommandargv, orNoneif the model has no.pypeitfile or no raw frame is known.- Return type:
list or None
- pypeit.dashboard.inspect.spec1d_command(spec1d_file, obj_name=None)[source]
Build the
argvto view a science 1D spectrum (pypeit_show_1dspec <spec1d> [--obj <name>]). Per the design, the user picks an object; pass its reconstructed name (seescience_object_name()).Generated by JXP and Claude.
- Parameters:
spec1d_file (
str,pathlib.Path) – Path to thespec1dproduct (orNone).obj_name (
str, optional) – The object extension name to plot.
- Returns:
The command
argv, orNoneif no file.- Return type:
list or None
- pypeit.dashboard.inspect.spec2d_command(spec2d_file, det=None)[source]
Build the
argvto view a science 2D spectrum (pypeit_show_2dspec <spec2d> [--det]).Generated by JXP and Claude.
- Parameters:
spec2d_file (
str,pathlib.Path) – Path to thespec2dproduct (orNone).det (optional) – Detector (int) or mosaic (tuple/list) to show.
- Returns:
The command
argv, orNoneif no file.- Return type:
list or None
- pypeit.dashboard.inspect.view_input_command(model, input_file, det=None)[source]
Build the
argvto view a single input (raw) frame (C7).Uses
pypeit_view_fits --procso the raw frame is oriented/trimmed and shown properly formatted (not the bare, unoriented FITS; Stage 3b #1).Generated by JXP and Claude.
- Parameters:
model (
DashboardModel) – The model.input_file (
str) – Path to the raw input frame.det (optional) – The detector (int) or mosaic (tuple/list) the frame belongs to, passed to
--detso the right detector is processed.
- Returns:
The
pypeit_view_fitscommand, orNoneif the spectrograph is unknown.- Return type:
list or None