ERIS Pipeline Reference Manual 1.9.2
Functions
IFU Data Flow System (DFS) Functions

Functions

cpl_error_code eris_ifu_dfs_set_groups (cpl_frameset *self)
 Set the frame group (RAW, CALIB, or PRODUCT) for all frames in a frameset.
 
cpl_frameset * eris_ifu_extract_frameset (const cpl_frameset *in, const char *tag)
 Extract frames with a specific tag from a frameset.
 
cpl_error_code eris_ifu_heades_add_hduclass_common (cpl_propertylist *plist, const char *deq_hduclas)
 Add common HDU classification properties to FITS header.
 
cpl_error_code eris_ifu_heades_add_hduclass_data (cpl_propertylist *plist)
 Add data extension classification properties to FITS header.
 
cpl_error_code eris_ifu_heades_add_hduclass_errs (cpl_propertylist *plist, deqErrorType errorType)
 Add error extension classification properties to FITS header.
 
cpl_error_code eris_ifu_heades_add_hduclass_qual (cpl_propertylist *plist, deqQualityType qualityType)
 Add quality extension classification properties to FITS header.
 
cpl_error_code eris_ifu_save_deq_image (cpl_frameset *allframes, cpl_propertylist *header, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_frame *inherit, const char *recipe, const cpl_propertylist *applist, const char *remregexp, const char *filename, const cpl_image *image, const cpl_image *error, deqErrorType errorType, const cpl_image *dataQualityMask, deqQualityType dataQualityType, const char *unit)
 Save a DFS-compliant image product with data, error, and quality extensions.
 
cpl_error_code eris_ifu_save_deq_cube (cpl_frameset *allframes, cpl_propertylist *header, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_frame *inherit, const char *recipe, cpl_propertylist *applist, const char *remregexp, const char *filename, cpl_imagelist *data, cpl_imagelist *error, deqErrorType errorType, const cpl_imagelist *dataQualityMask, deqQualityType qualityType)
 Save a DFS-compliant cube product with data, error, and quality extensions.
 
cpl_error_code eris_ifu_save_image_phase3 (cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const char *recipe, const cpl_propertylist *applist, const char *remregexp, const char *filename, const cpl_image *image, cpl_type type, const char *unit)
 Save a DFS-compliant Phase 3 image product.
 
cpl_error_code eris_ifu_save_table (cpl_frameset *allframes, cpl_propertylist *header, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_frame *inherit, const char *recipe, const char *procatg, cpl_propertylist *applist, const char *remregexp, const char *filename, const cpl_table *table)
 Save a DFS-compliant table product.
 
cpl_error_code eris_ifu_load_deq_image (const char *filename, cpl_propertylist **primaryHeader, cpl_image **dataImage, cpl_image **errImage, cpl_image **qualImage, deqErrorType *errorType, deqQualityType *qualityType)
 ‍** Function to write a DFS compliant pipeline product with a badpixel map
 
cpl_error_code eris_ifu_load_deq_imagelist (const char *filename, cpl_propertylist **primaryHeader, cpl_imagelist **dataImagelist, cpl_imagelist **errImagelist, cpl_imagelist **qualImagelist, deqErrorType *errorType, deqQualityType *qualityType)
 Load a DEQ-format imagelist (cube) with data, error, and quality extensions.
 
hdrl_image * eris_ifu_load_deq_hdrl_image (const char *filename, cpl_propertylist **primaryHeader, cpl_image **qualImage, deqQualityType *qualityType)
 Load a DEQ-format file into an HDRL image structure.
 
hdrl_imagelist * eris_ifu_load_deq_hdrl_imagelist (const char *filename, cpl_propertylist **primaryHeader, cpl_imagelist **qualImagelist, deqQualityType *qualityType)
 Load a DEQ-format cube into an HDRL imagelist structure.
 
hdrl_image * eris_ifu_load_cal_image_frame (const cpl_frame *frame, ifsBand band, ifsPreopticsScale scale, cpl_image **qualImage, deqQualityType *qualType)
 Load a calibration image from a frame.
 
hdrl_image * eris_ifu_load_cal_image_file (const char *filename, ifsBand band, ifsPreopticsScale scale, cpl_image **qualImage, deqQualityType *qualType)
 Load a calibration image from a filename.
 
cpl_error_code eris_ifu_load_distortion_polynomials_old (const char *filename, cpl_polynomial **poly_u, cpl_polynomial **poly_v)
 Load old-format distortion polynomials from a table.
 
cpl_error_code eris_ifu_load_distortion_polynomials (const char *filename, cpl_polynomial ***polynomials, cpl_table **borders)
 Load distortion polynomials and slitlet borders from a table.
 
cpl_vector * eris_ifu_load_distances (const char *filename)
 Load slitlet distance vector from a table.
 
cpl_bivector * eris_ifu_load_slit_positions (const char *filename)
 Load slitlet position bivector from a table.
 
cpl_error_code eris_ifu_append_qc_int (cpl_propertylist *pl, const char *name, int val, const char *comment)
 Append a QC parameter of type INT to a property list.
 
cpl_error_code eris_ifu_append_qc_double (cpl_propertylist *pl, const char *name, double val, const char *comment)
 Append a QC parameter of type DOUBLE to a property list.
 
cpl_error_code eris_ifu_append_qc_float (cpl_propertylist *pl, const char *name, float val, const char *comment)
 Append a QC parameter of type FLOAT to a property list.
 
cpl_error_code eris_ifu_set_qc_int (cpl_propertylist *pl, const char *name, int val, const char *comment)
 Set (or update) a QC parameter of type INT in a property list.
 
bool eris_ifu_frame_is_on (const cpl_frame *fr)
 Determine if a frame has calibration lamps ON or OFF.
 
bool eris_ifu_frame_is_sky (const cpl_frame *fr)
 Determine if a frame is a sky frame.
 
float eris_ifu_get_dit (cpl_propertylist *header)
 Get the detector integration time (DIT) from FITS header.
 
int eris_ifu_get_callamp_status (cpl_propertylist *header)
 Return a bit mask indicating which calibration lamps are turned on.
 
ifsBand eris_ifu_get_band (const cpl_propertylist *header)
 Determine preoptic band.
 
ifsInstrument eris_ifu_get_instrument (const cpl_propertylist *header)
 Return the used instrument of the FITS file header.
 
ifsPreopticsScale eris_ifu_get_spiffier_preoptics_scale (const char *scaleId)
 Determine observing scale on Sky.
 
ifsPreopticsScale eris_ifu_get_spiffi_preoptics_scale (const char *scaleId)
 Determine observing scale on Sky.
 
ifsPreopticsScale eris_ifu_get_preopticsScale (cpl_propertylist *header)
 Return the the pre-optics scaling.
 
double eris_get_cumoffs_ra (cpl_frame *frame)
 find out the ESO OCS CUMOFFS RA of the observation
 
double eris_get_cumoffs_dec (cpl_frame *frame)
 find out the ESO OCS CUMOFFS DEC of the observation
 
double eris_get_mjd_obs (cpl_frame *frame)
 find out the Julian Date of the observation
 
cpl_boolean eris_ifu_tag_is_cdb (char *tag)
 check if input frame tag is a static of master calibration
 
cpl_boolean eris_ifu_tag_is_sky (const char *tag)
 check if input frame tag is a static of master calibration
 
cpl_boolean eris_ifu_tag_is_obj (const char *tag)
 Add PRO* keywords to a SINFONI FITS header.
 
cpl_error_code eris_ifu_extract_obj_frames (const cpl_frameset *sof, cpl_frameset *obj)
 extract object raw frames from frame set and put them in a new one
 
cpl_error_code eris_ifu_extract_sky_frames (const cpl_frameset *sof, cpl_frameset *sky)
 extract sky raw frames from frame set and put them in a new one
 
cpl_error_code eris_ifu_extract_mst_frames (const cpl_frameset *sof, cpl_frameset *cdb)
 extract master and ref frames from input set and put them in a new one
 

Detailed Description

This module provides Data Flow System (DFS) compliant I/O functions for ERIS IFU pipeline products, including functions for:

All save functions create products compliant with ESO's Data Exchange Qualifiers (DEQ) standard (VLT-SPE-ESO-19500-5667), which defines the structure of data products with separate extensions for data, errors, and data quality information.

Synopsis:
#include "eris_ifu_dfs.h"

Function Documentation

◆ eris_get_cumoffs_dec()

double eris_get_cumoffs_dec ( cpl_frame *  frame)

find out the ESO OCS CUMOFFS DEC of the observation

Parameters
frameinput frame
Returns
the requested value or 0.0 on error

Queries FITS header ESO OCS CUMOFFS DEC

Definition at line 2423 of file eris_ifu_dfs.c.

References eris_check_error_code().

◆ eris_get_cumoffs_ra()

double eris_get_cumoffs_ra ( cpl_frame *  frame)

find out the ESO OCS CUMOFFS RA of the observation

Parameters
frameinput frame
Returns
the requested value or 0.0 on error

Queries FITS header ESO OCS CUMOFFS RA

Definition at line 2381 of file eris_ifu_dfs.c.

References eris_check_error_code().

◆ eris_get_mjd_obs()

double eris_get_mjd_obs ( cpl_frame *  frame)

find out the Julian Date of the observation

Parameters
frameinput frame
Returns
the requested value or 0.0 on error

Queries FITS header MJD-OBS

Definition at line 2463 of file eris_ifu_dfs.c.

References eris_check_error_code(), and eris_pfits_get_mjdobs().

◆ eris_ifu_append_qc_double()

cpl_error_code eris_ifu_append_qc_double ( cpl_propertylist *  pl,
const char *  name,
double  val,
const char *  comment 
)

Append a QC parameter of type DOUBLE to a property list.

Parameters
plProperty list
nameQC parameter name (without "ESO QC " prefix)
valQC parameter double value
commentComment string to attach
Returns
CPL_ERROR_NONE on success, otherwise an error code

Adds a quality control parameter with automatic "ESO QC " prefix to the property list with the specified value and comment.

Note
The "ESO QC " prefix is automatically added to the name.

Definition at line 1769 of file eris_ifu_dfs.c.

References CATCH, eris_check_error_code(), eris_ifu_free_string(), and TRY.

Referenced by eris_ifu_dark_qc(), eris_ifu_get_badpix_qc_from_ima(), and eris_ifu_get_badpix_qc_from_mask().

◆ eris_ifu_append_qc_float()

cpl_error_code eris_ifu_append_qc_float ( cpl_propertylist *  pl,
const char *  name,
float  val,
const char *  comment 
)

Append a QC parameter of type FLOAT to a property list.

Parameters
plProperty list
nameQC parameter name (without "ESO QC " prefix)
valQC parameter float value
commentComment string to attach
Returns
CPL_ERROR_NONE on success, otherwise an error code

Adds a quality control parameter with automatic "ESO QC " prefix to the property list with the specified value and comment.

Note
The "ESO QC " prefix is automatically added to the name.

Definition at line 1813 of file eris_ifu_dfs.c.

References CATCH, eris_check_error_code(), eris_ifu_free_string(), and TRY.

Referenced by eris_ifu_dark_qc(), and eris_ifu_jitter_process_exposures().

◆ eris_ifu_append_qc_int()

cpl_error_code eris_ifu_append_qc_int ( cpl_propertylist *  pl,
const char *  name,
int  val,
const char *  comment 
)

Append a QC parameter of type INT to a property list.

Parameters
plProperty list
nameQC parameter name (without "ESO QC " prefix)
valQC parameter integer value
commentComment string to attach
Returns
CPL_ERROR_NONE on success, otherwise an error code

Adds a quality control parameter with automatic "ESO QC " prefix to the property list with the specified value and comment.

Note
The "ESO QC " prefix is automatically added to the name.

Definition at line 1725 of file eris_ifu_dfs.c.

References CATCH, eris_check_error_code(), eris_ifu_free_string(), and TRY.

Referenced by eris_ifu_dark_qc(), eris_ifu_get_badpix_qc_from_ima(), and eris_ifu_get_badpix_qc_from_mask().

◆ eris_ifu_dfs_set_groups()

cpl_error_code eris_ifu_dfs_set_groups ( cpl_frameset *  self)

Set the frame group (RAW, CALIB, or PRODUCT) for all frames in a frameset.

Parameters
selfThe frameset to process
Returns
CPL_ERROR_NONE on success, otherwise an error code

Iterates through all frames in the frameset and assigns the appropriate group based on the frame's tag:

  • RAW: Raw observation frames
  • CALIB: Calibration frames (reference and product calibrations)
  • PRODUCT: Pipeline product frames (e.g., from jitter recipe)
Note
The function also verifies that all frames are from the same instrument.
Frames without tags or with unknown tags will cause an error.

Definition at line 89 of file eris_ifu_dfs.c.

References BRK_IF_ERROR, BRK_IF_NULL, BRK_WITH_ERROR_MSG, CATCH, eris_check_error_code(), eris_ifu_get_instrument_frame(), and TRY.

Referenced by eris_ifu_jitter_processSof().

◆ eris_ifu_extract_frameset()

cpl_frameset * eris_ifu_extract_frameset ( const cpl_frameset *  in,
const char *  tag 
)

Extract frames with a specific tag from a frameset.

Parameters
inInput non-empty frameset
tagThe tag of the frames to extract
Returns
Newly created frameset containing only frames with the specified tag, or NULL on error

Creates a new frameset containing duplicates of all frames from the input frameset that match the specified tag. If no frames match, NULL is returned.

Note
The returned frameset must be deallocated with cpl_frameset_delete().
The frames in the returned frameset are duplicates, not references.

Definition at line 201 of file eris_ifu_dfs.c.

References eris_check_error_code().

Referenced by eris_ifu_combine(), eris_ifu_combine_pbp(), and eris_ifu_jitter_process_cubes().

◆ eris_ifu_extract_mst_frames()

cpl_error_code eris_ifu_extract_mst_frames ( const cpl_frameset *  sof,
cpl_frameset *  cdb 
)

extract master and ref frames from input set and put them in a new one

Parameters
sofinput frame set
cdboutput frame set
Returns
CPL error code

Definition at line 2654 of file eris_ifu_dfs.c.

References eris_check_error_code(), and eris_ifu_tag_is_cdb().

◆ eris_ifu_extract_obj_frames()

cpl_error_code eris_ifu_extract_obj_frames ( const cpl_frameset *  sof,
cpl_frameset *  obj 
)

extract object raw frames from frame set and put them in a new one

Parameters
sofinput frame set
objoutput frame set
Returns
CPL error code

Definition at line 2581 of file eris_ifu_dfs.c.

References eris_check_error_code(), and eris_ifu_tag_is_obj().

◆ eris_ifu_extract_sky_frames()

cpl_error_code eris_ifu_extract_sky_frames ( const cpl_frameset *  sof,
cpl_frameset *  sky 
)

extract sky raw frames from frame set and put them in a new one

Parameters
sofinput frame set
skyoutput frame set
Returns
CPL error code

Definition at line 2620 of file eris_ifu_dfs.c.

References eris_check_error_code(), and eris_ifu_tag_is_sky().

◆ eris_ifu_frame_is_on()

bool eris_ifu_frame_is_on ( const cpl_frame *  fr)

Determine if a frame has calibration lamps ON or OFF.

Parameters
frInput frame
Returns
True if frame is lamp-ON or science observation, false otherwise

Checks the DPR.TYPE keyword and calibration lamp status keywords to determine if the frame is an "on" frame. Science frames (STD, PSF, SKY, OBJECT) and frames with any calibration lamp turned on are considered "on" frames.

Note
Checks both SPIFFIER and SPIFFI lamp status keywords.
Returns false if the file cannot be read or keywords are missing.

Definition at line 1899 of file eris_ifu_dfs.c.

References BRK_WITH_ERROR_MSG, CATCH, eris_check_error_code(), eris_ifu_file_exists(), eris_ifu_free_propertylist(), eris_ifu_free_string(), eris_ifu_get_callamp_status(), and TRY.

Referenced by eris_compute_gain(), and eris_ifu_detlin_load_frames().

◆ eris_ifu_frame_is_sky()

bool eris_ifu_frame_is_sky ( const cpl_frame *  fr)

Determine if a frame is a sky frame.

Parameters
frInput frame
Returns
True if frame is a sky frame, false otherwise

Checks the DPR.TYPE keyword to determine if the frame contains a sky observation (calibration or science).

Note
Returns false if the file cannot be read or keywords are missing.

Definition at line 1960 of file eris_ifu_dfs.c.

References BRK_WITH_ERROR_MSG, CATCH, eris_check_error_code(), eris_ifu_file_exists(), eris_ifu_free_propertylist(), eris_ifu_free_string(), and TRY.

◆ eris_ifu_get_band()

ifsBand eris_ifu_get_band ( const cpl_propertylist *  header)

◆ eris_ifu_get_callamp_status()

int eris_ifu_get_callamp_status ( cpl_propertylist *  header)

Return a bit mask indicating which calibration lamps are turned on.

Parameters
headerof the FITS file as property list
Returns
an integer bit mask, for each active lamp the bit is set

The bit values for the lamps are defined in the AR_LAMP, KR_LAMP, NE_LAMP, XE_LAMP and QTH_LAMP macros.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT The header parameter is a NULL pointer
  • CPL_ERROR_DATA_NOT_FOUND The header ' an ERIS/SPIFFIER nor an SINFONI/SPIFFI one.

Definition at line 2053 of file eris_ifu_dfs.c.

References CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_get_instrument(), and TRY.

Referenced by eris_ifu_frame_is_on(), and eris_ifu_wave_get_arc_images().

◆ eris_ifu_get_dit()

float eris_ifu_get_dit ( cpl_propertylist *  header)

Get the detector integration time (DIT) from FITS header.

Parameters
headerFITS header property list
Returns
DIT value in seconds, or 0.0 on error

Extracts the DET.SEQ1.DIT keyword value from the header. The keyword name differs between SPIFFIER and SPIFFI instruments.

Note
Returns 0.0 if the header is NULL or the keyword cannot be read.

Definition at line 2013 of file eris_ifu_dfs.c.

References CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_get_instrument(), and TRY.

Referenced by eris_ifu_detlin_load_frames(), eris_ifu_jitter_get_objsky_exposures(), and eris_ifu_wave_get_arc_images().

◆ eris_ifu_get_instrument()

ifsInstrument eris_ifu_get_instrument ( const cpl_propertylist *  header)

Return the used instrument of the FITS file header.

Parameters
headerof the FITS file as property list
Returns
an value of the instrument enumeration (SPIFFIER,SPIFFI,NIX,OTHER)

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT The header parameter is a NULL pointer
  • CPL_ERROR_BAD_FILE_FORMAT Unknown VLT instrument in header

Definition at line 2220 of file eris_ifu_dfs.c.

References BRK_WITH_ERROR, CATCH, CHECK_ERROR_STATE_MSG, eris_check_error_code(), SET_ERROR_MSG, and TRY.

Referenced by eris_ifu_get_band(), eris_ifu_get_callamp_status(), eris_ifu_get_dit(), eris_ifu_get_instrument_frame(), eris_ifu_get_preopticsScale(), eris_ifu_load_exposure_file(), and eris_ifu_wave_get_arc_images().

◆ eris_ifu_get_preopticsScale()

ifsPreopticsScale eris_ifu_get_preopticsScale ( cpl_propertylist *  header)

Return the the pre-optics scaling.

Parameters
headerof the FITS file as property list
Returns
an value of the preopticsScale enumeration (S250MAS, S100MAS or S25MAS) )

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT The header parameter is a NULL pointer
  • CPL_ERROR_BAD_FILE_FORMAT Unknown VLT instrument in header

Definition at line 2336 of file eris_ifu_dfs.c.

References CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_get_instrument(), eris_ifu_get_spiffi_preoptics_scale(), eris_ifu_get_spiffier_preoptics_scale(), and TRY.

Referenced by eris_ifu_jitter_get_instrument_settings(), eris_ifu_load_cal_image_file(), and eris_ifu_wave_get_arc_images().

◆ eris_ifu_get_spiffi_preoptics_scale()

ifsPreopticsScale eris_ifu_get_spiffi_preoptics_scale ( const char *  scaleId)

Determine observing scale on Sky.

Parameters
scaleIdscale ID
Returns
scale setting

Definition at line 2304 of file eris_ifu_dfs.c.

References eris_check_error_code().

Referenced by eris_ifu_get_preopticsScale().

◆ eris_ifu_get_spiffier_preoptics_scale()

ifsPreopticsScale eris_ifu_get_spiffier_preoptics_scale ( const char *  scaleId)

Determine observing scale on Sky.

Parameters
scaleIdscale ID
Returns
scale setting

Definition at line 2279 of file eris_ifu_dfs.c.

References eris_check_error_code().

Referenced by eris_ifu_get_preopticsScale().

◆ eris_ifu_heades_add_hduclass_common()

cpl_error_code eris_ifu_heades_add_hduclass_common ( cpl_propertylist *  plist,
const char *  deq_hduclas 
)

Add common HDU classification properties to FITS header.

Parameters
plistFITS header property list to modify
deq_hduclasValue for HDUCLAS1 keyword
Returns
CPL_ERROR_NONE on success, otherwise an error code

Adds standard ESO Data Exchange Qualifier (DEQ) classification keywords: HDUCLASS, HDUDOC, HDUVERS, and HDUCLAS1 to the property list.

Note
This function is typically called internally by save functions.

Definition at line 248 of file eris_ifu_dfs.c.

References eris_check_error_code().

Referenced by eris_ifu_resample_save_cube(), eris_ifu_save_deq_cube(), eris_ifu_save_deq_image(), and eris_ifu_save_table().

◆ eris_ifu_heades_add_hduclass_data()

cpl_error_code eris_ifu_heades_add_hduclass_data ( cpl_propertylist *  plist)

Add data extension classification properties to FITS header.

Parameters
plistFITS header property list to modify
Returns
CPL_ERROR_NONE on success, otherwise an error code

Adds DEQ keywords specific to data extensions, including HDUCLAS2, EXTNAME, ERRDATA, and QUALDATA references.

Note
This function is typically called internally by save functions.

Definition at line 273 of file eris_ifu_dfs.c.

References eris_check_error_code().

Referenced by eris_ifu_resample_save_cube(), eris_ifu_save_deq_cube(), and eris_ifu_save_deq_image().

◆ eris_ifu_heades_add_hduclass_errs()

cpl_error_code eris_ifu_heades_add_hduclass_errs ( cpl_propertylist *  plist,
deqErrorType  errorType 
)

Add error extension classification properties to FITS header.

Parameters
plistFITS header property list to modify
errorTypeError type (MSE, RMSE, INVMSE, or INVRMSE)
Returns
CPL_ERROR_NONE on success, otherwise an error code

Adds DEQ keywords specific to error extensions, including HDUCLAS2, HDUCLAS3 (error type), EXTNAME, and references to SCIDATA and QUALDATA.

Note
This function is typically called internally by save functions.

Definition at line 297 of file eris_ifu_dfs.c.

References eris_check_error_code().

Referenced by eris_ifu_resample_save_cube(), eris_ifu_save_deq_cube(), and eris_ifu_save_deq_image().

◆ eris_ifu_heades_add_hduclass_qual()

cpl_error_code eris_ifu_heades_add_hduclass_qual ( cpl_propertylist *  plist,
deqQualityType  qualityType 
)

Add quality extension classification properties to FITS header.

Parameters
plistFITS header property list to modify
qualityTypeQuality type (MASKZERO, MASKONE, FLAG32BIT, or FLAG16BIT)
Returns
CPL_ERROR_NONE on success, otherwise an error code

Adds DEQ keywords specific to quality/bad pixel extensions, including HDUCLAS2, HDUCLAS3 (quality type), EXTNAME, and references to SCIDATA and ERRDATA.

Note
This function is typically called internally by save functions.

Definition at line 324 of file eris_ifu_dfs.c.

References eris_check_error_code().

Referenced by eris_ifu_resample_save_cube(), eris_ifu_save_deq_cube(), and eris_ifu_save_deq_image().

◆ eris_ifu_load_cal_image_file()

hdrl_image * eris_ifu_load_cal_image_file ( const char *  filename,
ifsBand  band,
ifsPreopticsScale  scale,
cpl_image **  qualImage,
deqQualityType *  qualType 
)

Load a calibration image from a filename.

Parameters
filenameInput FITS filename
bandExpected instrument band (or UNDEFINED_BAND to skip check)
scaleExpected pre-optics scale (or UNDEFINED_SCALE to skip check)
qualImageOutput quality image (pointer to pointer, can be NULL)
qualTypeOutput quality type detected (pointer, can be NULL)
Returns
HDRL image on success, or NULL on error

Loads a calibration image file and verifies that its band and scale match the expected values. Automatically handles both DEQ format (3 extensions) and old format (single image) files.

Note
For old format files, a simulated error image is created (10% of data absolute value).
PUPIL scale is always accepted regardless of the scale parameter.
The function checks number of extensions to determine format.

Definition at line 1399 of file eris_ifu_dfs.c.

References BRK_WITH_ERROR_MSG, CATCH, eris_check_error_code(), eris_ifu_free_image(), eris_ifu_free_propertylist(), eris_ifu_get_band(), eris_ifu_get_preopticsScale(), eris_ifu_load_deq_hdrl_image(), hdrl_image_create(), hdrl_image_delete(), and TRY.

Referenced by eris_ifu_load_cal_image_frame().

◆ eris_ifu_load_cal_image_frame()

hdrl_image * eris_ifu_load_cal_image_frame ( const cpl_frame *  frame,
ifsBand  band,
ifsPreopticsScale  scale,
cpl_image **  qualImage,
deqQualityType *  qualType 
)

Load a calibration image from a frame.

Parameters
frameInput frame
bandExpected instrument band (or UNDEFINED_BAND to skip check)
scaleExpected pre-optics scale (or UNDEFINED_SCALE to skip check)
qualImageOutput quality image (pointer to pointer, can be NULL)
qualTypeOutput quality type detected (pointer, can be NULL)
Returns
HDRL image on success, or NULL on error

Loads a calibration image frame and verifies that its band and scale match the expected values. Automatically handles both DEQ format (3 extensions) and old format (single image) files.

Note
For old format files, a simulated error image is created (10% of data).
PUPIL scale is always accepted regardless of the scale parameter.

Definition at line 1353 of file eris_ifu_dfs.c.

References CATCH, eris_check_error_code(), eris_ifu_load_cal_image_file(), hdrl_image_delete(), and TRY.

Referenced by eris_ifu_jitter_processSof().

◆ eris_ifu_load_deq_hdrl_image()

hdrl_image * eris_ifu_load_deq_hdrl_image ( const char *  filename,
cpl_propertylist **  primaryHeader,
cpl_image **  qualImage,
deqQualityType *  qualityType 
)

Load a DEQ-format file into an HDRL image structure.

Parameters
filenameInput FITS filename
primaryHeaderOutput primary header property list (pointer to pointer, can be NULL)
qualImageOutput quality image (pointer to pointer, can be NULL)
qualityTypeOutput quality type detected (pointer, can be NULL)
Returns
HDRL image structure on success, or NULL on error

Loads a DEQ-format FITS file and creates an HDRL image structure containing the data and error planes with proper bad pixel masking from the quality extension. The error type is automatically converted to RMSE format required by HDRL.

Note
The returned HDRL image must be freed by the caller using hdrl_image_delete().
MSE errors are converted to RMSE by taking square root.
INVMSE and INVRMSE error types are not supported.
Quality values of 0 indicate good pixels; other values indicate bad pixels.

Definition at line 1116 of file eris_ifu_dfs.c.

References BRK_WITH_ERROR_MSG, CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_load_deq_image(), hdrl_image_create(), hdrl_image_delete(), and TRY.

Referenced by eris_ifu_load_cal_image_file().

◆ eris_ifu_load_deq_hdrl_imagelist()

hdrl_imagelist * eris_ifu_load_deq_hdrl_imagelist ( const char *  filename,
cpl_propertylist **  primaryHeader,
cpl_imagelist **  qualImagelist,
deqQualityType *  qualityType 
)

Load a DEQ-format cube into an HDRL imagelist structure.

Parameters
filenameInput FITS filename
primaryHeaderOutput primary header property list (pointer to pointer, can be NULL)
qualImagelistOutput quality imagelist (pointer to pointer, can be NULL)
qualityTypeOutput quality type detected (pointer, can be NULL)
Returns
HDRL imagelist structure on success, or NULL on error

Loads a DEQ-format datacube FITS file and creates an HDRL imagelist structure with proper bad pixel masking. Each plane is processed individually to flag bad pixels from both the quality extension and NaN/Inf values in data or error.

Note
The returned HDRL imagelist must be freed by the caller using hdrl_imagelist_delete().
NaN and Inf values in data or error images are automatically flagged as bad.
All three imagelists must have the same size.

Definition at line 1218 of file eris_ifu_dfs.c.

References BRK_IF_ERROR, BRK_WITH_ERROR_MSG, CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_is_nan_or_inf(), eris_ifu_load_deq_imagelist(), hdrl_imagelist_create(), hdrl_imagelist_delete(), and TRY.

Referenced by eris_ifu_jitter_extract_spec_processSof().

◆ eris_ifu_load_deq_image()

cpl_error_code eris_ifu_load_deq_image ( const char *  filename,
cpl_propertylist **  primaryHeader,
cpl_image **  dataImage,
cpl_image **  errImage,
cpl_image **  qualImage,
deqErrorType *  errorType,
deqQualityType *  qualityType 
)

‍** Function to write a DFS compliant pipeline product with a badpixel map

Load a DEQ-format image with data, error, and quality extensions

Parameters
filenameInput FITS filename
primaryHeaderOutput primary header property list (pointer to pointer, can be NULL)
dataImageOutput data image (pointer to pointer)
errImageOutput error image (pointer to pointer, can be NULL)
qualImageOutput quality image (pointer to pointer, can be NULL)
errorTypeOutput error type detected (pointer, can be NULL)
qualityTypeOutput quality type detected (pointer, can be NULL)
Returns
CPL_ERROR_NONE on success, otherwise an error code

Loads a DEQ-format FITS file with separate data, error, and quality extensions. The file must have exactly 3 extensions. The error and quality types are determined from the HDUCLAS3 keyword in each extension.

Note
The data image is always loaded; error and quality images are optional.
All returned images must be freed by the caller using cpl_image_delete().
If primaryHeader is not NULL, it must be freed with cpl_propertylist_delete().

Definition at line 889 of file eris_ifu_dfs.c.

References BRK_WITH_ERROR_MSG, CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_free_propertylist(), and TRY.

Referenced by eris_ifu_load_deq_hdrl_image().

◆ eris_ifu_load_deq_imagelist()

cpl_error_code eris_ifu_load_deq_imagelist ( const char *  filename,
cpl_propertylist **  primaryHeader,
cpl_imagelist **  dataImagelist,
cpl_imagelist **  errImagelist,
cpl_imagelist **  qualImagelist,
deqErrorType *  errorType,
deqQualityType *  qualityType 
)

Load a DEQ-format imagelist (cube) with data, error, and quality extensions.

Parameters
filenameInput FITS filename
primaryHeaderOutput primary header property list (pointer to pointer, can be NULL)
dataImagelistOutput data imagelist (pointer to pointer)
errImagelistOutput error imagelist (pointer to pointer, can be NULL)
qualImagelistOutput quality imagelist (pointer to pointer, can be NULL)
errorTypeOutput error type detected (pointer, can be NULL)
qualityTypeOutput quality type detected (pointer, can be NULL)
Returns
CPL_ERROR_NONE on success, otherwise an error code

Loads a DEQ-format datacube FITS file with separate data, error, and quality imagelist extensions. The file must have exactly 3 extensions.

Note
All returned imagelists must be freed by the caller using cpl_imagelist_delete().
All three imagelists must have the same size.

Definition at line 1002 of file eris_ifu_dfs.c.

References BRK_WITH_ERROR_MSG, CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_free_propertylist(), and TRY.

Referenced by eris_ifu_load_deq_hdrl_imagelist().

◆ eris_ifu_load_distances()

cpl_vector * eris_ifu_load_distances ( const char *  filename)

Load slitlet distance vector from a table.

Parameters
filenameInput FITS table filename
Returns
Vector with slitlet distances, or NULL on error

Loads the "slitlet_distance" column from the first extension of the specified FITS table file. Supports both DOUBLE and FLOAT column types.

Note
The returned vector must be freed with cpl_vector_delete().

Definition at line 1606 of file eris_ifu_dfs.c.

References BRK_IF_ERROR, CATCH, eris_check_error_code(), eris_ifu_free_table(), SET_ERROR, and TRY.

Referenced by eris_ifu_jitter_processSof().

◆ eris_ifu_load_distortion_polynomials()

cpl_error_code eris_ifu_load_distortion_polynomials ( const char *  filename,
cpl_polynomial ***  polynomials,
cpl_table **  borders 
)

Load distortion polynomials and slitlet borders from a table.

Parameters
filenameInput FITS table filename
polynomialsOutput array of polynomials (one per slitlet, pointer to pointer)
bordersOutput table with slitlet border positions (pointer to pointer)
Returns
CPL_ERROR_NONE on success, otherwise an error code

Loads distortion correction polynomials for all slitlets. The file must contain SLITLET_CNT+1 extensions: one extension per slitlet with polynomial coefficients, plus a final extension with border positions.

Note
The polynomial array must be freed by calling cpl_polynomial_delete() on each element, then freeing the array itself.
The borders table must be freed with cpl_table_delete().

Definition at line 1536 of file eris_ifu_dfs.c.

References CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_free_table(), and TRY.

Referenced by eris_ifu_jitter_processSof().

◆ eris_ifu_load_distortion_polynomials_old()

cpl_error_code eris_ifu_load_distortion_polynomials_old ( const char *  filename,
cpl_polynomial **  poly_u,
cpl_polynomial **  poly_v 
)

Load old-format distortion polynomials from a table.

Parameters
filenameInput FITS table filename
poly_uOutput polynomial for u direction (pointer to pointer)
poly_vOutput polynomial for v direction (pointer to pointer)
Returns
CPL_ERROR_NONE on success, otherwise an error code

Loads distortion correction polynomials from an old-format table with columns "degx", "degy", and "coeff". The v-direction polynomial is set to a simple identity (coefficient 1.0 for y^1 term).

Note
This is for backward compatibility with old SINFONI format.
The returned polynomials must be freed with cpl_polynomial_delete().

Definition at line 1477 of file eris_ifu_dfs.c.

References CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_free_table(), and TRY.

Referenced by eris_ifu_jitter_processSof().

◆ eris_ifu_load_slit_positions()

cpl_bivector * eris_ifu_load_slit_positions ( const char *  filename)

Load slitlet position bivector from a table.

Parameters
filenameInput FITS table filename
Returns
Bivector with slitlet positions (x=left edge, y=right edge), or NULL on error

Loads slitlet edge positions from a table. Supports both new format (edge_left/edge_right columns) and old SINFONI format (pos1/pos2 columns).

Note
The returned bivector must be freed with cpl_bivector_delete().

Definition at line 1659 of file eris_ifu_dfs.c.

References CATCH, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_free_table(), RECOVER, and TRY.

Referenced by eris_ifu_jitter_processSof().

◆ eris_ifu_save_deq_cube()

cpl_error_code eris_ifu_save_deq_cube ( cpl_frameset *  allframes,
cpl_propertylist *  header,
const cpl_parameterlist *  parlist,
const cpl_frameset *  usedframes,
const cpl_frame *  inherit,
const char *  recipe,
cpl_propertylist *  applist,
const char *  remregexp,
const char *  filename,
cpl_imagelist *  data,
cpl_imagelist *  error,
deqErrorType  errorType,
const cpl_imagelist *  dataQualityMask,
deqQualityType  qualityType 
)

Save a DFS-compliant cube product with data, error, and quality extensions.

Parameters
allframesList of all input frames for the recipe
headerNULL or property list with additional properties for product header
parlistList of recipe input parameters
usedframesList of raw/calibration frames used for this product
inheritNULL or frame from which product inherits header keywords
recipeRecipe name
applistProperty list to append to primary header (must contain PRO.CATG)
remregexpNULL or regexp of properties not to put in main header
filenameOutput filename for created product
dataData cube (imagelist) to save
errorError cube (imagelist)
errorTypeError type: MSE, RMSE, INVMSE, or INVRMSE
dataQualityMaskData quality cube (imagelist)
qualityTypeQuality type: MASKZERO, MASKONE, FLAG32BIT, or FLAG16BIT
Returns
CPL_ERROR_NONE on success, otherwise an error code

Creates a DFS-compliant 3D datacube FITS file with:

  • Primary HDU: Empty with pipeline provenance keywords
  • Extension 1: Data cube with WCS
  • Extension 2: Error cube
  • Extension 3: Quality/bad pixel cube
Note
The PRODCATG keyword is automatically set based on filename (sky vs object).
Quality extension is saved as CPL_TYPE_INT regardless of input type.

Definition at line 516 of file eris_ifu_dfs.c.

References CATCH, eris_check_error_code(), eris_ifu_heades_add_hduclass_common(), eris_ifu_heades_add_hduclass_data(), eris_ifu_heades_add_hduclass_errs(), eris_ifu_heades_add_hduclass_qual(), and TRY.

◆ eris_ifu_save_deq_image()

cpl_error_code eris_ifu_save_deq_image ( cpl_frameset *  allframes,
cpl_propertylist *  header,
const cpl_parameterlist *  parlist,
const cpl_frameset *  usedframes,
const cpl_frame *  inherit,
const char *  recipe,
const cpl_propertylist *  applist,
const char *  remregexp,
const char *  filename,
const cpl_image *  image,
const cpl_image *  error,
deqErrorType  errorType,
const cpl_image *  dataQualityMask,
deqQualityType  dataQualityType,
const char *  unit 
)

Save a DFS-compliant image product with data, error, and quality extensions.

Parameters
allframesList of all input frames for the recipe
headerNULL or property list with additional properties for product header
parlistList of recipe input parameters
usedframesList of raw/calibration frames used for this product
inheritNULL or frame from which product inherits header keywords
recipeRecipe name
applistProperty list to append to primary header (must contain PRO.CATG)
remregexpNULL or regexp of properties not to put in main header
filenameOutput filename for created product
imageData image to save (required)
errorError image (optional, can be NULL)
errorTypeError type: MSE, RMSE, INVMSE, or INVRMSE
dataQualityMaskData quality/bad pixel image (optional, can be NULL)
dataQualityTypeQuality type: MASKZERO, MASKONE, FLAG32BIT, or FLAG16BIT
unitPhysical unit string for BUNIT keyword
Returns
CPL_ERROR_NONE on success, otherwise an error code

Creates a DFS-compliant FITS file according to VLT-SPE-ESO-19500-5667 with:

  • Primary HDU: Empty with pipeline provenance keywords
  • Extension 1: Data image with WCS
  • Extension 2: Error image (if provided)
  • Extension 3: Quality/bad pixel map (if provided)
Note
WCS keywords are removed from the primary header and added only to extensions.
All extensions contain proper DEQ classification keywords.

Definition at line 367 of file eris_ifu_dfs.c.

References CATCH, eris_check_error_code(), eris_ifu_free_propertylist(), eris_ifu_free_string(), eris_ifu_heades_add_hduclass_common(), eris_ifu_heades_add_hduclass_data(), eris_ifu_heades_add_hduclass_errs(), eris_ifu_heades_add_hduclass_qual(), and TRY.

Referenced by eris_ifu_combine_pbp(), eris_ifu_cube_collapse_mean_and_save(), and eris_ifu_jitter_extract().

◆ eris_ifu_save_image_phase3()

cpl_error_code eris_ifu_save_image_phase3 ( cpl_frameset *  allframes,
const cpl_parameterlist *  parlist,
const cpl_frameset *  usedframes,
const char *  recipe,
const cpl_propertylist *  applist,
const char *  remregexp,
const char *  filename,
const cpl_image *  image,
cpl_type  type,
const char *  unit 
)

Save a DFS-compliant Phase 3 image product.

Parameters
allframesList of all input frames for the recipe
parlistList of recipe input parameters
usedframesList of raw/calibration frames used for this product
recipeRecipe name
applistProperty list to append to primary header (must contain PRO.CATG)
remregexpNULL or regexp of properties not to put in main header
filenameOutput filename for created product
imageData image to save (required)
typeCPL data type for saving the image
unitPhysical unit string for BUNIT keyword
Returns
CPL_ERROR_NONE on success, otherwise an error code

Creates a Phase 3 compliant FITS file with the image in the primary HDU (not as an extension). This format is used for certain simple products.

Note
The image is saved directly in the primary HDU, not as an extension.
The BUNIT keyword is added to specify the physical unit.

Definition at line 666 of file eris_ifu_dfs.c.

References CATCH, eris_check_error_code(), eris_ifu_free_propertylist(), eris_ifu_free_string(), and TRY.

Referenced by eris_ifu_combine_pbp(), and eris_ifu_cube_collapse_mean_and_save().

◆ eris_ifu_save_table()

cpl_error_code eris_ifu_save_table ( cpl_frameset *  allframes,
cpl_propertylist *  header,
const cpl_parameterlist *  parlist,
const cpl_frameset *  usedframes,
const cpl_frame *  inherit,
const char *  recipe,
const char *  procatg,
cpl_propertylist *  applist,
const char *  remregexp,
const char *  filename,
const cpl_table *  table 
)

Save a DFS-compliant table product.

Parameters
allframesList of all input frames for the recipe
headerNULL or property list with additional properties for product header
parlistList of recipe input parameters
usedframesList of raw/calibration frames used for this product
inheritNULL or frame from which product inherits header keywords
recipeRecipe name
procatgOutput product category string
applistProperty list to append to primary header
remregexpNULL or regexp of properties not to put in main header
filenameOutput filename for created product
tableData table to save
Returns
CPL_ERROR_NONE on success, otherwise an error code

Creates a DFS-compliant FITS file with:

  • Primary HDU: Empty with pipeline provenance keywords
  • Extension 1: Binary table with DEQ classification
Note
The table is saved in a binary table extension, not ASCII.
The PRO.CATG keyword is set to the provided procatg value.

Definition at line 745 of file eris_ifu_dfs.c.

References CATCH, CATCH_MSGS, eris_check_error_code(), eris_ifu_free_propertylist(), eris_ifu_free_string(), eris_ifu_heades_add_hduclass_common(), and TRY.

◆ eris_ifu_set_qc_int()

cpl_error_code eris_ifu_set_qc_int ( cpl_propertylist *  pl,
const char *  name,
int  val,
const char *  comment 
)

Set (or update) a QC parameter of type INT in a property list.

Parameters
plProperty list
nameQC parameter name (without "ESO QC " prefix)
valQC parameter integer value
commentComment string to attach
Returns
CPL_ERROR_NONE on success, otherwise an error code

Sets or updates a quality control parameter with automatic "ESO QC " prefix. If the parameter already exists, its value is updated.

Note
The "ESO QC " prefix is automatically added to the name.

Definition at line 1857 of file eris_ifu_dfs.c.

References CATCH, eris_check_error_code(), eris_ifu_free_string(), and TRY.

◆ eris_ifu_tag_is_cdb()

cpl_boolean eris_ifu_tag_is_cdb ( char *  tag)

check if input frame tag is a static of master calibration

Parameters
taginput tag
Returns
CPL_TRUE if true, CPL_FALSE otherwise

Definition at line 2501 of file eris_ifu_dfs.c.

Referenced by eris_ifu_extract_mst_frames().

◆ eris_ifu_tag_is_obj()

cpl_boolean eris_ifu_tag_is_obj ( const char *  tag)

Add PRO* keywords to a SINFONI FITS header.

Parameters
taginput tag
Returns
CPL_TRUE if true, CPL_FALSE otherwise

Definition at line 2553 of file eris_ifu_dfs.c.

Referenced by eris_ifu_extract_obj_frames().

◆ eris_ifu_tag_is_sky()

cpl_boolean eris_ifu_tag_is_sky ( const char *  tag)

check if input frame tag is a static of master calibration

Parameters
taginput tag
Returns
CPL_TRUE if true, CPL_FALSE otherwise

Definition at line 2526 of file eris_ifu_dfs.c.

Referenced by eris_ifu_extract_sky_frames().