ERIS Pipeline Reference Manual 1.9.2
Modules | Functions
IFU Miscellaneous Utilities

Modules

 IFU Error Macros
 

Functions

cpl_vector * eris_ifu_idl_where (const cpl_vector *data, double val, int op)
 Implements the where-function known from IDL.
 
cpl_vector * eris_ifu_idl_values_at_indices (const cpl_vector *data, const cpl_vector *indices)
 Returns a vector of given indices.
 
cpl_error_code eris_ifu_cut_endings (cpl_vector **vec, int *begin, int *end, int cut)
 Cut leading and trailing -1 of a vector.
 
hdrl_imagelist * eris_ifu_get_hdrlimagelist_by_tag (cpl_frameset *frameset, const char *tag, int exposureCorrectionMode)
 Return HDRL imagelist by searching tagged frames in frameset.
 
cpl_frameset * eris_ifu_get_frameset_by_tag (const cpl_frameset *frameset, const char *tag)
 Get frames with given tag from frameset.
 
cpl_error_code eris_ifu_parameterlist_append_list (cpl_parameterlist *p1, const cpl_parameterlist *p2)
 Append a parameterlist to another one.
 
void eris_ifu_free_hdrl_image (hdrl_image **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_hdrl_imagelist (hdrl_imagelist **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_image (cpl_image **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_imagelist (cpl_imagelist **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_mask (cpl_mask **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_matrix (cpl_matrix **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_propertylist (cpl_propertylist **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_vector (cpl_vector **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_ifu_vector (eris_ifu_vector **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_string (char **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_frameset (cpl_frameset **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_frame (cpl_frame **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_hdrl_parameter (hdrl_parameter **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_parameter (cpl_parameter **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_parameterlist (cpl_parameterlist **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_table (cpl_table **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_double_array (double **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_float_array (float **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_int_array (int **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_polynomial (cpl_polynomial **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_bivector (cpl_bivector **item)
 Free memory and set pointer to null.
 
void eris_ifu_free_apertures (cpl_apertures **item)
 Free memory and set pointer to null.
 
cpl_error_code eris_ifu_save_image (cpl_frameset *fs, const cpl_propertylist *plist, const cpl_parameterlist *parlist, const char *recipe, const char *procatg, const char *filename, cpl_type type, const cpl_image *image)
 Save image with DFS compliance.
 
cpl_error_code eris_ifu_save_imagelist (cpl_frameset *fs, cpl_frame *inherit, const cpl_propertylist *plist, const cpl_parameterlist *parlist, const char *recipe, const char *procatg, const char *filename, cpl_type type, const cpl_imagelist *imglist)
 Save imagelist with DFS compliance.
 
cpl_error_code eris_ifu_hdrl_image_reject_mask (hdrl_image *img, const cpl_mask *mask)
 Add mask to HDRL image (reject masked pixels)
 
cpl_error_code eris_ifu_save_vector_dbg (const cpl_vector *vec, const char *filename, int create, const cpl_propertylist *pl)
 Save vector for debugging (quick, no DFS overhead)
 
cpl_error_code eris_ifu_save_ifu_vector_dbg (const eris_ifu_vector *vec, const char *filename, int create)
 Save eris_ifu_vector for debugging (quick, no DFS overhead)
 
cpl_error_code eris_ifu_save_bivector_dbg (const cpl_bivector *bivec, const char *filename, int col, int create)
 Save bivector for debugging (as vector or table)
 
cpl_error_code eris_ifu_save_image_dbg (const cpl_image *img, const char *filename, int create, const cpl_propertylist *pl)
 Save image for debugging (quick, no DFS overhead)
 
cpl_error_code eris_ifu_save_table_dbg (const cpl_table *tbl, const char *filename, int create)
 Save table for debugging (quick, no DFS overhead)
 
cpl_error_code eris_ifu_save_mask_dbg (const cpl_mask *mask, const char *filename, int create, const cpl_propertylist *pl)
 Save mask for debugging (quick, no DFS overhead)
 
cpl_error_code eris_ifu_save_imagelist_dbg (const cpl_imagelist *imglist, const char *filename, int create)
 Save CPL imagelist for debugging (quick, no DFS overhead)
 
cpl_error_code eris_ifu_save_cpl_image_dbg (const cpl_image *img, const char *name, int singlefile, const cpl_propertylist *pl)
 Save CPL image with mask for debugging.
 
cpl_error_code eris_ifu_save_cpl_imagelist_dbg (const cpl_imagelist *imglist, const char *name)
 Save CPL imagelist for debugging.
 
cpl_error_code eris_ifu_save_hdrl_image_dbg (const hdrl_image *hdrl_img, const char *filename, int singlefile, const cpl_propertylist *pl)
 Save HDRL image for debugging (data + error + mask)
 
cpl_error_code eris_ifu_save_hdrl_imagelist_dbg (const hdrl_imagelist *hdrl_img_list, const char *filename, int singlefile)
 Save HDRL imagelist for debugging (data + error + mask planes)
 
cpl_mask * eris_ifu_load_badpixel_mask (const cpl_frameset *frameset, const char *category, int ext)
 ‍**
 
cpl_error_code eris_ifu_file_exists (const char *filename)
 ‍**
 
cpl_imagelist * eris_ifu_hdrl_get_imagelist (const hdrl_imagelist *hdrl_imglist, enum hdrl_t type)
 Extract from an HDRL imagelist a specific CPL imagelist.
 
char * eris_ifu_get_lampString (int lampStatus)
 Convert lamp status bitmask to string.
 
const char * eris_ifu_get_bandString (ifsBand band)
 Convert band enum to string.
 
double eris_ifu_get_band_resolution (ifsBand band)
 Get nominal spectral resolution for a given band.
 
cpl_error_code eris_ifu_get_plane_cut_min_max (ifsBand band, cpl_size *zmin, cpl_size *zmax)
 Get band-specific plane indices for NaN trimming.
 
cpl_error_code eris_ifu_cube_set_values (hdrl_imagelist **iml)
 Set specific pixel values in HDRL imagelist (debugging utility)
 
cpl_error_code eris_ifu_cube_trim_nans (const cpl_size zmin, const cpl_size zmax, hdrl_imagelist **iml, cpl_imagelist **bpm, cpl_propertylist *header)
 Trim NaN-dominated planes from cube edges.
 
const char * eris_ifu_get_instrumentString (ifsInstrument instrument)
 Convert instrument enum to string.
 
const char * eris_ifu_get_preopticsScaleString (ifsPreopticsScale scale)
 Convert pre-optics scale enum to string.
 
cpl_image * eris_ifu_image_create_window (const cpl_image *img)
 Create sub-image by removing bad pixel border.
 
cpl_mask * eris_ifu_mask_create_border (const cpl_mask *mask)
 Add bad pixel border around mask.
 
cpl_error_code eris_ifu_mask_nans_in_hdrlimage (hdrl_image **hima)
 Flag NaNs in HDRL image.
 
cpl_error_code eris_ifu_mask_nans_in_cube (cpl_imagelist *cube)
 Mask NaNs and Infs in CPL imagelist (cube)
 
cpl_mask * eris_ifu_quality2bp_mask (const cpl_image *qualityMask, deqQualityType qualityType)
 transform input image (quality mask) to output mask with given bit code
 
cpl_imagelist * eris_ifu_interpolatedMask_to_maskZero (cpl_imagelist *bpmCube, double threshold)
 return cube flagging (as 1) pixels above a given threshold
 
cpl_error_code eris_ifu_split_hdrl_imagelist (hdrl_imagelist *cube, cpl_imagelist *dataCube, cpl_imagelist *errorCube)
 extract from hdrl_imagelist the data and error information
 
cpl_error_code eris_ifu_split3_hdrl_imagelist (hdrl_imagelist *cube, cpl_imagelist *dataCube, cpl_imagelist *errorCube, cpl_imagelist *qualCube)
 extract from hdrl_imagelist the data and error information
 
cpl_table * eris_qclog_init (void)
 Initialize QC table.
 
cpl_error_code eris_qclog_add_int (cpl_table *table, const char *key_name, const int value, const char *key_help)
 add QC int info to table
 
cpl_error_code eris_qclog_add_bool (cpl_table *table, const char *key_name, const char *key_help)
 add QC boolean info to table
 
cpl_error_code eris_qclog_add_double (cpl_table *table, const char *key_name, const double value, const char *key_help)
 add QC double info to table
 
cpl_error_code eris_qclog_add_double_f (cpl_table *table, const char *key_name, const double value, const char *key_help)
 add QC float info to table
 
cpl_error_code eris_qclog_add_double_format (cpl_table *table, const char *key_name, const double value, const char *key_help)
 add QC double (with format) info to table
 
cpl_error_code eris_qclog_add_string (cpl_table *table, const char *key_name, const char *value, const char *key_help)
 add QC string info to table
 
cpl_error_code eris_pfits_put_qc (cpl_propertylist *plist, cpl_table *qclog)
 convert table with QC parameter information to a propertylist
 
cpl_error_code eris_ifu_get_badpix_qc_from_ima (const cpl_image *image, cpl_propertylist *qc_list, const char *prefix)
 compute QC keyword with number of bad pixels and fraction to total
 
cpl_error_code eris_ifu_get_badpix_qc_from_mask (const cpl_mask *bp_mask, cpl_propertylist *qc_list, const char *prefix)
 compute QC keyword with number of bad pixels and fraction to total
 
cpl_propertylist * eris_compute_psf_qc (hdrl_image *hima, const cpl_parameterlist *parlist, const char *context)
 compute QC parameters on a PSF STD image
 
cpl_mask * eris_ifu_hima_get_obj_mask_percent (hdrl_image *hima, const double percent)
 find mask flagging pixels above percent(%) pixels with lower intensity
 
cpl_mask * eris_ifu_hima_get_obj_mask (hdrl_image *hima, const cpl_size niter, const double kappa)
 find mask flagging pixels above a threshold set by ks-clip algorithm
 
cpl_error_code eris_get_pupil_shift (hdrl_imagelist *iml, const int n, cpl_table **qclog_tbl)
 Get what object shift.
 
cpl_mask * eris_ifu_mask_from_image (const cpl_image *img_mask)
 eris_ifu_mask_from_image
 

Detailed Description

This module provides a comprehensive collection of utility functions for ERIS IFU data processing, organized into several categories:

Vector and Array Operations

Memory Management (Safe Free Functions)

Frame and Imagelist Operations

I/O Operations

Production I/O:

Debug I/O:

Image/Mask Processing

PSF and Object Detection

QC Parameter Management

Instrument/Configuration Utilities

HDRL Integration

Note
This module is a "catch-all" for functions that don't fit cleanly into more specialized modules
All free_* functions are null-safe and set pointers to NULL after freeing
Debug save functions bypass DFS checks for faster iteration

Function Documentation

◆ eris_compute_psf_qc()

cpl_propertylist * eris_compute_psf_qc ( hdrl_image *  hima,
const cpl_parameterlist *  parlist,
const char *  context 
)

compute QC parameters on a PSF STD image

Parameters
himainput image
parlistinput parameters
contextparameter context (prefix+recipe name)
Returns
propertylist with computed QC parameters

Definition at line 3274 of file eris_ifu_utils.c.

References eris_check_error_code(), eris_ifu_is_nan_or_inf(), eris_parameters_get_double(), eris_pfits_put_qc(), eris_qclog_add_double(), eris_qclog_add_double_f(), eris_qclog_add_int(), eris_qclog_init(), hdrl_image_get_image(), hdrl_image_get_size_x(), and hdrl_image_get_size_y().

Referenced by eris_ifu_jitter_extract().

◆ eris_get_pupil_shift()

cpl_error_code eris_get_pupil_shift ( hdrl_imagelist *  iml,
const int  n,
cpl_table **  qclog_tbl 
)

Get what object shift.

Parameters
imlimagelist
nimagelist sequence
qclog_tblqclog table
Returns
0 if standard 0 if pixel scale changes in input Strehl data

Definition at line 3603 of file eris_ifu_utils.c.

References eris_check_error_code(), eris_qclog_add_double_f(), hdrl_image_delete(), hdrl_image_get_image(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), and hdrl_imagelist_collapse_median().

Referenced by eris_stdstar_reduction_common().

◆ eris_ifu_cube_set_values()

cpl_error_code eris_ifu_cube_set_values ( hdrl_imagelist **  iml)

Set specific pixel values in HDRL imagelist (debugging utility)

Parameters
imlHDRL imagelist to modify (modified in-place)
Returns
cpl_error_code

Development/debugging function that sets pixels [10:20, 10:20] in each plane to plane_index * 10.

Note
This appears to be a debugging leftover - purpose unclear
Modifies the imagelist in-place

Definition at line 1953 of file eris_ifu_utils.c.

References eris_check_error_code(), hdrl_image_set_pixel(), hdrl_imagelist_get(), and hdrl_imagelist_get_size().

◆ eris_ifu_cube_trim_nans()

cpl_error_code eris_ifu_cube_trim_nans ( const cpl_size  zmin,
const cpl_size  zmax,
hdrl_imagelist **  iml,
cpl_imagelist **  bpm,
cpl_propertylist *  header 
)

Trim NaN-dominated planes from cube edges.

Parameters
zminPlanes in range [0,zmin) are removed
zmaxPlanes in range (zmax,size-1] are removed
imlHDRL imagelist (modified in-place)
bpmBad pixel map imagelist (modified in-place)
headerFITS header (CRVAL3, NAXIS3 updated)
Returns
cpl_error_code

Removes spectral planes from both ends of a cube that are dominated by NaNs. Updates WCS keywords (CRVAL3, NAXIS3) to reflect the new spectral range.

Processing:

  1. Remove planes [zmax+1, end] from top
  2. Remove planes [0, zmin-1] from bottom
  3. Update CRVAL3: CRVAL3_new = CRVAL3_old + CD3_3 * zmin
  4. Update NAXIS3: NAXIS3_new = zmax - zmin + 1
Note
Both iml and bpm are modified in-place
Planes are 0-indexed: [0, zmin-1] and [zmax+1, size-1] are removed

Definition at line 2001 of file eris_ifu_utils.c.

References eris_check_error_code(), hdrl_imagelist_get_size(), and hdrl_imagelist_unset().

Referenced by eris_ifu_jitter_process_exposures().

◆ eris_ifu_cut_endings()

cpl_error_code eris_ifu_cut_endings ( cpl_vector **  vec,
int *  begin,
int *  end,
int  cut 
)

Cut leading and trailing -1 of a vector.

Parameters
vec(Input) Vector to trim. (Output) Trimmed vector, if cut is TRUE.
beginNULL or variable to hold determined beginning position (zero based). Set to zero in case of error.
endNULL or variable to hold determined ending position (zero based). Set to zero in case of error.
cutTRUE if vec should be trimmed, FALSE if just the start and end positions should be determined. Setting begin and end to NULL and cut to FALSE is senseless.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.

This function only cuts -1. Other negative numbers are classified as ok.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if vec is NULL.

Definition at line 297 of file eris_ifu_utils.c.

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

Referenced by eris_ifu_idl_where().

◆ eris_ifu_file_exists()

cpl_error_code eris_ifu_file_exists ( const char *  filename)

‍**

Check if file exists

Parameters
filenameName of the file to look up.
Returns
CPL_ERROR_NONE if file exists, error code otherwise

Simple file existence check using fopen(). Does not validate FITS format.

Note
This is a lightweight check, not a full FITS validation

Definition at line 1668 of file eris_ifu_utils.c.

References CATCH, eris_check_error_code(), and TRY.

Referenced by eris_ifu_detlin_load_frames(), eris_ifu_frame_is_on(), eris_ifu_frame_is_sky(), and eris_ifu_get_hdrlimagelist_by_tag().

◆ eris_ifu_free_apertures()

void eris_ifu_free_apertures ( cpl_apertures **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_apertures pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 840 of file eris_ifu_utils.c.

◆ eris_ifu_free_bivector()

void eris_ifu_free_bivector ( cpl_bivector **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_bivector pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 826 of file eris_ifu_utils.c.

Referenced by eris_ifu_dist_wave(), eris_ifu_jitter_extract(), and eris_ifu_wave_get_calImg().

◆ eris_ifu_free_double_array()

void eris_ifu_free_double_array ( double **  item)

Free memory and set pointer to null.

Parameters
itemPointer to double array pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers
Uses cpl_free internally

Definition at line 768 of file eris_ifu_utils.c.

Referenced by eris_ifu_1d_interpolation(), and eris_ifu_wave_resampled_arc_image().

◆ eris_ifu_free_float_array()

void eris_ifu_free_float_array ( float **  item)

Free memory and set pointer to null.

Parameters
itemPointer to float array pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers
Uses cpl_free internally

Definition at line 783 of file eris_ifu_utils.c.

◆ eris_ifu_free_frame()

void eris_ifu_free_frame ( cpl_frame **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_frame pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 697 of file eris_ifu_utils.c.

◆ eris_ifu_free_frameset()

void eris_ifu_free_frameset ( cpl_frameset **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_frameset pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 683 of file eris_ifu_utils.c.

Referenced by eris_ifu_get_hdrlimagelist_by_tag().

◆ eris_ifu_free_hdrl_image()

void eris_ifu_free_hdrl_image ( hdrl_image **  item)

Free memory and set pointer to null.

Parameters
itemPointer to hdrl_image pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 542 of file eris_ifu_utils.c.

References hdrl_image_delete().

Referenced by eris_ifu_dark_qc(), eris_ifu_dark_static(), eris_ifu_jitter_build_cube(), eris_ifu_jitter_extract(), eris_ifu_jitter_process_exposures(), eris_ifu_load_exposure_file(), eris_ifu_warp_polynomial_image(), and eris_ifu_wave_collapse_arc_images().

◆ eris_ifu_free_hdrl_imagelist()

void eris_ifu_free_hdrl_imagelist ( hdrl_imagelist **  item)

Free memory and set pointer to null.

Parameters
itemPointer to hdrl_imagelist pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 556 of file eris_ifu_utils.c.

References hdrl_imagelist_delete().

Referenced by eris_ifu_detlin_load_frames(), eris_ifu_dist_wave(), eris_ifu_get_hdrlimagelist_by_tag(), eris_ifu_jitter_process_exposures(), and eris_ifu_wave_collapse_arc_images().

◆ eris_ifu_free_hdrl_parameter()

void eris_ifu_free_hdrl_parameter ( hdrl_parameter **  item)

Free memory and set pointer to null.

Parameters
itemPointer to hdrl_parameter pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 711 of file eris_ifu_utils.c.

References hdrl_parameter_delete().

Referenced by eris_ifu_add_std_params(), eris_ifu_calc_bpm(), eris_ifu_detlin_compute_linearity(), eris_parlist_config_add_bpm(), and eris_parlist_config_add_flat().

◆ eris_ifu_free_ifu_vector()

void eris_ifu_free_ifu_vector ( eris_ifu_vector **  item)

Free memory and set pointer to null.

Parameters
itemPointer to eris_ifu_vector pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 654 of file eris_ifu_utils.c.

References eris_ifu_vector_delete().

Referenced by eris_ifu_dist_calc_centers_fit(), eris_ifu_dist_calc_centers_profile(), and eris_ifu_dist_calc_distortion().

◆ eris_ifu_free_image()

void eris_ifu_free_image ( cpl_image **  item)

◆ eris_ifu_free_imagelist()

void eris_ifu_free_imagelist ( cpl_imagelist **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_imagelist pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 584 of file eris_ifu_utils.c.

Referenced by eris_ifu_calc_bpm(), eris_ifu_hdrl_get_imagelist(), eris_ifu_jitter_process_cubes(), eris_ifu_jitter_reconstruct_cube(), and eris_ifu_save_hdrl_imagelist_dbg().

◆ eris_ifu_free_int_array()

void eris_ifu_free_int_array ( int **  item)

Free memory and set pointer to null.

Parameters
itemPointer to int array pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers
Uses cpl_free internally

Definition at line 798 of file eris_ifu_utils.c.

Referenced by eris_ifu_lcorr_get_peak_lambdas().

◆ eris_ifu_free_mask()

void eris_ifu_free_mask ( cpl_mask **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_mask pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 598 of file eris_ifu_utils.c.

Referenced by eris_ifu_calc_bpm(), eris_ifu_combine_read_image_planes(), eris_ifu_dark_static(), eris_ifu_detect_crh(), eris_ifu_detlin_filter_mask(), eris_ifu_jitter_process_cubes(), eris_ifu_jitter_subtract_background(), eris_ifu_load_badpixel_mask(), eris_ifu_mask_create_border(), and eris_ifu_mask_from_image().

◆ eris_ifu_free_matrix()

void eris_ifu_free_matrix ( cpl_matrix **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_matrix pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 612 of file eris_ifu_utils.c.

◆ eris_ifu_free_parameter()

void eris_ifu_free_parameter ( cpl_parameter **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_parameter pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 725 of file eris_ifu_utils.c.

Referenced by eris_ifu_add_std_params(), eris_ifu_fetch_std_param(), eris_parlist_config_add_all_recipes(), and eris_parlist_config_add_bpm().

◆ eris_ifu_free_parameterlist()

void eris_ifu_free_parameterlist ( cpl_parameterlist **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_parameterlist pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 739 of file eris_ifu_utils.c.

Referenced by eris_ifu_add_std_params(), eris_ifu_jitter_process_cubes(), eris_parlist_config_add_bpm(), and eris_parlist_config_add_flat().

◆ eris_ifu_free_polynomial()

void eris_ifu_free_polynomial ( cpl_polynomial **  item)

Free memory and set pointer to null.

Parameters
itemPointer to cpl_polynomial pointer
Returns
void
Note
Safe to call with NULL or already-freed pointers

Definition at line 812 of file eris_ifu_utils.c.

Referenced by eris_ifu_dist_wave(), eris_ifu_jitter_process_exposures(), eris_ifu_wave_get_calImg(), and eris_ifu_wave_smooth_coeffs().

◆ eris_ifu_free_propertylist()

void eris_ifu_free_propertylist ( cpl_propertylist **  item)

◆ eris_ifu_free_string()

void eris_ifu_free_string ( char **  item)

◆ eris_ifu_free_table()

void eris_ifu_free_table ( cpl_table **  item)

◆ eris_ifu_free_vector()

void eris_ifu_free_vector ( cpl_vector **  item)

◆ eris_ifu_get_badpix_qc_from_ima()

cpl_error_code eris_ifu_get_badpix_qc_from_ima ( const cpl_image *  image,
cpl_propertylist *  qc_list,
const char *  prefix 
)

compute QC keyword with number of bad pixels and fraction to total

Parameters
imageinput image (a bad pixel map, intensity [0,1]
qc_listoutput property list to add QC keywords
prefixprefix of QC keyword
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2961 of file eris_ifu_utils.c.

References eris_check_error_code(), eris_ifu_append_qc_double(), and eris_ifu_append_qc_int().

Referenced by eris_ifu_detlin_compute_linearity().

◆ eris_ifu_get_badpix_qc_from_mask()

cpl_error_code eris_ifu_get_badpix_qc_from_mask ( const cpl_mask *  bp_mask,
cpl_propertylist *  qc_list,
const char *  prefix 
)

compute QC keyword with number of bad pixels and fraction to total

Parameters
bp_maskinput bad pixel mask
qc_listoutput property list to add QC keywords
prefixprefix of QC keyword
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 3006 of file eris_ifu_utils.c.

References eris_check_error_code(), eris_ifu_append_qc_double(), and eris_ifu_append_qc_int().

◆ eris_ifu_get_band_resolution()

double eris_ifu_get_band_resolution ( ifsBand  band)

Get nominal spectral resolution for a given band.

Parameters
bandBand enumeration
Returns
Nominal resolution (R = λ/Δλ)

Returns the nominal spectral resolution for each ERIS IFU band.

Example values:

  • J_LOW, J_SPIFFI: R ~ 5000
  • J_SHORT, J_MIDDLE, J_LONG: R ~ 10000
  • HK_SPIFFI: R ~ 3000
Note
Returns 0 for UNDEFINED_BAND or unrecognized bands

Definition at line 1867 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_ifu_lcorr_crosscorrelate_spectra(), and eris_ifu_sdp_properties_collect().

◆ eris_ifu_get_bandString()

const char * eris_ifu_get_bandString ( ifsBand  band)

Convert band enum to string.

Parameters
bandBand enumeration
Returns
Band name as string (e.g., "J_LOW", "H_MIDDLE", "K_SPIFFI")

Converts ifsBand enumeration to human-readable string.

Note
Returned string is a static const char* (do not free)
Returns "Unknown" for unrecognized bands

Definition at line 1790 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_ifu_distortion_reduce_lines(), eris_ifu_jitter_processSof(), eris_ifu_read_wave_setup(), eris_ifu_wave_get_firstFitTable(), eris_ifu_wave_save_fitting_tables(), eris_ifu_wave_save_spectrum(), and eris_stdstar_reduction_common().

◆ eris_ifu_get_frameset_by_tag()

cpl_frameset * eris_ifu_get_frameset_by_tag ( const cpl_frameset *  frameset,
const char *  tag 
)

Get frames with given tag from frameset.

Parameters
framesetframe set
tagto search for
Returns
newly allocated, possibly empty, frameset, or NULL on error

Definition at line 455 of file eris_ifu_utils.c.

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

Referenced by eris_ifu_get_hdrlimagelist_by_tag().

◆ eris_ifu_get_hdrlimagelist_by_tag()

hdrl_imagelist * eris_ifu_get_hdrlimagelist_by_tag ( cpl_frameset *  frameset,
const char *  tag,
int  exposureCorrectionMode 
)

Return HDRL imagelist by searching tagged frames in frameset.

Parameters
framesetThe input frameset (of the recipe)
tagThe tag name of the frames to be selected
exposureCorrectionModedata correction to be applied
Returns
a pointer to the HDRL imagelist or NULL in case of an error

The function returns an HDRL imagelist (and, if requested, a CPL imagelist) by searching an input frameset for frames with the proper tag name. If no frames with the tag are found a NULL pointer will be returned. No error images in the HDRL imagelist will be created.

Definition at line 394 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, eris_check_error_code(), eris_ifu_file_exists(), eris_ifu_free_frameset(), eris_ifu_free_hdrl_imagelist(), eris_ifu_get_frameset_by_tag(), eris_ifu_load_exposure_file(), hdrl_imagelist_get_size(), hdrl_imagelist_new(), hdrl_imagelist_set(), and TRY.

◆ eris_ifu_get_instrumentString()

const char * eris_ifu_get_instrumentString ( ifsInstrument  instrument)

Convert instrument enum to string.

Parameters
instrumentInstrument enumeration
Returns
Instrument name as string (e.g., "SPIFFI", "SPIFFIER", "NIX")
Note
Returned string is a static const char* (do not free)
Returns "unknown instrument" or "unset instrument" for invalid values

Definition at line 2048 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_stdstar_reduction_common().

◆ eris_ifu_get_lampString()

char * eris_ifu_get_lampString ( int  lampStatus)

Convert lamp status bitmask to string.

Parameters
lampStatusBitmask of lamp states (AR_LAMP | KR_LAMP | NE_LAMP | XE_LAMP)
Returns
String indicating which lamps are ON (e.g., "ArKr", "Xe")

Converts lamp status bitmask to human-readable string.

Example:

  • lampStatus = AR_LAMP | KR_LAMP → returns "ArKr"
  • lampStatus = XE_LAMP → returns "Xe"
  • lampStatus = 0 → returns ""
Note
Returned string must be freed with cpl_free()

Definition at line 1762 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_ifu_get_first_fit(), eris_ifu_save_resampled_arc_images(), eris_ifu_wave_get_arc_images(), and eris_ifu_wave_save_spectrum().

◆ eris_ifu_get_plane_cut_min_max()

cpl_error_code eris_ifu_get_plane_cut_min_max ( ifsBand  band,
cpl_size *  zmin,
cpl_size *  zmax 
)

Get band-specific plane indices for NaN trimming.

Parameters
bandBand enumeration
zminoutput: minimum valid plane index (0-based)
zmaxoutput: maximum valid plane index (0-based)
Returns
CPL_ERROR_NONE or the relevant error code on error

Returns the range of spectral planes that have less than 50% NaN pixels for a given band. Planes outside [zmin, zmax] are typically trimmed.

Note
Values are empirically determined for each band
zmin and zmax are 0-based indices

Definition at line 1909 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_ifu_jitter_process_exposures().

◆ eris_ifu_get_preopticsScaleString()

const char * eris_ifu_get_preopticsScaleString ( ifsPreopticsScale  scale)

Convert pre-optics scale enum to string.

Parameters
scalePre-optics scale enumeration
Returns
Scale string (e.g., "25mas", "100mas", "250mas", "PUPIL")

Converts the pre-optics scale (pixel scale) to human-readable string.

Note
Returned string is a static const char* (do not free)
Returns "Unknown" for unrecognized scales

Definition at line 2073 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_stdstar_reduction_common().

◆ eris_ifu_hdrl_get_imagelist()

cpl_imagelist * eris_ifu_hdrl_get_imagelist ( const hdrl_imagelist *  hdrl_imglist,
enum hdrl_t  type 
)

Extract from an HDRL imagelist a specific CPL imagelist.

Parameters
hdrl_imglistThe input hdrl_imagelist
typeEither eris_hdrl_data, eris_hdrl_error, or eris_hdrl_badpix
Returns
The desired cpl_imagelist

Extracts one component (data or error) from an HDRL imagelist as a CPL imagelist. The bad pixel type is not fully implemented.

Note
All images are duplicated (returned imagelist is independent)
Returned imagelist must be deleted by caller

Definition at line 1703 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, eris_check_error_code(), eris_ifu_free_image(), eris_ifu_free_imagelist(), hdrl_image_get_error_const(), hdrl_image_get_image_const(), hdrl_imagelist_get(), hdrl_imagelist_get_size(), and TRY.

Referenced by eris_ifu_save_hdrl_imagelist_dbg().

◆ eris_ifu_hdrl_image_reject_mask()

cpl_error_code eris_ifu_hdrl_image_reject_mask ( hdrl_image *  img,
const cpl_mask *  mask 
)

Add mask to HDRL image (reject masked pixels)

Parameters
imgHDRL image to modify
maskMask to apply (CPL_BINARY_1 = bad pixel)
Returns
CPL error code

Combines the input mask with the HDRL image's internal bad pixel mask. Pixels marked as bad (CPL_BINARY_1) in the input mask will be rejected in the HDRL image if they are currently marked as good.

Note
Both image and mask must have the same dimensions
Only good pixels (CPL_BINARY_0) in the HDRL image are modified
The HDRL image is modified in-place

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT The image or mask is a NULL pointer
  • CPL_ERROR_ILLEGAL_INPUT The dimensions don't match

Definition at line 999 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, eris_check_error_code(), hdrl_image_get_mask(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), and TRY.

Referenced by eris_ifu_dark_qc().

◆ eris_ifu_hima_get_obj_mask()

cpl_mask * eris_ifu_hima_get_obj_mask ( hdrl_image *  hima,
const cpl_size  niter,
const double  kappa 
)

find mask flagging pixels above a threshold set by ks-clip algorithm

Parameters
himainput hdrl image
niternumber of kapa-sigma iterations
kappakappa used in kappa-sigma clip of (object) data
Returns
cpl_mask* mask flagging points where objects have been found
Note
niter must be such that: 1 <= niter <= 100

Definition at line 3548 of file eris_ifu_utils.c.

References eris_check_error_code(), hdrl_image_get_image(), hdrl_image_get_median(), hdrl_image_get_stdev(), and hdrl_image_reject_from_mask().

◆ eris_ifu_hima_get_obj_mask_percent()

cpl_mask * eris_ifu_hima_get_obj_mask_percent ( hdrl_image *  hima,
const double  percent 
)

find mask flagging pixels above percent(%) pixels with lower intensity

Parameters
himainput hdrl image
percentinput percent threshold
Returns
cpl_mask* mask flagging points where objects have been found
Note
percent must be such that: 0.25 <= percent <= 0.75

Definition at line 3503 of file eris_ifu_utils.c.

References hdrl_image_get_image(), hdrl_image_get_size_x(), and hdrl_image_get_size_y().

◆ eris_ifu_idl_values_at_indices()

cpl_vector * eris_ifu_idl_values_at_indices ( const cpl_vector *  data,
const cpl_vector *  indices 
)

Returns a vector of given indices.

Parameters
dataThe data vector.
indicesThe indices to the data vector.
Returns
A (possibly shorter) vector with the desired values.

The returned vector contains the values of data indicated by indices . indices needn't be orderd, so will also have the returned vector the same order.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if data is NULL or if an illegal op is provided.

Definition at line 232 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, eris_check_error_code(), eris_ifu_free_vector(), SET_ERROR_MSG, and TRY.

◆ eris_ifu_idl_where()

cpl_vector * eris_ifu_idl_where ( const cpl_vector *  data,
double  val,
int  op 
)

Implements the where-function known from IDL.

Parameters
dataThe vector.
valThe value.
opThe operator.
Returns
A vector with the indices to the input vector which fulfill the given condition. When the condition is never met NULL is returned.

The vector is checked elementwise like 'data[i] op val'. The operator can be any of following enums: eq: data[i] == val ne: data[i] != val ge: data[i] >= val gt: data[i] > val le: data[i] <= val lt: data[i] < val

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if data is NULL or if an illegal op is provided.

Definition at line 142 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_cut_endings(), eris_ifu_free_vector(), SET_ERROR_MSG, and TRY.

◆ eris_ifu_image_create_window()

cpl_image * eris_ifu_image_create_window ( const cpl_image *  img)

Create sub-image by removing bad pixel border.

Parameters
imginput image
Returns
sub-image with border removed (ERIS_IFU_DETECTOR_BP_BORDER pixels on each side)

Removes a border of ERIS_IFU_DETECTOR_BP_BORDER pixels from all sides of the image, including its bad pixel mask.

Note
Returned image must be deleted by caller
Copies both data and bad pixel mask

Definition at line 2111 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_free_image(), and TRY.

◆ eris_ifu_interpolatedMask_to_maskZero()

cpl_imagelist * eris_ifu_interpolatedMask_to_maskZero ( cpl_imagelist *  bpmCube,
double  threshold 
)

return cube flagging (as 1) pixels above a given threshold

Parameters
bpmCubeinput imagelist
thresholdthreshold
Returns
cube with detected threshold pixels

Definition at line 2434 of file eris_ifu_utils.c.

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

◆ eris_ifu_load_badpixel_mask()

cpl_mask * eris_ifu_load_badpixel_mask ( const cpl_frameset *  frameset,
const char *  category,
int  ext 
)

‍**

Load bad pixel mask of a given category.

Parameters
framesetThe input set-of-frames.
categoryThe category of the bad pixel mask to load. If NULL, the next frame with same keyword as accessed right before will be returned
extThe number of the extension. 0 for primary HDU
Returns
The loaded bad pixel mask.

Loads a CPL mask from a FITS file identified by tag in the frameset.

Note
Returns NULL if frame not found (not an error)

Definition at line 1547 of file eris_ifu_utils.c.

References ASSURE, CATCH, CATCH_MSG, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_free_mask(), and TRY.

◆ eris_ifu_mask_create_border()

cpl_mask * eris_ifu_mask_create_border ( const cpl_mask *  mask)

Add bad pixel border around mask.

Parameters
maskinput mask
Returns
mask with border added (ERIS_IFU_DETECTOR_BP_BORDER pixels on each side)

Adds a border of ERIS_IFU_DETECTOR_BP_BORDER pixels around the mask. Border pixels are initialized to CPL_BINARY_0 (good).

Note
Returned mask must be deleted by caller
Inverse operation of eris_ifu_image_create_window for masks

Definition at line 2171 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, CHECK_ERROR_STATE, eris_check_error_code(), eris_ifu_free_mask(), and TRY.

◆ eris_ifu_mask_from_image()

cpl_mask * eris_ifu_mask_from_image ( const cpl_image *  img_mask)

eris_ifu_mask_from_image

Parameters
img_mask
Returns

convert image to mask img: 1: good, 0:bad mask: 0: good, 1: bad

Definition at line 3670 of file eris_ifu_utils.c.

References BRK_IF_NULL, CATCH, CATCH_MSG, eris_ifu_free_mask(), and TRY.

◆ eris_ifu_mask_nans_in_cube()

cpl_error_code eris_ifu_mask_nans_in_cube ( cpl_imagelist *  cube)

Mask NaNs and Infs in CPL imagelist (cube)

Parameters
cubeinput imagelist (modified in-place)
Returns
CPL_ERROR_NONE if OK

Scans all planes in cube for non-finite values (NaN, Inf, -Inf) and marks them as bad pixels.

Note
Works with both FLOAT and DOUBLE types
Cube is modified in-place
Uses isfinite() check

Definition at line 2274 of file eris_ifu_utils.c.

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

Referenced by eris_ifu_jitter_build_cube(), eris_ifu_jitter_reconstruct_cube(), eris_ifu_lcorr_create_object_mask(), and eris_ifu_lcorr_get().

◆ eris_ifu_mask_nans_in_hdrlimage()

cpl_error_code eris_ifu_mask_nans_in_hdrlimage ( hdrl_image **  hima)

Flag NaNs in HDRL image.

Parameters
himainput HDRL image (modified in-place)
Returns
CPL_ERROR_NONE or error code

Scans both data and error planes for NaN values and marks corresponding pixels as bad in the mask.

Note
Image is modified in-place
Both data and error are checked

Definition at line 2226 of file eris_ifu_utils.c.

References eris_check_error_code(), hdrl_image_get_error(), hdrl_image_get_image(), hdrl_image_get_mask(), hdrl_image_get_size_x(), and hdrl_image_get_size_y().

◆ eris_ifu_parameterlist_append_list()

cpl_error_code eris_ifu_parameterlist_append_list ( cpl_parameterlist *  p1,
const cpl_parameterlist *  p2 
)

Append a parameterlist to another one.

Parameters
p1The 1st list to be extended
p2The 2nd list to be appended
Returns
CPL_ERROR_NONE in case everything went fine
Note
All parameters from p2 are duplicated before insertion into p1

Definition at line 508 of file eris_ifu_utils.c.

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

Referenced by eris_ifu_add_std_params(), eris_parlist_config_add_bpm(), and eris_parlist_config_add_flat().

◆ eris_ifu_quality2bp_mask()

cpl_mask * eris_ifu_quality2bp_mask ( const cpl_image *  qualityMask,
deqQualityType  qualityType 
)

transform input image (quality mask) to output mask with given bit code

Parameters
qualityMaskinput imagelist
qualityTypeBIT code
Returns
mask of given type.

Definition at line 2388 of file eris_ifu_utils.c.

References ASSURE, BRK_WITH_ERROR_MSG, CATCH, eris_check_error_code(), and TRY.

Referenced by eris_ifu_jitter_processSof().

◆ eris_ifu_save_bivector_dbg()

cpl_error_code eris_ifu_save_bivector_dbg ( const cpl_bivector *  bivec,
const char *  filename,
int  col,
int  create 
)

Save bivector for debugging (as vector or table)

Parameters
bivecinput bivector
filenamefile name of product
col1=X only, 2=Y only, 0=both (as table with extensions)
createCPL_IO_CREATE or CPL_IO_EXTEND
Returns
CPL_ERROR_NONE if OK

Quick-save function for debugging bivectors.

Mode Selection:

  • col=1: Save X vector only
  • col=2: Save Y vector only
  • col=0: Save both as separate extensions (MEF)
Note
For production code, use proper DFS-compliant save functions

Definition at line 1101 of file eris_ifu_utils.c.

References eris_ifu_save_vector_dbg().

◆ eris_ifu_save_cpl_image_dbg()

cpl_error_code eris_ifu_save_cpl_image_dbg ( const cpl_image *  img,
const char *  name,
int  singlefile,
const cpl_propertylist *  pl 
)

Save CPL image with mask for debugging.

Parameters
imginput image (with internal BPM)
namebase file name (without extension)
singlefileif TRUE, save as MEF; if FALSE, save as separate files
plinput propertylist (can be NULL)
Returns
CPL_ERROR_NONE if OK

Saves a CPL image and its bad pixel mask. Two modes:

  • singlefile=TRUE: name.fits (data in ext 0, mask in ext 1)
  • singlefile=FALSE: name_data.fits and name_mask.fits
Note
For production code, use proper DFS-compliant save functions

Definition at line 1244 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, eris_check_error_code(), eris_ifu_save_image_dbg(), eris_ifu_save_mask_dbg(), and TRY.

◆ eris_ifu_save_cpl_imagelist_dbg()

cpl_error_code eris_ifu_save_cpl_imagelist_dbg ( const cpl_imagelist *  imglist,
const char *  name 
)

Save CPL imagelist for debugging.

Parameters
imglistinput imagelist
namebase file name (without extension)
Returns
CPL_ERROR_NONE if OK

Quick-save wrapper for debugging CPL imagelists. Automatically appends .fits extension.

Note
For production code, use eris_ifu_save_imagelist() instead

Definition at line 1295 of file eris_ifu_utils.c.

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

◆ eris_ifu_save_hdrl_image_dbg()

cpl_error_code eris_ifu_save_hdrl_image_dbg ( const hdrl_image *  hdrl_img,
const char *  filename,
int  singlefile,
const cpl_propertylist *  pl 
)

Save HDRL image for debugging (data + error + mask)

Parameters
hdrl_imginput HDRL image
filenamebase file name (without extension)
singlefileif TRUE, save as MEF; if FALSE, save as separate files
plinput propertylist (can be NULL)
Returns
CPL_ERROR_NONE if OK

Saves an HDRL image including data, error, and mask components.

Modes:

  • singlefile=TRUE: filename.fits (data/error/mask as extensions 0/1/2)
  • singlefile=FALSE: filename_data.fits, filename_err.fits, filename_mask.fits
Note
For production code, use proper DFS-compliant save functions
Mask may be NULL (will be skipped if not present)

Definition at line 1333 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, eris_check_error_code(), eris_ifu_save_image_dbg(), eris_ifu_save_mask_dbg(), hdrl_image_get_error_const(), hdrl_image_get_image_const(), hdrl_image_get_mask_const(), and TRY.

Referenced by eris_ifu_jitter_build_cube(), eris_ifu_jitter_get_objsky_exposures(), and eris_ifu_jitter_subtract_background().

◆ eris_ifu_save_hdrl_imagelist_dbg()

cpl_error_code eris_ifu_save_hdrl_imagelist_dbg ( const hdrl_imagelist *  hdrl_img_list,
const char *  filename,
int  singlefile 
)

Save HDRL imagelist for debugging (data + error + mask planes)

Parameters
hdrl_img_listinput HDRL imagelist
filenamebase file name (without extension)
singlefileif TRUE, save as MEF; if FALSE, save as separate files
Returns
CPL_ERROR_NONE if OK

Saves an HDRL imagelist (cube) including data, error, and mask planes.

Modes:

  • singlefile=TRUE: filename.fits (data/error/mask as extensions)
  • singlefile=FALSE: filename_data.fits, filename_err.fits, filename_mask.fits
Note
For production code, use proper DFS-compliant save functions
Mask is converted from CPL_BINARY to float (0=good, 1=bad)

Definition at line 1403 of file eris_ifu_utils.c.

References CATCH, CATCH_MSGS, eris_check_error_code(), eris_ifu_free_imagelist(), eris_ifu_hdrl_get_imagelist(), eris_ifu_save_imagelist_dbg(), hdrl_image_get_mask_const(), hdrl_imagelist_get_const(), hdrl_imagelist_get_size(), and TRY.

◆ eris_ifu_save_ifu_vector_dbg()

cpl_error_code eris_ifu_save_ifu_vector_dbg ( const eris_ifu_vector *  vec,
const char *  filename,
int  create 
)

Save eris_ifu_vector for debugging (quick, no DFS overhead)

Parameters
vecinput eris_ifu_vector
filenamefile name of product
createCPL_IO_CREATE or CPL_IO_EXTEND
Returns
CPL_ERROR_NONE if OK

Quick-save function for debugging eris_ifu_vector types. Uses -10.0 as invalid value marker.

Note
For production code, use proper DFS-compliant save functions

Definition at line 1078 of file eris_ifu_utils.c.

References eris_ifu_vector_save().

◆ eris_ifu_save_image()

cpl_error_code eris_ifu_save_image ( cpl_frameset *  fs,
const cpl_propertylist *  plist,
const cpl_parameterlist *  parlist,
const char *  recipe,
const char *  procatg,
const char *  filename,
cpl_type  type,
const cpl_image *  image 
)

Save image with DFS compliance.

Parameters
fsinput frameset
plistinput propertylist (FITS header)
parlistinput parameter list
recipeinput recipe name
procatgproduct category (e.g., "MASTER_DARK")
filenameproduct file name
typetype of image (CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, etc.)
imageimage to save
Returns
CPL_ERROR_NONE if OK

Saves a CPL image as a DFS-compliant FITS file with proper product category, provenance, and pipeline version information.

Note
Property list is duplicated internally (safe to reuse)
Uses cpl_dfs_save_image for DFS compliance

Definition at line 865 of file eris_ifu_utils.c.

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

Referenced by eris_ifu_combine().

◆ eris_ifu_save_image_dbg()

cpl_error_code eris_ifu_save_image_dbg ( const cpl_image *  img,
const char *  filename,
int  create,
const cpl_propertylist *  pl 
)

Save image for debugging (quick, no DFS overhead)

Parameters
imginput image
filenamefile name of product
createCPL_IO_CREATE or CPL_IO_EXTEND
plinput propertylist (can be NULL)
Returns
CPL_ERROR_NONE if OK

Quick-save function for debugging. Automatically detects image type (FLOAT, DOUBLE, INT) and saves accordingly.

Note
For production code, use eris_ifu_save_image() instead

Definition at line 1139 of file eris_ifu_utils.c.

Referenced by eris_ifu_save_cpl_image_dbg(), eris_ifu_save_hdrl_image_dbg(), eris_ifu_save_resampled_arc_images(), and eris_ifu_wave_get_calImg().

◆ eris_ifu_save_imagelist()

cpl_error_code eris_ifu_save_imagelist ( cpl_frameset *  fs,
cpl_frame *  inherit,
const cpl_propertylist *  plist,
const cpl_parameterlist *  parlist,
const char *  recipe,
const char *  procatg,
const char *  filename,
cpl_type  type,
const cpl_imagelist *  imglist 
)

Save imagelist with DFS compliance.

Parameters
fsinput frameset
inheritframe from which to inherit header
plistinput propertylist (FITS header)
parlistinput parameter list
recipeinput recipe name
procatgproduct category (e.g., "DATACUBE")
filenameproduct file name
typetype of imagelist (CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, etc.)
imglistimagelist to save (typically a cube)
Returns
CPL_ERROR_NONE if OK

Saves a CPL imagelist (cube) as a DFS-compliant FITS file. Automatically adds PRODTYPE=CUBE and PRODTECH=CUBE keywords, and removes RADECSYS.

Note
Property list is duplicated internally (safe to reuse)
Uses cpl_dfs_save_imagelist for DFS compliance
Erases WCS keywords (RADECSYS) to avoid conflicts

Definition at line 930 of file eris_ifu_utils.c.

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

◆ eris_ifu_save_imagelist_dbg()

cpl_error_code eris_ifu_save_imagelist_dbg ( const cpl_imagelist *  imglist,
const char *  filename,
int  create 
)

Save CPL imagelist for debugging (quick, no DFS overhead)

Parameters
imglistinput image list
filenamefile name of product
createCPL_IO_CREATE or CPL_IO_EXTEND
Returns
CPL_ERROR_NONE if OK

Quick-save function for debugging imagelists. Automatically detects image type (FLOAT or DOUBLE) from first plane.

Note
For production code, use eris_ifu_save_imagelist() instead

Definition at line 1210 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_ifu_save_cpl_imagelist_dbg(), and eris_ifu_save_hdrl_imagelist_dbg().

◆ eris_ifu_save_mask_dbg()

cpl_error_code eris_ifu_save_mask_dbg ( const cpl_mask *  mask,
const char *  filename,
int  create,
const cpl_propertylist *  pl 
)

Save mask for debugging (quick, no DFS overhead)

Parameters
maskinput mask
filenamefile name of product
createCPL_IO_CREATE or CPL_IO_EXTEND
plinput propertylist (can be NULL)
Returns
CPL_ERROR_NONE if OK

Quick-save function for debugging masks.

Note
For production code, use proper DFS-compliant save functions

Definition at line 1191 of file eris_ifu_utils.c.

Referenced by eris_ifu_save_cpl_image_dbg(), and eris_ifu_save_hdrl_image_dbg().

◆ eris_ifu_save_table_dbg()

cpl_error_code eris_ifu_save_table_dbg ( const cpl_table *  tbl,
const char *  filename,
int  create 
)

Save table for debugging (quick, no DFS overhead)

Parameters
tblinput table
filenamefile name of product
createCPL_IO_CREATE or CPL_IO_EXTEND
Returns
CPL_ERROR_NONE if OK

Quick-save function for debugging tables.

Note
For production code, use eris_ifu_save_table() with proper DFS compliance

Definition at line 1173 of file eris_ifu_utils.c.

◆ eris_ifu_save_vector_dbg()

cpl_error_code eris_ifu_save_vector_dbg ( const cpl_vector *  vec,
const char *  filename,
int  create,
const cpl_propertylist *  pl 
)

Save vector for debugging (quick, no DFS overhead)

Parameters
vecinput vector
filenamefile name of product
createCPL_IO_CREATE or CPL_IO_EXTEND
plpropertylist (can be NULL)
Returns
CPL_ERROR_NONE if OK

Quick-save function for debugging. Bypasses DFS compliance checks. Always saves as CPL_TYPE_DOUBLE.

Note
For production code, use eris_ifu_save_*() functions instead

Definition at line 1057 of file eris_ifu_utils.c.

Referenced by eris_ifu_dist_calc_centers(), eris_ifu_save_bivector_dbg(), and eris_ifu_slitpos_gauss().

◆ eris_ifu_split3_hdrl_imagelist()

cpl_error_code eris_ifu_split3_hdrl_imagelist ( hdrl_imagelist *  cube,
cpl_imagelist *  dataCube,
cpl_imagelist *  errorCube,
cpl_imagelist *  qualCube 
)

extract from hdrl_imagelist the data and error information

Parameters
cubeinput imagelist
dataCubeoutput data
errorCubeoutput errs
qualCubeoutput quality
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2552 of file eris_ifu_utils.c.

References CATCH, eris_check_error_code(), hdrl_image_get_error(), hdrl_image_get_image(), hdrl_image_get_mask(), hdrl_imagelist_get(), hdrl_imagelist_get_size(), and TRY.

Referenced by eris_ifu_resample_save_cube().

◆ eris_ifu_split_hdrl_imagelist()

cpl_error_code eris_ifu_split_hdrl_imagelist ( hdrl_imagelist *  cube,
cpl_imagelist *  dataCube,
cpl_imagelist *  errorCube 
)

extract from hdrl_imagelist the data and error information

Parameters
cubeinput imagelist
dataCubeoutput data
errorCubeoutput errs
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2514 of file eris_ifu_utils.c.

References CATCH, eris_check_error_code(), hdrl_image_get_error(), hdrl_image_get_image(), hdrl_imagelist_get(), hdrl_imagelist_get_size(), and TRY.

Referenced by eris_ifu_jitter_process_cubes().

◆ eris_pfits_put_qc()

cpl_error_code eris_pfits_put_qc ( cpl_propertylist *  plist,
cpl_table *  qclog 
)

convert table with QC parameter information to a propertylist

Parameters
plistoutput property list
qcloginput qclog table
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2878 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_compute_psf_qc(), eris_ifu_cube_collapse_mean_and_save(), and eris_ifu_wave_get_calImg().

◆ eris_qclog_add_bool()

cpl_error_code eris_qclog_add_bool ( cpl_table *  table,
const char *  key_name,
const char *  key_help 
)

add QC boolean info to table

Parameters
tableinput table
key_namekeyword name
key_helpkeyword help info
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2663 of file eris_ifu_utils.c.

References eris_check_error_code().

◆ eris_qclog_add_double()

cpl_error_code eris_qclog_add_double ( cpl_table *  table,
const char *  key_name,
const double  value,
const char *  key_help 
)

add QC double info to table

Parameters
tableinput table
key_namekeyword name
valuekeyword value
key_helpkeyword help info
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2705 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_compute_psf_qc(), eris_ifu_wave_collapse_arc_images(), and eris_ifu_wave_get_calImg().

◆ eris_qclog_add_double_f()

cpl_error_code eris_qclog_add_double_f ( cpl_table *  table,
const char *  key_name,
const double  value,
const char *  key_help 
)

add QC float info to table

Parameters
tableinput table
key_namekeyword name
valuekeyword value
key_helpkeyword help info
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2750 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_compute_psf_qc(), eris_get_pupil_shift(), and eris_ifu_cube_collapse_mean_and_save().

◆ eris_qclog_add_double_format()

cpl_error_code eris_qclog_add_double_format ( cpl_table *  table,
const char *  key_name,
const double  value,
const char *  key_help 
)

add QC double (with format) info to table

Parameters
tableinput table
key_namekeyword name
valuekeyword value
key_helpkeyword help info
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2793 of file eris_ifu_utils.c.

References eris_check_error_code().

◆ eris_qclog_add_int()

cpl_error_code eris_qclog_add_int ( cpl_table *  table,
const char *  key_name,
const int  value,
const char *  key_help 
)

add QC int info to table

Parameters
tableinput table
key_namekeyword name
valuekeyword value
key_helpkeyword help info
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2618 of file eris_ifu_utils.c.

References eris_check_error_code().

Referenced by eris_compute_psf_qc(), and eris_ifu_wave_collapse_arc_images().

◆ eris_qclog_add_string()

cpl_error_code eris_qclog_add_string ( cpl_table *  table,
const char *  key_name,
const char *  value,
const char *  key_help 
)

add QC string info to table

Parameters
tableinput table
key_namekeyword name
valuekeyword value
key_helpkeyword help info
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Definition at line 2836 of file eris_ifu_utils.c.

References eris_check_error_code().

◆ eris_qclog_init()

cpl_table * eris_qclog_init ( void  )