HARPS-N
Level 2
RVData/rvdata/instruments/harpsn/level2.py
UNIGE-ESO - EPRV Author: Loris JACQUES & Emile FONTANET Created: Mon Jan 20 2025 Last Modified: Mon Jan 20 2025 Version: 1.0.0
Libraries
- class rvdata.instruments.harpsn.level2.HARPSNRV2
Bases:
RV2Read HARPSN Level 1 and Level 2 files and convert them into the EPRV standard format.
This class extends the RV2 base class to handle the reading of HARPSN (High Accuracy Radial velocity Planet Searcher North) Level 1 and Level 2 files, combining information from both sources to produce a standardized EPRV output. It processes various FITS extensions and organizes flux, wavelength, variance, and metadata into a structured Python object.
- do_conversion(hdul: fits.HDUList) None
Reads the input FITS HDU list, extracts specific extensions related to the science data for different chips and fibers, and stores them in a standardized format.
The method validates the FITS file before conversion to ensure it meets the required criteria.
Retrieves necessary file paths for additional files required in the processing.
Converts the spectral blaze functions (
S2D_BLAZE_A,S2D_BLAZE_B,BLAZE_A,BLAZE_B) for the different fibers.Processes and converts the drift file for instrumental calibration.
Creates the
PRIMARYheader and necessary metadata.For now: Removes unused or redundant extensions such as
RECEIPTandDRP_CONFIG.
- extensions
A dictionary containing all the created extensions, where the keys are extension names, and the values are the respective data arrays.
- Type:
dict
- header
A dictionary containing metadata headers from the FITS files, with each extension’s metadata stored under its respective key.
- Type:
dict
Notes
The
do_conversionmethod processes and extracts science and calibration data.The method ensures the FITS file meets the required criteria before conversion.
Blaze correction functions are processed and stored for each fiber.
The drift file is processed separately for calibration.
Unused extensions (like
RECEIPTandDRP_CONFIG) are removed from the final output.
Example
>>> from core.models.level2 import RV2 >>> rv2_obj = HARPSNRV2.from_fits("harpn_level1_file.fits") >>> rv2_obj.to_fits("standard_level2.fits")
- do_conversion(hdul: HDUList, directory_structure: str = 'standard') None
Converts FITS files based on certain conditions and configurations.
This method performs several processing steps:
Validates the FITS file structure before conversion.
Retrieves paths for required additional files (e.g., blaze functions, drift corrections).
Converts and stores spectral blaze functions for different fibers.
Converts the drift correction data.
Creates the
PRIMARYheader and integrates necessary metadata.Cleans up unused extensions like
RECEIPTandDRP_CONFIG.
- Parameters:
hdul (fits.HDUList) – The FITS HDU list to be processed.
directory_structure (str) – Type of database architecture that stores resources. Must be either ‘dace’ or ‘standard’.
- Raises:
ValueError – If the FITS file is invalid and does not meet the required criteria for conversion.
:noindex: –