quality_control.quicklook
- class kpfpipe.quality_control.quicklook.PlotL0(l0_obj, output_dir=None, full_res=False)
Bases:
objectQuicklook plots for KPF L0 (raw CCD) data.
Takes a KPF0 object and generates plots of the raw detector images. Pure visualization — no science computation. Amplifier counting and orientation delegate to ImageAssembly so detector-geometry knowledge has a single home.
- Parameters:
l0_obj (KPF0) – KPF0 data object.
output_dir (str or None) – Directory to save PNG files. None returns the Figure only.
full_res (bool) – Save full 1:1 pixel-resolution PNGs instead of the default downsampled figure PNGs. Full-resolution files can be tens of MB per chip.
- run(which, *, full_res=None)
Generate the requested plot(s) for every chip that has data.
Saves each to output_dir and, in that save-to-disk mode, closes the matplotlib figure so callers don’t accumulate them. When output_dir is None the figures are returned open, so they display when the caller renders them (e.g. interactively in a notebook).
- Parameters:
which (str) – ‘all’ to run every implemented plot, or the name of a single plot method (one of self._PLOT_METHODS).
full_res (bool or None) – Save native-size PNGs when true. None uses the constructor’s full_res setting.
- Returns:
Maps {method_name}_{chip} to its matplotlib.Figure (closed only when saved to output_dir); useful for tests and introspection.
- Return type:
dict
- Raises:
ValueError – If which is neither ‘all’ nor a known plot method name.
- stitched_image(chip, *, full_res=None)
Plot the stitched raw detector image for one CCD.
Replicates v2.12 plot_L0_stitched_image.
- Parameters:
chip (str) – ‘green’ or ‘red’.
full_res (bool or None) – Save a native-size, one-output-pixel-per-CCD-pixel PNG when true. None uses the constructor’s full_res setting.
- Returns:
The stitched-image figure.
- Return type:
matplotlib.Figure
- class kpfpipe.quality_control.quicklook.PlotL1(l1_obj, output_dir=None, full_res=False)
Bases:
objectQuicklook plots for KPF L1 (assembled FFI) data.
Takes a KPF1 object and generates plots of the assembled detector image. Pure visualization — no science computation. Read-noise header mapping is imported from ImageAssembly so there is one source of truth for which FITS keywords hold which amplifier’s read noise.
- Parameters:
l1_obj (KPF1) – KPF1 data object (post-ImageAssembly).
output_dir (str or None) – Directory to save PNG files. None returns the Figure only.
full_res (bool) – Save full 1:1 pixel-resolution PNGs instead of the default downsampled figure PNGs. Full-resolution files can be tens of MB per chip.
- bias_subtracted(chip)
Image with master bias subtracted.
Matches v2.12 plot_2D_image(subtract_master_bias=True).
- column_cut(chip)
Median column profiles at 10th/50th/90th percentiles. Matches v2.12 plot_2D_column_cut.
- dark_subtracted(chip)
Image with master dark subtracted, displayed in e-/hr. Matches v2.12 plot_2D_image(subtract_master_dark=True).
- histogram(chip)
Flux distribution histogram. Matches v2.12 plot_2D_image_histogram.
- image(chip, *, full_res=None)
Plot the assembled FFI for one CCD.
Replicates v2.12 plot_2D_image for the basic science-frame case.
- Parameters:
chip (str) – ‘green’ or ‘red’.
full_res (bool or None) – Save a native-size, one-output-pixel-per-CCD-pixel PNG when true. None uses the constructor’s full_res setting.
- Returns:
The assembled-FFI figure.
- Return type:
matplotlib.Figure
- order_trace_overlay(chip)
2x2 grid with order trace overlaid. Matches v2.12 plot_2D_order_trace2x2. Requires calibration DB lookup for order trace file (not yet in v3).
- run(which, *, full_res=None)
Generate the requested plot(s) for every chip that has data.
Saves each to output_dir and, in that save-to-disk mode, closes the matplotlib figure so callers don’t accumulate them. When output_dir is None the figures are returned open, so they display when the caller renders them (e.g. interactively in a notebook).
- Parameters:
which (str) – ‘all’ to run every implemented plot, or the name of a single plot method (one of self._PLOT_METHODS).
full_res (bool or None) – Save native-size PNGs when true. None uses the constructor’s full_res setting.
- Returns:
Maps {method_name}_{chip} to its matplotlib.Figure (closed only when saved to output_dir); useful for tests and introspection.
- Return type:
dict
- Raises:
ValueError – If which is neither ‘all’ nor a known plot method name.
- zoom_3x3(chip)
3x3 grid of zoomed detector regions. Matches v2.12 plot_2D_image_zoom_3x3.
- class kpfpipe.quality_control.quicklook.PlotL2(l2_obj, output_dir=None, obs_id=None)
Bases:
objectQuicklook plots for KPF L2 (extracted 1D spectra) data.
- Parameters:
l2_obj – KPF2 data object (post-SpectralExtraction; requires WavelengthCalibration to have populated the per-fiber WAVE arrays).
output_dir – directory to save PNG files. None = return Figure only.
obs_id – observation ID for titles/filenames. If None, falls back to the l2_obj.obs_id attribute (populated on every construction path).
- orderlet_flux_ratios(chip)
Per-order orderlet flux ratios (SCI1/SCI2, SCI3/SCI2, SCI1/SCI3, SKY/SCI2, CAL/SCI2) vs order-center wavelength, one panel each, with the all-order median annotated.
- peak_flux(chip)
Per-order peak flux (95th pctile counts) for each fiber and the summed-SCI orderlet.
- run(which)
Generate the requested plot(s) for every chip that has data, saving each to
output_dir. In that save-to-disk mode the figure is closed so callers don’t accumulate them; whenoutput_diris None the figures are returned open, so they display when the caller renders them (e.g. interactively in a notebook).- Parameters:
which – ‘all’ to run every implemented plot, or the name of a single plot method (one of
self._PLOT_METHODS).- Returns:
dict mapping
{method_name}_{chip}to matplotlib.Figure (closed only when saved tooutput_dir; useful for tests/introspection).
- snr_per_order(chip)
Per-order SNR (95th pctile of flux/sqrt(|var|)) for each fiber plus the summed-SCI orderlet, vs order-center wavelength.
- spectrum_one_row(chip, fibers=None)
Stacked per-fiber spectrum: one panel per fiber, all orders of that fiber concatenated, x-axis is concatenated wavelength.
- spectrum_single_order(chip, order=None)
Overplot the science orderlets (and SKY/CAL) for a single spectral order vs wavelength.
- Parameters:
chip – ‘GREEN’ or ‘RED’.
order – 1-indexed spectral order. Defaults to a representative order near the middle of the chip.
- class kpfpipe.quality_control.quicklook.PlotL4(l4_obj, output_dir=None, obs_id=None)
Bases:
objectQuicklook plots for KPF L4 (RVs and CCFs) data.
- Parameters:
l4_obj – KPF4 data object (post-CrossCorrelation + RadialVelocity).
output_dir – directory to save PNG files. None = return Figure only.
obs_id – observation ID for titles/filenames. If None, falls back to the l4_obj.obs_id attribute (populated on every construction path).
- ccf_grid(chip)
Per-orderlet CCF grid for one chip, matching the v2.12 plot_CCF_grid layout: five panels (SCI1, SCI2, SCI3, CAL, SKY), each order’s CCF normalized and offset, colored by the default cycle and labeled by order index. SCI panels add the combined-RV line + value and per-order delta-RV / weight columns. Returns None if the chip has no CCF data.
- run(which)
Generate the requested plot(s) for every chip that has CCF data, saving each to
output_dir. In that save-to-disk mode the figure is closed so callers don’t accumulate them; whenoutput_diris None the figures are returned open, so they display when the caller renders them (e.g. interactively in a notebook).- Parameters:
which – ‘all’ to run every implemented plot, or the name of a single plot method (one of
self._PLOT_METHODS).- Returns:
dict mapping
{method_name}_{chip}to matplotlib.Figure (closed only when saved tooutput_dir; useful for tests/introspection).
Submodules
L0 quicklook plots for raw KPF detector images. |
|
L1 quicklook plots for assembled FFI. |
|
L2 quicklook plots for extracted KPF 1D spectra. |
|
L4 quicklook plots for KPF cross-correlation functions (CCFs) and RVs. |