KPF

Level 2

class rvdata.instruments.kpf.level2.KPFRV2

Bases: RV2

Data model and reader for RVData Level 2 (RV) data constructed from KPF Level 0 and KPF Level 1 pipeline products.

This class extends the RV2 base class to handle Keck Planet Finder (KPF) data. It reads the relevant science and calibration extensions from both a KPF Level 0 and a KPF Level 1 FITS file, organizes them into a standardized format, and provides convenient access to flux, wavelength, variance, blaze, and metadata for each fiber and chip.

:param Inherits all parameters from RV2.:

extensions

Dictionary of all created extensions (e.g., ‘TRACE2_FLUX’, ‘TRACE2_WAVE’, etc.), mapping extension names to their data arrays.

Type:

dict

headers

Dictionary of headers for each extension, mapping extension names to their FITS headers.

Type:

dict

data

Dictionary of data arrays for each extension.

Type:

dict

Notes

To construct an RVData Level 2 object, both a KPF Level 0 and a KPF Level 1 FITS file are required. The classmethod from_fits should be used to instantiate the object from these files. The _read method is not intended to be called directly by users.

Example

>>> from rvdata.instruments.kpf.level2 import KPFRV2
>>> obj = KPFRV2.from_fits("kpf_L1.fits", l0file="kpf_L0.fits")
>>> obj.to_fits("kpf_L2_standard.fits")

Level 3

class rvdata.instruments.kpf.level3.KPFRV3

Bases: RV3

Data model and reader for RVData Level 3 (stitched spectrum) data constructed from KPF Level 2 data.

This class extends the RV3 base class to handle Keck Planet Finder (KPF) data. It reads the relevant science and calibration extensions from a KPF Level 2 file and produces a stitched 1D spectrum.

KPF has 5 traces: - TRACE1: Calibration fiber (CAL) - TRACE2, TRACE3, TRACE4: Science fibers (SCI1, SCI2, SCI3) - TRACE5: Sky fiber (SKY)

The three science traces (TRACE2, TRACE3, TRACE4) are stitched individually. When multiple traces are present, they are stored in STITCHED_CORR_TRACE{n}_* extensions (e.g., STITCHED_CORR_TRACE2_FLUX, STITCHED_CORR_TRACE3_FLUX, etc.).

Note: The STITCHED_CORR_SCI_* extensions are currently not populated when multiple traces are present. A future enhancement will co-add all science traces to produce these combined “SCI” extensions.

:param Inherits all parameters from RV3.:

extensions

Dictionary of all created extensions (e.g., ‘STITCHED_CORR_SCI_FLUX’, ‘STITCHED_CORR_SCI_WAVE’, etc.), mapping extension names to their data arrays.

Type:

dict

headers

Dictionary of headers for each extension, mapping extension names to their FITS headers.

Type:

dict

data

Dictionary of data arrays for each extension.

Type:

dict

Notes

To construct an RVData Level 3 object, an RVData-standard Level 2 FITS file is required. Native KPF Level 2 files are not directly supported; they must first be converted to RVData-standard format using KPFRV2.from_fits().

The classmethod from_fits should be used to instantiate the object from these files. The _read method is not intended to be called directly by users.

Example

>>> from rvdata.instruments.kpf.level3 import KPFRV3
>>> obj = KPFRV3.from_fits("kpf_L2_standard.fits")
>>> obj.to_fits("kpf_L3_standard.fits")

Level 4

class rvdata.instruments.kpf.level4.KPFRV4

Bases: RV4

Data model and reader for RVData Level 4 (RV) data constructed from KPF Level 2 pipeline products.

This class extends the RV4 base class to handle Keck Planet Finder (KPF) data. It reads the relevant science and calibration extensions from a KPF Level 2 file and organizes them into a standardized format.

:param Inherits all parameters from RV4.:

extensions

Dictionary of all created extensions (e.g., ‘RV1’, ‘CCF1’, etc.), mapping extension names to their data arrays.

Type:

dict

headers

Dictionary of headers for each extension, mapping extension names to their FITS headers.

Type:

dict

data

Dictionary of data arrays for each extension.

Type:

dict

Notes

To construct an RVData Level 4 object, a KPF Level 2 FITS file is required. The classmethod from_fits should be used to instantiate the object from these files. The _read method is not intended to be called directly by users.

Example

>>> from rvdata.instruments.kpf.level4 import KPFRV4
>>> obj = KPFRV4.from_fits("kpf_L2.fits"")
>>> obj.to_fits("kpf_L4_standard.fits")