modules.masters.dark

KPF Master Dark construction module.

class kpfpipe.modules.masters.dark.Dark(l0_file_list, config=None)

Bases: BaseMasterModule

Construct a master dark frame from a stack of L0 dark exposures.

Standard reduction: a dark is bias-subtracted (_STANDARD_CALIBRATIONS = (“bias”,)). The associated master bias is subtracted from each frame via the shared _process_frame hook (CalibrationAssociation + ImageProcessing) before stacking with sigma-clipped statistics, interpolating bad pixels, and performing a final outlier pass. Outputs a KPFMasterL1 containing per-chip IMG, SNR, and MASK extensions, with IMG in electrons/sec.

Parameters:
  • l0_file_list (list of str) – Sorted list of L0 FITS file paths to stack.

  • config (None | dict | ConfigHandler) – Module configuration. Recognized keys: stack_sigma, chips.

info()

Print a summary of the module configuration and stacking results.

make_master_l1(l0_file_list=None, *, nstream=6, sigma=None, bias=None, master_path=None)

Build master dark from stack.

The constructed KPFMasterL1 is returned and cached on self.ml1_obj; pass master_path to also persist it to disk via save_master(‘L1’, …).

Parameters:
  • l0_file_list (list of str, optional) – L0 files to stack. Defaults to self.l0_file_list.

  • nstream (int, optional) – Stream threshold passed to stack_frames.

  • sigma (float, optional) – Outlier rejection threshold passed to stack_frames.

  • bias (bool | str | KPFMasterL1, optional) – Per-call master-bias override (same forms as ImageProcessing.perform: bool, a master filepath, or a KPFMasterL1 object). A dark’s standard is bias-only, so bias=False skips bias subtraction and bias=”/path/master_bias.fits” uses a specific master. Dark/flat are never applied to a dark, so they are not accepted.

  • master_path (str, optional) – If provided, calls self.save_master(‘L1’, master_path) at the end to persist the master L1 to a FITS file at this path.