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. Those scripts
have non-uniform signatures, so this module exposes per-step command
builders rather than a flat map:
bias/dark/arc/tiltimg— processed calibration images, opened directly in ``ginga`` (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.
This module also builds the pypeit_run_to_calibstep argv used by the
Calibrations view’s (Re)Build control, and the science-product viewer /
pypeit_reduce_by_step / run_pypeit argv used by the Science view.
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.
- 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.
- 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).- Parameters:
model (
DashboardModel) – The dashboard model.group (
int) – Calibration group ID.det (
int,tuple,list) – Detector (int) or mosaic (tuple/list).
- Returns:
The
Edges_*path.- Return type:
pathlib.Pathor None
- pypeit.dashboard.inspect._slits_output(model, group, det)[source]
Path to the
slitsstep’sSlits_*output, orNone.- Parameters:
model (
DashboardModel) – The dashboard model.group (
int) – Calibration group ID.det (
int,tuple,list) – Detector (int) or mosaic (tuple/list).
- Returns:
The
Slits_*output path.- Return type:
pathlib.Pathor None
- pypeit.dashboard.inspect._spectrograph(model)[source]
Return the spectrograph name for the model, or
None.- Parameters:
model (
DashboardModel) – The dashboard model.- Returns:
The spectrograph name.
- Return type:
stror None
- pypeit.dashboard.inspect.output_command(model, step, group, det)[source]
Build the
argvto inspect a step’s processed output.- Parameters:
- Returns:
The command
argv, orNoneif it cannot be built (e.g. no output file / unknown spectrograph / step not viewable).- Return type:
listor 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.
- Parameters:
- 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.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.- Parameters:
- Returns:
The
pypeit_run_to_calibstepcommandargv, orNoneif the model has no.pypeitfile.- Return type:
listor None
- pypeit.dashboard.inspect.run_pypeit_command(model)[source]
Build the
argvto run the full reduction viarun_pypeit -o: 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.- Parameters:
model (
DashboardModel) – The dashboard model.- Returns:
The
run_pypeitcommandargv(with-oto overwrite and--redux_pathto write to the reduction directory), orNoneif the model has no.pypeitfile.- Return type:
listor None
- pypeit.dashboard.inspect.science_object_name(spat_pixpos, slitid, det_name)[source]
Reconstruct a 1D object’s extension name (
SPAT####-SLIT####-DET##), matching the format written bypypeit.specobj.SpecObj.set_name(), sopypeit_show_1dspeccan be pointed at a specific object.Note
pypeit.specobj.SpecObj.set_name()is the authoritative implementation of this format, but it is an instance method that requires a fully populatedSpecObj; the dashboard only has the (spatial position, slit, detector) values recorded in the reduction state, so the name is reconstructed here. If a standalone name-construction utility is ever factored out ofSpecObj, use it here instead.
- 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.reduce_by_steptakes a raw frame filename (not the combined basename), so the raw frame is taken from the science entry’s recordedraw_files.- Parameters:
- Returns:
The
pypeit_reduce_by_stepcommandargv, orNoneif the model has no.pypeitfile or no raw frame is known.- Return type:
listor 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>]). The user picks an object; pass its reconstructed name (seescience_object_name()).- 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:
listor None
- pypeit.dashboard.inspect.spec2d_command(spec2d_file, det=None)[source]
Build the
argvto view a science 2D spectrum (pypeit_show_2dspec <spec2d> [--det]).
- pypeit.dashboard.inspect.view_input_command(model, input_file, det=None)[source]
Build the
argvto view a single input (raw) frame.Uses
pypeit_view_fits --procso the raw frame is oriented/trimmed and shown properly formatted (not the bare, unoriented FITS).- Parameters:
model (
DashboardModel) – The dashboard model.input_file (
str) – Path to the raw input frame.det (
int,tuple,list, 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:
listor None