ERIS Pipeline Reference Manual 1.8.15
Functions
Miscellaneous Utilities

Functions

cpl_error_code enu_basic_calibrate (located_image *limage, const int read_offsets, const cpl_table *refine_wcs, const master_dark *mdark, const gain_linearity *gain_lin, const master_flat *flatfield_1, const master_flat *flatfield_2, const master_bpm *mbad_pix_map, const int flag_mask, const char *fill_rejected, const double fill_value, const cpl_size x_probe, const cpl_size y_probe)
 Do basic calibration of located_image (single or cube)
 
cpl_error_code enu_basic_calibrate_himage (hdrl_image *himage, cpl_image *confidence, cpl_propertylist *plist, const cpl_frame *frame, const int read_offsets, const master_dark *mdark, const gain_linearity *gain_lin, const master_flat *flatfield_1, const master_flat *flatfield_2, const master_bpm *mbad_pix_map, const int set_confidence, const int flag_mask, const char *fill_rejected, const double fill_value, const cpl_size x_probe, const cpl_size y_probe)
 Do basic calibration of an hdrl_image.
 
hdrl_image * enu_calc_flat (hdrl_imagelist *himlist, const int min_coadds, const hdrl_parameter *collapse_params, const cpl_size filter_size_x, const cpl_size filter_size_y, const hdrl_flat_method method)
 Calculate a flatfield result.
 
cpl_error_code enu_calc_maglim (const located_image *limage, const double photzp, const double fwhm_pix, double *abmaglim)
 Calculate magnitude limit of image.
 
cpl_error_code enu_calc_pixel_coords (cpl_table *catalogue, const cpl_propertylist *wcs_plist)
 Calculate predicted positions of catalogue objects for given wcs.
 
hdrl_catalogue_result * enu_catalogue_compute (const hdrl_image *himage, const cpl_image *confidence, const cpl_wcs *wcs, hdrl_parameter *params)
 Wrapper for hdrl_catalogue_compute.
 
cpl_vector * enu_bracket_skys (const located_image *target, const double timerange, const located_imagelist *pool, const int debug)
 Find images taken within a given time of a target image.
 
cpl_error_code enu_catalogue_limlist (located_imagelist *limlist, hdrl_parameter *params)
 Calculate object catalogues for a list of images.
 
int enu_check_conformance (const cpl_propertylist *plist1, const cpl_propertylist *plist2, const char *regexp)
 Check that the specified subset of two propertylists match.
 
cpl_error_code enu_check_wcs (const located_image *limage)
 Check that the image has valid WCS keywords.
 
cpl_error_code enu_debug_limlist_save (const int debug, const located_imagelist *limlist, const char *nameroot, const char *recipename, cpl_frameset *frameset, const cpl_parameterlist *parlist, const cpl_frameset *used)
 Save a list of intermediate image results for use in debugging.
 
cpl_error_code enu_flat_save (const char *pro_catg, const hdrl_image *flat, const cpl_image *confidence, const cpl_mask *cold_bpm, cpl_frameset *frameset, const cpl_parameterlist *parlist, const char *filename, const char *recipe_name, const cpl_propertylist *qclog)
 Save a flatfield result.
 
double enu_get_airmass (const cpl_propertylist *plist)
 Get the mean airmass of an observation.
 
cpl_error_code enu_get_rcore_and_mesh_size (const char *context, const cpl_parameterlist *parlist, const cpl_propertylist *plist, double *obj_core_radius, int *bkg_mesh_size)
 Get catalogue core-radius and mesh-size appropriate to AO mode.
 
double enu_get_tel_alt (const cpl_propertylist *plist)
 Get telescope altitude of an observation.
 
double enu_get_dit (const cpl_propertylist *plist)
 Get the DIT of an integration.
 
const char * enu_get_det_mode (const cpl_propertylist *plist)
 Get the detector mode of an integration.
 
const char * enu_get_filter (const cpl_propertylist *plist)
 Get the filter used in an observation.
 
double enu_get_filter_wavelength (const char *filter)
 Get the effective wavelength of a filter.
 
const char * enu_get_license (void)
 Get the pipeline copyright and license.
 
cpl_error_code enu_get_ra_dec (const cpl_wcs *wcs, double *ra, double *dec)
 Get RA and Dec at centre of image with given wcs.
 
cpl_error_code enu_get_window_info (cpl_size *nx, cpl_size *ny, int *rot, cpl_size *strx, cpl_size *stry, cpl_size *nx_chip, cpl_size *ny_chip, cpl_boolean *windowed, const cpl_propertylist *plist)
 Get the detector 'window' information.
 
hdrl_catalogue_result * enu_hdrl_catalogue_result_duplicate (const hdrl_catalogue_result *target)
 Return a deep copy of the given hdrl_catalogue_result object.
 
cpl_error_code enu_himage_load_from_fits (const char *filename, hdrl_image **result, mef_extension_list **mef_extensions, cpl_propertylist **plist)
 Load an hdrl_image from a multi-extension FITS file.
 
located_image * enu_load_limage_from_frame (const cpl_frame *frame, cpl_image **pcopyconf, const cpl_boolean collapse_cube)
 Load components of a located_image from a frame.
 
mef_extension_list * enu_load_mef_components (const char *filename, cpl_propertylist **plist)
 Load components of a multi-extension FITS file.
 
void enu_located_image_delete (located_image *limage)
 Delete a located_image and its contents.
 
located_image * enu_located_image_duplicate (const located_image *limage)
 Make a deep copy of a located_image and its contents.
 
located_image * enu_located_image_new (hdrl_image *himage, hdrl_imagelist *himagelist, cpl_image *confidence, hdrl_image *bkg, cpl_image *bkg_confidence, cpl_propertylist *plist, hdrl_catalogue_result *objects, cpl_mask *object_mask, hdrl_catalogue_result *wcs, hdrl_catalogue_result *photom, cpl_frame *frame)
 Create a located_image structure and initialise the contents.
 
located_imagelist * enu_limlist_load_from_frameset (cpl_frameset *frameset, const char *tag, cpl_frameset *used)
 Load tagged data from a frameset into a located_imagelist.
 
cpl_image * enu_load_component (mef_extension *mef, const char *dps_name, const char *hduclas1, const char *hduclas2)
 Load data from a MEF component of specified type.
 
void enu_located_imagelist_delete (located_imagelist *limlist)
 Delete a located_imagelist and its contents.
 
located_imagelist * enu_located_imagelist_duplicate (const located_imagelist *limlist)
 Make a deep copy of a located_imagelist and its contents.
 
cpl_error_code enu_located_imagelist_insert (located_imagelist *limlist, located_image *limage, cpl_size position)
 Insert a located_image at a specified point in a located_imagelist.
 
located_imagelist * enu_located_imagelist_new (cpl_size size)
 Return a pointer to a new located_imagelist.
 
void enu_mef_extension_delete (mef_extension *mef)
 Delete a mef_extension and its contents.
 
void enu_mef_extension_list_delete (mef_extension_list *list)
 Delete a mef_extension_list and its contents.
 
cpl_mask * enu_mef_extension_list_get_mask (mef_extension_list *meflist, const char *target)
 Get a cpl_mask from a named mef_extension in a list.
 
mef_extension_list * enu_mef_extension_list_new (cpl_size size)
 Construct a new mef_extension_list.
 
mef_extension * enu_mef_new_image (const char *name, const cpl_image *data, const cpl_propertylist *plist)
 Create a mef_extension to hold a cpl_image.
 
mef_extension * enu_mef_new_mask (const char *name, const cpl_mask *data, const cpl_propertylist *plist)
 Create a mef_extension struct holding a cpl_mask.
 
mef_extension * enu_mef_new_table (const char *name, const cpl_table *table, const cpl_propertylist *plist)
 Create a mef_extension struct holding a cpl_table.
 
mef_extension * enu_mef_new_vector (const char *name, const cpl_vector *vector, const cpl_propertylist *plist)
 Create a mef_extension struct holding a cpl_vector.
 
cpl_error_code enu_mef_extension_save (const mef_extension *mef, const char *filename, const cpl_propertylist *plist, unsigned mode)
 Save a mef_extension struct to FITS file.
 
cpl_error_code enu_opm_limlist (const int obj_min_pixels, const double obj_threshold, const int bkg_mesh_size, const double bkg_smooth_fwhm, located_imagelist *limlist)
 Calculate object masks for images in a located_imagelist.
 
cpl_error_code enu_opm_lss_limlist (located_imagelist *limlist, const int nsigma_cut)
 Calculate object masks for LSS images in a located_imagelist.
 
cpl_error_code enu_correct_wcs (const cpl_table *refcat, const char *wcs_method, const char *catalogue, located_image *limage, const double match_rad, cpl_table **matched_stds, cpl_matrix **xy_shift)
 Correct the wcs of an image.
 
cpl_error_code enu_modify_CD_matrix (located_image *limage, const cpl_table *refine_wcs)
 Update the CD matrix to reduce image distortion and rotation.
 
cpl_error_code enu_normalise_confidence (cpl_image *confidence)
 Normalise confidence array so that mean of good pixels is 100.
 
cpl_error_code enu_remove_read_offsets (hdrl_image *himage, const cpl_propertylist *plist, cpl_image *confidence, const int set_confidence)
 Function to remove read offsets from an himage and set blank pixels

 
char * enu_repreface (const char *filename, const char *preface)
 Preface a raw filename with a string.
 
cpl_error_code enu_sky_backgrounds (const char *method, const char *select_method, const double timerange, const located_imagelist *target_list, const located_imagelist *sky_list, const cpl_size x_probe, const cpl_size y_probe, hdrl_imagelist **sky_himagelist, cpl_imagelist **sky_confidence_list)
 Get sky backgrounds for a list of target images.
 
cpl_error_code enu_stack (located_imagelist *limages, const double stk_lthr, const double stk_hthr, const char *stk_method, const int stk_fast, located_image **result)
 Stack a set of images.
 
cpl_error_code enu_sky_subtract_limlist (const char *method, const char *select_method, const double timerange, const located_imagelist *sky_data, const cpl_size x_probe, const cpl_size y_probe, located_imagelist *target_data)
 Estimate and subtract sky backgrounds for a list of target images.
 
cpl_error_code eris_nix_get_badpix_qc_from_ima (const master_bpm *mbad_pix_map, cpl_propertylist *qc_list, const char *prefix)
 Compute QC on input master bpm.
 
cpl_propertylist * enu_raw_flats_qc (located_imagelist *lamp_on_limlist, cpl_mask *bp_map_nl_mask, const cpl_parameterlist *parlist, const char *context, const double threshold_pos, const cpl_boolean verbose, const cpl_boolean rescale_by_dit)
 Compute QC on input raw flats.
 

Detailed Description

Synopsis:
#include <eris_nix_utils.h>

Function Documentation

◆ enu_basic_calibrate()

cpl_error_code enu_basic_calibrate ( located_image *  limage,
const int  read_offsets,
const cpl_table *  refine_wcs,
const master_dark *  mdark,
const gain_linearity *  gain_lin,
const master_flat *  flatfield_1,
const master_flat *  flatfield_2,
const master_bpm *  mbad_pix_map,
const int  flag_mask,
const char *  fill_rejected,
const double  fill_value,
const cpl_size  x_probe,
const cpl_size  y_probe 
)

Do basic calibration of located_image (single or cube)

Parameters
limageThe image to be calibrated
read_offsetsIf true then remove read offsets and set blank areas
refine_wcsrefined wcs table or NULL
mdarkthe master dark or NULL
gain_lingain/linearity data or NULL
flatfield_1flatfield data, or NULL
flatfield_2flatfield data, or NULL
mbad_pix_mapmaster bad pixel mask or NULL
flag_maskResult bpm set to mbad_pix_map & flag_mask
fill_rejectedHow treat reject pixels: 'set_value', 'set_NaN' or 'noop'
fill_valuevalue to set reject pixels if 'set_value'
x_probex-coord of pixel to print debug info
y_probey-coord of pixel to print debug info
Returns
CPL_ERROR_NONE if all goes well, otherwise a CPL error code

The function performs basic calibration on the given located_image. If the pointer to this is NULL the routine will return immediately with no error.

'Basic' calibration comprises:

  • remove read offsets, reject and zero confidence of blank pixels
  • correct the wcs CD matrix, if refine_wcs not NULL
  • subtract MASTER_DARK, if mdark not NULL
  • linearize, if gain_lin not NULL
  • populate error plane, if gain_lin not NULL
  • divide by flatfield_1 (MASTER_FLAT_HIFREQ), if not NULL
  • divide by flatfield_2 (e.g. MASTER_FLAT_LOFREQ), if not NULL
  • associate with mask from mbad_pix_map & flag_mask, if mbad_pix_map not NULL. flag_mask should have bits set to 1 to specify flag types that count

Definition at line 99 of file eris_nix_utils.c.

References enu_basic_calibrate_himage(), enu_modify_CD_matrix(), eris_check_error_code(), hdrl_imagelist_get(), and hdrl_imagelist_get_size().

Referenced by eris_nix_scired_cal_det().

◆ enu_basic_calibrate_himage()

cpl_error_code enu_basic_calibrate_himage ( hdrl_image *  himage,
cpl_image *  confidence,
cpl_propertylist *  plist,
const cpl_frame *  frame,
const int  read_offsets,
const master_dark *  mdark,
const gain_linearity *  gain_lin,
const master_flat *  flatfield_1,
const master_flat *  flatfield_2,
const master_bpm *  mbad_pix_map,
const int  set_confidence,
const int  flag_mask,
const char *  fill_rejected,
const double  fill_value,
const cpl_size  x_probe,
const cpl_size  y_probe 
)

Do basic calibration of an hdrl_image.

Parameters
himageThe image to be calibrated
confidenceThe confidence array associated with the image or NULL
plistThe propertylist associated with the image
frameThe frame associated with the image
read_offsetsIf true then remove read offsets and set blank areas
mdarkthe master dark or NULL
gain_lingain/linearity data or NULL
flatfield_1flatfield data, or NULL
flatfield_2flatfield data, or NULL
mbad_pix_mapmaster bad pixel mask or NULL
set_confidenceIf true then fill the confidence array
flag_maskResult bpm set to mbad_pix_map & flag_mask
fill_rejectedHow treat reject pixels: 'set_value', 'set_NaN' or 'noop'
fill_valuevalue to set reject pixels if 'set_value'
x_probex-coord of pixel to print debug info
y_probey-coord of pixel to print debug info
Returns
CPL_ERROR_NONE if all goes well, otherwise a CPL error code

The function performs basic calibration on the given located_image. If the pointer to this is NULL the routine will return immediately with no error.

'Basic' calibration comprises:

  • remove read offsets, reject and zero confidence of blank pixels
  • subtract MASTER_DARK, if mdark not NULL
  • linearize, if gain_lin not NULL
  • populate error plane, if gain_lin not NULL
  • divide by flatfield_1 (MASTER_FLAT_HIFREQ), if not NULL
  • divide by flatfield_2 (e.g. MASTER_FLAT_LOFREQ), if not NULL
  • associate with mask from mbad_pix_map & flag_mask, if mbad_pix_map not NULL. flag_mask should have bits set to 1 to specify flag types that count

Definition at line 257 of file eris_nix_utils.c.

References enu_check_conformance(), enu_get_window_info(), enu_remove_read_offsets(), eris_check_error_code(), hdrl_image_copy(), hdrl_image_delete(), hdrl_image_div_image(), hdrl_image_extract(), hdrl_image_get_error(), hdrl_image_get_image(), hdrl_image_get_mask(), hdrl_image_get_median(), hdrl_image_get_pixel(), and hdrl_image_sub_image().

Referenced by enu_basic_calibrate().

◆ enu_bracket_skys()

cpl_vector * enu_bracket_skys ( const located_image *  target,
const double  timerange,
const located_imagelist *  pool,
const int  debug 
)

Find images taken within a given time of a target image.

Parameters
targetThe target image
timerangeThe time range centred on target for suitable images
poolList of candidate images
debugTrue to print debug information
Returns
A vector with the indeces of suitable images in the candidate pool

Definition at line 1091 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_sky_backgrounds().

◆ enu_calc_flat()

hdrl_image * enu_calc_flat ( hdrl_imagelist *  himlist,
const int  min_coadds,
const hdrl_parameter *  collapse_params,
const cpl_size  filter_size_x,
const cpl_size  filter_size_y,
const hdrl_flat_method  method 
)

Calculate a flatfield result.

Parameters
himlistThe hdrl_imagelist of flat measurements
min_coaddsThe minimum number of results required to be combined
collapse_paramsParameter controlling the collapse algorithm
filter_size_xThe size of the median filter in x
filter_size_yThe size of the median filter in y
methodHDRL_FLAT_FREQ_HIGH or HRDL_FLAT_FREQ_LOW
Returns
An hdrl_image with the flatfield result, or NULL

Definition at line 773 of file eris_nix_utils.c.

References eris_check_error_code(), hdrl_flat_compute(), hdrl_flat_parameter_create(), hdrl_image_delete(), hdrl_imagelist_get_size(), and hdrl_parameter_delete().

◆ enu_calc_maglim()

cpl_error_code enu_calc_maglim ( const located_image *  limage,
const double  photzp,
const double  fwhm_pix,
double *  abmaglim 
)

Calculate magnitude limit of image.

Parameters
limageThe image in question
photzpinput photometric zero point
fwhm_pixinput FWHM in pixel units
abmaglimdouble* to contain result
Returns
CPL_ERROR_NONE if all goes well, otherwise cpl_error_get_code()

This routine is a wrapper for hdrl_maglim_compute.

Definition at line 838 of file eris_nix_utils.c.

References eris_check_error_code(), hdrl_collapse_mode_parameter_create(), hdrl_image_get_error(), hdrl_image_get_image(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), hdrl_maglim_compute(), and hdrl_parameter_delete().

Referenced by eris_nix_scired_hdrl_stack().

◆ enu_calc_pixel_coords()

cpl_error_code enu_calc_pixel_coords ( cpl_table *  catalogue,
const cpl_propertylist *  wcs_plist 
)

Calculate predicted positions of catalogue objects for given wcs.

Parameters
catalogueThe catalogue of objects
wcs_plistPropertylist containing the wcs info
Returns
CPL_ERROR_NONE if all goes well, otherwise cpl_error_get_code()

This routine takes an object catalogue table and a wcs (read from a propertylist), calculates the pixel coords of objects in the catalogue, and adds them to the table in columns "X_coordinate" and "Y_coordinate".

Definition at line 918 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by eris_nix_scired_cal_wcs().

◆ enu_catalogue_compute()

hdrl_catalogue_result * enu_catalogue_compute ( const hdrl_image *  himage,
const cpl_image *  confidence,
const cpl_wcs *  wcs,
hdrl_parameter *  params 
)

Wrapper for hdrl_catalogue_compute.

Parameters
himageInput image
confidenceConfidence map
wcswcs information
paramsparameter struct controlling catalogue determination
Returns
Catalogue of detected objects or NULL if none found

The function checks that the confidence array is not all 0 before calling hdrl_catalogue_compute. Calling that routine with a bad confidence array gives rise to a failure with a confusing error report.

cat = enu_catalogue_compute(himage, confidence, wcs, cat_params);

Definition at line 1011 of file eris_nix_utils.c.

References eris_check_error_code(), hdrl_catalogue_compute(), hdrl_catalogue_result_delete(), and hdrl_image_get_image_const().

Referenced by enu_catalogue_limlist(), eris_nix_scired_cal_wcs(), and eris_nix_scired_hdrl_stack().

◆ enu_catalogue_limlist()

cpl_error_code enu_catalogue_limlist ( located_imagelist *  limlist,
hdrl_parameter *  params 
)

Calculate object catalogues for a list of images.

Parameters
limlistList of input images
paramsparameter struct controlling catalogue determination
Returns
CPL_ERROR_NONE if all goes well, otherwise a cpl error code

Definition at line 1167 of file eris_nix_utils.c.

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

Referenced by eris_nix_scired_cal_wcs().

◆ enu_check_conformance()

int enu_check_conformance ( const cpl_propertylist *  plist1,
const cpl_propertylist *  plist2,
const char *  regexp 
)

Check that the specified subset of two propertylists match.

Parameters
plist1The first property list
plist2The second property list
regexpA regular expression specifying the properties to match
Returns
1 for a match, 0 otherwise

The function checks that a given subset of two propertylists is identical. For example, if you want to check that the DIT and detector mode are the same in two lists you would call:

match = enu_check_conformance(plist1, plist2, "^ESO DET DIT$|^ESO DET READ CURNAME$");

Definition at line 1234 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_basic_calibrate_himage().

◆ enu_check_wcs()

cpl_error_code enu_check_wcs ( const located_image *  limage)

Check that the image has valid WCS keywords.

Parameters
limageThe image to be checked
Returns
A cpl_error_code, CPL_ERROR_NONE if all is well.

The function checks that the given image has keywords CTYPE1 and CTYPE2 and that neither of them is set to "PIXEL". This would signify that no astronomical WCS has been set - as happened during the early ERIS commissioning runs, requiring that the WCS be 'fixed' before running through the pipeline.

Definition at line 1377 of file eris_nix_utils.c.

References eris_check_error_code().

◆ enu_correct_wcs()

cpl_error_code enu_correct_wcs ( const cpl_table *  refcat,
const char *  wcs_method,
const char *  catalogue,
located_image *  limage,
const double  match_rad,
cpl_table **  matched_stds,
cpl_matrix **  xy_shift 
)

Correct the wcs of an image.

Parameters
refcatThe catalogue of reference positions
wcs_methodString describing the correction method
catalogueName of reference catalogue
limageThe lmage with object catalogues to be corrected
match_radMax distance for match between obj and std.
matched_stdsTable containing standards matched to image objects
xy_shiftShift required in x and y to correct the wcs
Returns
CPL_ERROR_NONE if all goes well, otherwise a cpl error code

Definition at line 4182 of file eris_nix_utils.c.

References enm_correct_crpix(), enm_try_all_associations(), and eris_check_error_code().

◆ enu_debug_limlist_save()

cpl_error_code enu_debug_limlist_save ( const int  debug,
const located_imagelist *  limlist,
const char *  nameroot,
const char *  recipename,
cpl_frameset *  frameset,
const cpl_parameterlist *  parlist,
const cpl_frameset *  used 
)

Save a list of intermediate image results for use in debugging.

Parameters
debugTrue if the debug file are to be written
limlistThe list of images to be written
namerootThe preface added to the filename associated with each image
recipenameThe recipe name
framesetThe list of input frames for the recipe
parlistThe list of input parameters
usedThe list of raw/calibration frames used for this product
Returns
CPL_ERROR_NONE if all goes well, otherwise a cpl error code

Definition at line 1435 of file eris_nix_utils.c.

References enu_dfs_save_limage(), and eris_check_error_code().

Referenced by eris_nix_scired_skysub().

◆ enu_flat_save()

cpl_error_code enu_flat_save ( const char *  pro_catg,
const hdrl_image *  flat,
const cpl_image *  confidence,
const cpl_mask *  cold_bpm,
cpl_frameset *  frameset,
const cpl_parameterlist *  parlist,
const char *  filename,
const char *  recipe_name,
const cpl_propertylist *  qclog 
)

Save a flatfield result.

Parameters
pro_catgThe value of the ESO.PRO.CATG keyword
flatThe flatfield result
confidenceThe confidence array
cold_bpmThe cold pixel mask, may be NULL
framesetThe list of input frames for the recipe
parlistThe list of input parameters
filenameThe name of the output file
recipe_nameThe recipe name
Returns
CPL_ERROR_NONE if all goes well, otherwise an error code

Definition at line 1525 of file eris_nix_utils.c.

References enu_dfs_save_himage(), enu_mef_extension_list_delete(), enu_mef_extension_list_new(), enu_mef_new_image(), enu_mef_new_mask(), eris_check_error_code(), hdrl_image_get_mean(), hdrl_image_get_median(), and hdrl_image_get_stdev().

◆ enu_get_airmass()

double enu_get_airmass ( const cpl_propertylist *  plist)

Get the mean airmass of an observation.

Parameters
plistThe observation file propertylist
Returns
The airmass

The function returns the observation airmass. For NACO files this is read from keyword AIRMASS, for NIX it is the mean of keywords ESO.TEL.AIRM.START and ESO.TEL.AIRM.END.

If none of these keywords is defined it will return 0 and set an error code.

If an error is set on entry, the routine will return 0 immediately.

Definition at line 1636 of file eris_nix_utils.c.

References eris_check_error_code().

◆ enu_get_det_mode()

const char * enu_get_det_mode ( const cpl_propertylist *  plist)

Get the detector mode of an integration.

Parameters
plistThe observation file propertylist
Returns
The DIT

The function returns the integration detector mode. For NACO files this is read from keyword ESO DET NCORRS NAME, for NIX from ESO DET READ CURNAME.

If a problem occurs the function will return NULL and with an error code set. If an error is set on entry, the routine will return NULL immediately.

Definition at line 1860 of file eris_nix_utils.c.

References eris_check_error_code().

◆ enu_get_dit()

double enu_get_dit ( const cpl_propertylist *  plist)

Get the DIT of an integration.

Parameters
plistThe observation file propertylist
Returns
The DIT

The function returns the integration DIT. For NACO files this is read from keyword ESO DET DIT, for NIX from ESO DET SEQ1 DIT.

If a problem occurs the function will return 0 and with an error code set. If an error is set on entry, the routine will return 0 immediately.

Definition at line 1829 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by eris_nix_scired_hdrl_stack().

◆ enu_get_filter()

const char * enu_get_filter ( const cpl_propertylist *  plist)

Get the filter used in an observation.

Parameters
plistThe observation file propertylist
Returns
The filter name

The function returns the observation filter. This is read from keyword FILTER, if present. If not, for NACO files it is read from keywords ESO.INS.OPTI4 | ESO.INS.OPTI5.NAME | ESO.INS.OPTI6.NAME, or for NIX from ESO.INS2.NXFW.NAME.

If an error occurs or the information cannot be found, then an error will be set , and NULL returned.

If an error is set on entry, the routine will return NULL immediately.

Definition at line 1896 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_dfs_setup_product_header(), and enu_load_limage_from_frame().

◆ enu_get_filter_wavelength()

double enu_get_filter_wavelength ( const char *  filter)

Get the effective wavelength of a filter.

Parameters
filterThe name of the filter
Returns
The filter wavelength

The function returns the wavelength of the filter.

If an error occurs or the information cannot be found, then an error will be set , and 1.0 returned.

If an error is set on entry, the routine will return 1.0 immediately.

Definition at line 1947 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_load_limage_from_frame().

◆ enu_get_license()

const char * enu_get_license ( void  )

Get the pipeline copyright and license.

Returns
The copyright and license string

The function returns a pointer to the statically allocated license string. This string should not be modified using the returned pointer.

Definition at line 2004 of file eris_nix_utils.c.

◆ enu_get_ra_dec()

cpl_error_code enu_get_ra_dec ( const cpl_wcs *  wcs,
double *  ra,
double *  dec 
)

Get RA and Dec at centre of image with given wcs.

Returns
A CPL error code, CPL_ERROR_NONE if all goes well

The function returns the RA and Dec at the axis mid-point of the given wcs.

Definition at line 2037 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by eris_nix_scired_cal_wcs(), eris_nix_scired_hdrl_stack(), and eris_nix_scired_skysub().

◆ enu_get_rcore_and_mesh_size()

cpl_error_code enu_get_rcore_and_mesh_size ( const char *  context,
const cpl_parameterlist *  parlist,
const cpl_propertylist *  plist,
double *  obj_core_radius,
int *  bkg_mesh_size 
)

Get catalogue core-radius and mesh-size appropriate to AO mode.

Parameters
contextinput recipe context (depends on recipe name)
parlistinput recipe parameters
plistthe observation file propertylist
obj_core_radiusaddress of double to contain value
bkg_mesh_sizeaddress of into to contain value
Returns
CPL_ERROR_NONE if all goes well, otherwise an error code

If parlist parameter ao-params is "auto" the routine will put values into core_radius and mesh_size that are appropriate to the AO mode in property ESO.OBS.AOMODE.

If ao-params is "user" then the routine will read these values from parlist parameters.

If an error is set on entry, the routine will return immediately.

Definition at line 1691 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by eris_nix_scired_cal_wcs(), and eris_nix_scired_hdrl_stack().

◆ enu_get_tel_alt()

double enu_get_tel_alt ( const cpl_propertylist *  plist)

Get telescope altitude of an observation.

Parameters
plistThe observation file propertylist
Returns
The airmass

The function returns the telescope altitide. If the keyword is defined it will return 0 and set an error code.

If an error is set on entry, the routine will return 0 immediately.

Definition at line 1799 of file eris_nix_utils.c.

References eris_check_error_code().

◆ enu_get_window_info()

cpl_error_code enu_get_window_info ( cpl_size *  nx,
cpl_size *  ny,
int *  rot,
cpl_size *  strx,
cpl_size *  stry,
cpl_size *  nx_chip,
cpl_size *  ny_chip,
cpl_boolean *  windowed,
const cpl_propertylist *  plist 
)

Get the detector 'window' information.

Parameters
nxPointer to variable for window nx
nyPointer to variable for window ny
rotPointer to variable for window rotation
strxPointer to variable for window x start index
stryPointer to variable for window y start index
nx_chipPointer to variable for chip nx
ny_chipPointer to variable for chip ny
windowedCPL_FALSE if whole chip used, CPL_TRUE if windowed
plistThe observation file propertylist
Returns
A CPL error code, CPL_ERROR_NONE if all goes well

The function fills variables with information on the detector windowing used, read from the given parameter list. Works for both ERIS and NACO-style keywords.

Definition at line 2092 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_basic_calibrate_himage(), and enu_remove_read_offsets().

◆ enu_hdrl_catalogue_result_duplicate()

hdrl_catalogue_result * enu_hdrl_catalogue_result_duplicate ( const hdrl_catalogue_result *  target)

Return a deep copy of the given hdrl_catalogue_result object.

Parameters
targetThe structure to be copied
Returns
A copy of the target hdrl_catalogue_result

Definition at line 2190 of file eris_nix_utils.c.

Referenced by enu_located_image_duplicate().

◆ enu_himage_load_from_fits()

cpl_error_code enu_himage_load_from_fits ( const char *  filename,
hdrl_image **  result,
mef_extension_list **  mef_extensions,
cpl_propertylist **  plist 
)

Load an hdrl_image from a multi-extension FITS file.

Parameters
filenameThe name of the file to be loaded
resultThe loaded himage
mef_extensionsA list with data from any excess FITS extensions found
plistThe property list from the primary FITS HDU
Returns
CPL_ERROR_NONE if all goes well, otherwise an error code

The function loads an hdrl_image from a multi-extension FITS file.

Definition at line 2218 of file eris_nix_utils.c.

References enu_mef_extension_list_delete(), enu_mef_extension_list_new(), enu_mef_new_image(), enu_mef_new_mask(), enu_mef_new_table(), eris_check_error_code(), hdrl_image_create(), and hdrl_image_delete().

Referenced by en_master_dark_load_from_frameset().

◆ enu_limlist_load_from_frameset()

located_imagelist * enu_limlist_load_from_frameset ( cpl_frameset *  frameset,
const char *  tag,
cpl_frameset *  used 
)

Load tagged data from a frameset into a located_imagelist.

Parameters
framesetA frame set
tagThe frame tag to look for
usedThe list of raw/calibration frames used for this product
Returns
The filled located_imagelist

The function returns a pointer to a located_imagelist structure whose components have been filled from the given frameset.

Definition at line 3168 of file eris_nix_utils.c.

References enu_load_limage_from_frame(), enu_located_imagelist_delete(), enu_located_imagelist_insert(), enu_located_imagelist_new(), enu_mef_extension_list_delete(), and eris_check_error_code().

Referenced by eris_nix_scired_cal_phot(), eris_nix_scired_cal_wcs(), eris_nix_scired_hdrl_stack(), and eris_nix_scired_skysub().

◆ enu_load_component()

cpl_image * enu_load_component ( mef_extension *  mef,
const char *  dps_name,
const char *  hduclas1,
const char *  hduclas2 
)

Load data from a MEF component of specified type.

Parameters
mefThe mef_extension whose content is to be loaded
dps_nameThe name of the ESO Data Product Standard element, e.g. "SCIDATA"
hduclas1The check value for keyword HDUCLAS1
hduclas2The check value for keyword HDUCLAS2
Returns
A cpl_image containing the data

The function removes the cpl_image from the input, thus passes ownership of the image to the caller.

Definition at line 3506 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_load_limage_from_frame().

◆ enu_load_limage_from_frame()

located_image * enu_load_limage_from_frame ( const cpl_frame *  frame,
cpl_image **  pcopyconf,
const cpl_boolean  collapse_cube 
)

Load components of a located_image from a frame.

Parameters
frameThe frame containing the FITS file
pcopyconfA confidence image to use and reset, or NULL
collapse_cubeuser switch to collapse the input data cube format
Returns
located_image containing the result

The function loads a located_image structure from the components of the FITS file referenced in the given frame.

If the input confidence image is provided and has the right size, then it is inserted into the created object and set to NULL on return.

Definition at line 2415 of file eris_nix_utils.c.

References enu_get_filter(), enu_get_filter_wavelength(), enu_load_component(), enu_load_mef_components(), enu_located_image_delete(), enu_located_image_new(), enu_mef_extension_list_delete(), eris_check_error_code(), hdrl_image_create(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), hdrl_imagelist_collapse_mean(), hdrl_imagelist_collapse_median(), hdrl_imagelist_collapse_weighted_mean(), hdrl_imagelist_create(), hdrl_imagelist_get_size_x(), and hdrl_imagelist_get_size_y().

Referenced by enu_limlist_load_from_frameset(), and eris_nix_scired_cal_det().

◆ enu_load_mef_components()

mef_extension_list * enu_load_mef_components ( const char *  filename,
cpl_propertylist **  plist 
)

Load components of a multi-extension FITS file.

Parameters
filenameThe name of the MEF file
plistProperty list of keywords from the primary HDU
Returns
mef_extension_list containing components of file

The function loads the components from a multi-extension FITS file. Extensions are indexed 0 to n, corresponding to HDUs 1 to n+1.

Definition at line 2918 of file eris_nix_utils.c.

References enu_mef_extension_delete(), enu_mef_extension_list_delete(), enu_mef_extension_list_new(), enu_mef_new_image(), enu_mef_new_mask(), enu_mef_new_table(), and eris_check_error_code().

Referenced by enu_load_limage_from_frame().

◆ enu_located_image_delete()

void enu_located_image_delete ( located_image *  limage)

Delete a located_image and its contents.

The function deletes the contents of a located_image and then the located_image itself.

Definition at line 3000 of file eris_nix_utils.c.

References hdrl_catalogue_result_delete(), hdrl_image_delete(), and hdrl_imagelist_delete().

Referenced by enu_load_limage_from_frame(), enu_located_imagelist_delete(), eris_nix_scired_cal_det(), and eris_nix_scired_hdrl_stack().

◆ enu_located_image_duplicate()

located_image * enu_located_image_duplicate ( const located_image *  limage)

Make a deep copy of a located_image and its contents.

Parameters
limageThe located_image to copy
Returns
A duplicate located_image

The function returns a copy of the given located image.

Definition at line 3029 of file eris_nix_utils.c.

References enu_hdrl_catalogue_result_duplicate(), enu_located_image_new(), eris_check_error_code(), hdrl_image_duplicate(), and hdrl_imagelist_duplicate().

Referenced by enu_located_imagelist_duplicate().

◆ enu_located_image_new()

located_image * enu_located_image_new ( hdrl_image *  himage,
hdrl_imagelist *  himagelist,
cpl_image *  confidence,
hdrl_image *  bkg,
cpl_image *  bkg_confidence,
cpl_propertylist *  plist,
hdrl_catalogue_result *  objects,
cpl_mask *  object_mask,
hdrl_catalogue_result *  wcs,
hdrl_catalogue_result *  photom,
cpl_frame *  frame 
)

Create a located_image structure and initialise the contents.

Parameters
himageAn hdrl_image with 2d data or
himagelistAn hdrl_imagelist with cube data
confidenceThe confidence map
bkgThe hdrl_image with the associated background
bkg_confidenceThe confidence map of the background
plistThe associated property_list
objectsstruct with objects catalogued in image
object_maskA mask to blot out the catalogued objects
wcsstruct with catalogue of matched wcs calibrators
photomstruct with catalogue of matched photometric calibrators
frameFrame associated with image
Returns
The new located image structure

The function returns a pointer to a located_image structure with components initialised to the call parameters. The located_image becomes responsible for deleting the components.

Definition at line 3121 of file eris_nix_utils.c.

Referenced by enu_load_limage_from_frame(), enu_located_image_duplicate(), enu_stack(), and eris_nix_scired_hdrl_stack().

◆ enu_located_imagelist_delete()

void enu_located_imagelist_delete ( located_imagelist *  limlist)

Delete a located_imagelist and its contents.

Parameters
limlistThe located_imagelist to delete

The function deletes the contents of a located_imagelist and then the located_imagelist itself.

Definition at line 3555 of file eris_nix_utils.c.

References enu_located_image_delete().

Referenced by enu_limlist_load_from_frameset(), eris_nix_scired_cal_phot(), eris_nix_scired_cal_wcs(), eris_nix_scired_hdrl_stack(), and eris_nix_scired_skysub().

◆ enu_located_imagelist_duplicate()

located_imagelist * enu_located_imagelist_duplicate ( const located_imagelist *  limlist)

Make a deep copy of a located_imagelist and its contents.

Parameters
limlistThe located_imagelist to be copied
Returns
A copy of the located_imagelist

The function returns a duplicate of the given located_imagelist.

Definition at line 3577 of file eris_nix_utils.c.

References enu_located_image_duplicate(), enu_located_imagelist_insert(), and enu_located_imagelist_new().

◆ enu_located_imagelist_insert()

cpl_error_code enu_located_imagelist_insert ( located_imagelist *  limlist,
located_image *  limage,
cpl_size  position 
)

Insert a located_image at a specified point in a located_imagelist.

Parameters
limlistThe destination list
limageThe image to insert
positionThe insertion position (0 based)
Returns
CPL_ERROR_NONE if all goes well, a cpl error code otherwise

The function inserts a located_image at a specified position in a located_imagelist.

Definition at line 3606 of file eris_nix_utils.c.

Referenced by enu_limlist_load_from_frameset(), and enu_located_imagelist_duplicate().

◆ enu_located_imagelist_new()

located_imagelist * enu_located_imagelist_new ( cpl_size  size)

Return a pointer to a new located_imagelist.

Parameters
sizeThe number of images that the list is to hold
Returns
The pointer to the new located_imagelist

The function returns a pointer to a new located_imagelist struct with space to hold the specified number of located_images.

Definition at line 3633 of file eris_nix_utils.c.

Referenced by enu_limlist_load_from_frameset(), and enu_located_imagelist_duplicate().

◆ enu_mef_extension_delete()

void enu_mef_extension_delete ( mef_extension *  mef)

Delete a mef_extension and its contents.

Parameters
mefThe extension to delete

The function deletes the contents of a mef_extension and then the mef_extension itself.

Definition at line 3657 of file eris_nix_utils.c.

Referenced by enu_load_mef_components(), and enu_mef_extension_list_delete().

◆ enu_mef_extension_list_delete()

void enu_mef_extension_list_delete ( mef_extension_list *  list)

Delete a mef_extension_list and its contents.

Parameters
listThe mef_extension_list to delete

The function deletes the contents of a mef_extension_list and then the mef_extension_list itself.

Definition at line 3689 of file eris_nix_utils.c.

References enu_mef_extension_delete().

Referenced by en_master_dark_load_from_frameset(), enlu_trace_save(), enu_dfs_save_limage(), enu_flat_save(), enu_himage_load_from_fits(), enu_limlist_load_from_frameset(), enu_load_limage_from_frame(), and enu_load_mef_components().

◆ enu_mef_extension_list_get_mask()

cpl_mask * enu_mef_extension_list_get_mask ( mef_extension_list *  meflist,
const char *  target 
)

Get a cpl_mask from a named mef_extension in a list.

Parameters
meflistThe list of extensions
targetThe name of the extension containing the mask
Returns
Pointer to the cpl_mask

The searches a mef_extension_list for a named mef_extension, and returns the cpl_mask it contains.

Definition at line 3713 of file eris_nix_utils.c.

Referenced by en_master_dark_load_from_frameset().

◆ enu_mef_extension_list_new()

mef_extension_list * enu_mef_extension_list_new ( cpl_size  size)

Construct a new mef_extension_list.

Parameters
sizeThe maximum number of extensions the list can hold
Returns
A pointer to the new mef_extension_list

The function returns a pointer to a new mef_extension_list struct with space to hold the specified number of mef_extension structs.

Definition at line 3753 of file eris_nix_utils.c.

Referenced by enlu_trace_save(), enu_dfs_save_limage(), enu_flat_save(), enu_himage_load_from_fits(), and enu_load_mef_components().

◆ enu_mef_extension_save()

cpl_error_code enu_mef_extension_save ( const mef_extension *  mef,
const char *  filename,
const cpl_propertylist *  plist,
unsigned  mode 
)

Save a mef_extension struct to FITS file.

Parameters
mefThe mef_extension to save
filenameThe name of the file
plistThe propertylist to save
modeThe desired output options
Returns
CPL_ERROR_NONE on success, a cpl error code otherwise

The function writes the mef extension to the named multi-extension FITS file.

Definition at line 3938 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_dfs_save_himage().

◆ enu_mef_new_image()

mef_extension * enu_mef_new_image ( const char *  name,
const cpl_image *  data,
const cpl_propertylist *  plist 
)

Create a mef_extension to hold a cpl_image.

Parameters
nameThe name to give the extension
dataThe cpl_image to place in the extension
plistThe propertylist to place in the extension
Returns
The new mef_extension

The function returns a pointer to a mef_extension structure holding a copy of the cpl_image.

The mef_extension and its contents should be deleted by a call to enu_mef_extension_delete.

Definition at line 3784 of file eris_nix_utils.c.

Referenced by enlu_trace_save(), enu_dfs_save_limage(), enu_flat_save(), enu_himage_load_from_fits(), and enu_load_mef_components().

◆ enu_mef_new_mask()

mef_extension * enu_mef_new_mask ( const char *  name,
const cpl_mask *  data,
const cpl_propertylist *  plist 
)

Create a mef_extension struct holding a cpl_mask.

Parameters
nameThe name to give the extension
dataThe cpl_mask to place in the extension
plistThe propertylist to place in the extension
Returns
The new mef_extension struct

The function returns a pointer to a mef_extension structure holding a copy of the cpl_mask.

The mef_extension and its contents should be deleted by a call to enu_mef_extension_delete.

Definition at line 3823 of file eris_nix_utils.c.

Referenced by enu_flat_save(), enu_himage_load_from_fits(), and enu_load_mef_components().

◆ enu_mef_new_table()

mef_extension * enu_mef_new_table ( const char *  name,
const cpl_table *  table,
const cpl_propertylist *  plist 
)

Create a mef_extension struct holding a cpl_table.

Parameters
nameThe name to give the extension
tableThe cpl_table to place in the extension
plistThe propertylist to place in the extension
Returns
The new mef_extension struct

The function returns a pointer to a mef_extension structure holding a copy of the cpl_table.

The mef_extension and its contents should be deleted by a call to enu_mef_extension_delete.

Definition at line 3862 of file eris_nix_utils.c.

Referenced by enlu_trace_save(), enu_himage_load_from_fits(), and enu_load_mef_components().

◆ enu_mef_new_vector()

mef_extension * enu_mef_new_vector ( const char *  name,
const cpl_vector *  vector,
const cpl_propertylist *  plist 
)

Create a mef_extension struct holding a cpl_vector.

Parameters
nameThe name to give the extension
vectorThe cpl_vector to place in the extension
plistThe propertylist to place in the extension
Returns
The new mef_extension struct

The function returns a pointer to a mef_extension structure holding a copy of the cpl_vector.

The mef_extension and its contents should be deleted by a call to enu_mef_extension_delete.

Definition at line 3901 of file eris_nix_utils.c.

Referenced by enlu_trace_save().

◆ enu_modify_CD_matrix()

cpl_error_code enu_modify_CD_matrix ( located_image *  limage,
const cpl_table *  refine_wcs 
)

Update the CD matrix to reduce image distortion and rotation.

Parameters
limageThe jitter whose wcs is to be modified
refine_wcsThe table holding corrected wcs info, or NULL
Returns
A cpl_error_code, CPL_ERROR_NONE if all is well.

Updates the CD matrix entries in the FITS wcs to reduce image distortion and rotation.

Definition at line 4310 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_basic_calibrate().

◆ enu_normalise_confidence()

cpl_error_code enu_normalise_confidence ( cpl_image *  confidence)

Normalise confidence array so that mean of good pixels is 100.

Parameters
confidenceThe confidence array
Returns
CPL_ERROR_NONE on success, otherwise a cpl error code

Fixes problmes in confidence array; bad pixels, negative pixels set to 0. Normalises non-zero values to 100.

Definition at line 4388 of file eris_nix_utils.c.

References eris_check_error_code().

Referenced by enu_remove_read_offsets(), enu_sky_backgrounds(), enu_sky_subtract_limlist(), and eris_nix_scired_hdrl_stack().

◆ enu_opm_limlist()

cpl_error_code enu_opm_limlist ( const int  obj_min_pixels,
const double  obj_threshold,
const int  bkg_mesh_size,
const double  bkg_smooth_fwhm,
located_imagelist *  limlist 
)

Calculate object masks for images in a located_imagelist.

Parameters
obj_min_pixelsThe minimum allowable size of an object
obj_thresholdThe detection threshold in sigma above sky
bkg_mesh_sizeThe smoothing box size for background map estimation
bkg_smooth_fwhmThe FWHM of the smoothing kernel in the detection algorithm
limlistThe list of images requiring object masks
Returns
CPL error code, CPL_ERROR_NONE on success

The function uses CASU routines to calculate object masks for images in a located_imagelist.

Definition at line 4036 of file eris_nix_utils.c.

References encu_limlist_to_casu_fits(), and eris_check_error_code().

◆ enu_opm_lss_limlist()

cpl_error_code enu_opm_lss_limlist ( located_imagelist *  limlist,
const int  nsigma_cut 
)

Calculate object masks for LSS images in a located_imagelist.

Parameters
limlistThe list of images to be masked
nsigma_cutTBD
Returns
CPL error code, CPL_ERROR_NONE on success.

The function calculates object masks for LSS images in a located_imagelist. The method used is to collapse the spectrum in the dispersion direction, then look for objects in the resulting vector.

This tends to underestimate the object width in cases where the object is brighter at one end of the spectrum - could try a 2d thresholding as well?

Definition at line 4105 of file eris_nix_utils.c.

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

◆ enu_raw_flats_qc()

cpl_propertylist * enu_raw_flats_qc ( located_imagelist *  lamp_on_limlist,
cpl_mask *  bp_map_nl_mask,
const cpl_parameterlist *  parlist,
const char *  context,
const double  threshold_pos,
const cpl_boolean  verbose,
const cpl_boolean  rescale_by_dit 
)

Compute QC on input raw flats.

Parameters
lamp_on_limlistInput raw data
bp_map_nl_maskinput bad pixel mask (BP_MAP_NL)
parlistinput recipe parameters
contextinput recipe context (depends on recipe name)
threshold_posinput positive threshold to flag pixels above it
verboseinput parameter to log QC on each input frame
Returns
cpl_propertylist* with the computed QC params

Definition at line 5287 of file eris_nix_utils.c.

References eris_check_error_code(), hdrl_image_get_image(), hdrl_image_get_mask(), and hdrl_image_reject_from_mask().

◆ enu_remove_read_offsets()

cpl_error_code enu_remove_read_offsets ( hdrl_image *  himage,
const cpl_propertylist *  plist,
cpl_image *  confidence,
const int  set_confidence 
)

Function to remove read offsets from an himage and set blank pixels

Parameters
himageThe hdrl_image to have offsets removed
plistThe propertylist associated with the image
confidenceThe confidence array associated with the image or NULL
set_confidenceIf true set confidence of blank areas to 0
Returns
CPL_ERROR_NONE if all goes well, otherwise an error code

There is a small offset on results depending on the readout channel of the detector. These 'channels' are 64 pixel wide columns over the detector.

The 4 pixels at the edge of the detector do not detect photons. Their values can be used to estimate the readout channel offset if they fall in the readout window.

This method estimates the offset for each readout channel and subtracts it from the results for that channel. The offset for each channel is the average of the edge pixels in the window for that channel, and the error on the offset is their standard deviation. There do appear to be some hot pixels in the edges so a simple sigma-rejection of outliers is performed before calculating the results.

A border 4 pixels wide around the detector edge is set to 'invalid' where this falls inside the detector readout window.

For the commissioning data there was a DIT sequencing problem that meant the bottom borde rows were corrupted for short DITs. See https://jira.eso.org/browse/PIPE-10417. This was fixed on about 1-Mar-2023 so the method depends on the date of the observation, MJD-OBS before of after 60004.

Definition at line 4459 of file eris_nix_utils.c.

References enu_get_window_info(), enu_normalise_confidence(), eris_check_error_code(), hdrl_image_get_error(), hdrl_image_get_image(), and hdrl_image_reject().

Referenced by enu_basic_calibrate_himage().

◆ enu_repreface()

char * enu_repreface ( const char *  filename,
const char *  preface 
)

Preface a raw filename with a string.

Parameters
filenameThe filename to be re-prefaced
prefaceThe new preface
Returns

Definition at line 4718 of file eris_nix_utils.c.

Referenced by enu_dfs_save_catalogue(), eris_nix_scired_cal_wcs(), eris_nix_scired_hdrl_stack(), and eris_nix_scired_skysub().

◆ enu_sky_backgrounds()

cpl_error_code enu_sky_backgrounds ( const char *  method,
const char *  select_method,
const double  timerange,
const located_imagelist *  target_list,
const located_imagelist *  sky_list,
const cpl_size  x_probe,
const cpl_size  y_probe,
hdrl_imagelist **  sky_himagelist,
cpl_imagelist **  sky_confidence_list 
)

Get sky backgrounds for a list of target images.

Parameters
methodMethod for calculating background from selected sky images
select_methodMethod for selecting sky images relevant to target
timerangeFor method "bracket", the width of the time window
target_listList of target images requiring sky backgrounds
sky_listList of candidate sky images for calculating backgrounds
x_probex-coord of pixel to print debug info
y_probey-coord of pixel to print debug info
sky_himagelistReturned list of sky background estimates
sky_confidence_listConfidence maps for sky backgrounds
Returns
CPL_ERROR_NONE on success, otherwise a cpl error code

Definition at line 4756 of file eris_nix_utils.c.

References enu_bracket_skys(), enu_normalise_confidence(), eris_check_error_code(), hdrl_image_create(), hdrl_image_delete(), hdrl_image_duplicate(), hdrl_image_get_image(), hdrl_image_get_median(), hdrl_image_get_pixel(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), hdrl_imagelist_collapse(), hdrl_imagelist_delete(), hdrl_imagelist_get_size(), hdrl_imagelist_new(), and hdrl_imagelist_set().

Referenced by enu_sky_subtract_limlist().

◆ enu_sky_subtract_limlist()

cpl_error_code enu_sky_subtract_limlist ( const char *  method,
const char *  select_method,
const double  timerange,
const located_imagelist *  sky_data,
const cpl_size  x_probe,
const cpl_size  y_probe,
located_imagelist *  target_data 
)

Estimate and subtract sky backgrounds for a list of target images.

Parameters
methodMethod for calculating background from selected sky images
select_methodMethod for selecting sky images relevant to target
timerangeFor method "bracket", the width of the time window
sky_dataList of candidate sky images for calculating backgrounds
x_probex-coord of pixel to print debug info
y_probey-coord of pixel to print debug info
target_dataList of target images requiring sky background subtraction
Returns
CPL_ERROR_NONE on success, otherwise a cpl error code

Definition at line 5108 of file eris_nix_utils.c.

References enu_normalise_confidence(), enu_sky_backgrounds(), hdrl_image_duplicate(), hdrl_image_get_pixel(), hdrl_image_get_size_x(), hdrl_image_get_size_y(), hdrl_image_sub_image(), hdrl_imagelist_delete(), hdrl_imagelist_get(), and hdrl_imagelist_get_const().

Referenced by eris_nix_scired_skysub().

◆ enu_stack()

cpl_error_code enu_stack ( located_imagelist *  limages,
const double  stk_lthr,
const double  stk_hthr,
const char *  stk_method,
const int  stk_fast,
located_image **  result 
)

Stack a set of images.

Parameters
limagesList of images to be stacked
stk_lthrThe lower rejection threshold in call to casu_imstack
stk_hthrThe upper rejection threshold in call to casu_imstack
stk_methodThe interpolation method in call to casu_imstack
stk_fastThe 'fast' parameter in call to casu_imstack
resultThe stacked result image
Returns
CPL_ERROR_NONE on success, otherwise a cpl error code

Definition at line 5043 of file eris_nix_utils.c.

References encu_limlist_to_casu_fits(), enu_located_image_new(), and hdrl_image_create().

◆ eris_nix_get_badpix_qc_from_ima()

cpl_error_code eris_nix_get_badpix_qc_from_ima ( const master_bpm *  mbad_pix_map,
cpl_propertylist *  qc_list,
const char *  prefix 
)

Compute QC on input master bpm.

Parameters
mbad_pix_mapinput bad pixel mask
qc_listoutput qc parameter list
prefixinput prefix (depends on recipe name)
Returns
cpl_propertylist* with the computed QC params

Definition at line 5249 of file eris_nix_utils.c.

References fraction().