X-shooter Pipeline Reference Manual 3.8.15
xsh_detmon_lg.c File Reference
#include <cpl.h>
#include <cpl_fft.h>
#include "hdrl.h"
#include "xsh_detmon.h"
#include "xsh_detmon_utils.h"
#include "xsh_detmon_lg.h"
#include "xsh_detmon_lg_impl.h"
#include "xsh_detmon_dfs.h"
#include "xsh_dfs.h"
#include "xsh_ksigma_clip.h"
#include "irplib_utils.h"
#include "irplib_hist.h"
#include <complex.h>
#include <math.h>
#include <string.h>
#include <assert.h>

Go to the source code of this file.

enum  _FPN_METHOD { FPN_UNKNOWN , FPN_HISTOGRAM , FPN_SMOOTH }
 
typedef enum _FPN_METHOD FPN_METHOD
 
struct {
   const char *   method
 
   int   order
 
   double   kappa
 
   int   niter
 
   int   threshold_min
 
   int   threshold_max
 
   int   llx
 
   int   lly
 
   int   urx
 
   int   ury
 
   int   ref_level
 
   int   threshold
 
   int   m
 
   int   n
 
   int   llx1
 
   int   lly1
 
   int   urx1
 
   int   ury1
 
   int   llx2
 
   int   lly2
 
   int   urx2
 
   int   ury2
 
   int   llx3
 
   int   lly3
 
   int   urx3
 
   int   ury3
 
   int   llx4
 
   int   lly4
 
   int   urx4
 
   int   ury4
 
   int   llx5
 
   int   lly5
 
   int   urx5
 
   int   ury5
 
   int   nx
 
   int   ny
 
   cpl_boolean   wholechip
 
   cpl_boolean   autocorr
 
   cpl_boolean   intermediate
 
   cpl_boolean   collapse
 
   cpl_boolean   rescale
 
   cpl_boolean   pix2pix
 
   cpl_boolean   bpmbin
 
   int   filter
 
   double   tolerance
 
   cpl_boolean   pafgen
 
   const char *   pafname
 
   double   cr
 
   int   exts
 
   int   nb_extensions
 
   double   lamp_stability
 
   cpl_boolean   lamp_ok
 
   int(*   load_fset )(const cpl_frameset *,
       cpl_type, cpl_imagelist *)
 
   cpl_imagelist *(*   load_fset_wrp )(const cpl_frameset *,
       cpl_type, int)
 
   FPN_METHOD   fpn_method
 
   int   fpn_smooth
 
   double   saturation_limit
 
   double   gain_threshold
 
   cpl_boolean   split_coeffs
 
xsh_detmon_lg_config
 
static cpl_error_code xsh_detmon_lg_retrieve_parlist (const char *pipeline_name, const char *recipe_name, const cpl_parameterlist *parlist, cpl_boolean opt_nir)
 Parlist extraction and copy to global struct variable.
 
static cpl_error_code xsh_detmon_lg_split_onoff (const cpl_frameset *cur_fset, cpl_frameset *cur_fset_on, cpl_frameset *cur_fset_off, const char *tag_on, const char *tag_off)
 Split the input frameset into two sub-framesets (ON and OFF)
 
static cpl_error_code xsh_detmon_lg_reduce (const cpl_frameset *set_on, const cpl_frameset *set_off, int *index_on, int *index_off, double *exptime_on, double *exptime_off, int *next_index_on, int *next_index_off, cpl_imagelist **coeffs_ptr, cpl_table *gain_table, cpl_table *linear_table, cpl_image **bpm_ptr, cpl_imagelist *autocorr_images, cpl_imagelist *diff_flats, cpl_propertylist *gaint_qclist, cpl_propertylist *lint_qclist, cpl_propertylist *linc_qclist, cpl_propertylist *bpm_qclist, int(*load_fset)(const cpl_frameset *, cpl_type, cpl_imagelist *), const cpl_boolean opt_nir, int whichext)
 Apply linearity and gain reduction algorithms.
 
static cpl_error_code xsh_detmon_lin_table_fill_row (cpl_table *lin_table, double c_dit, cpl_imagelist *linearity_inputs, const cpl_imagelist *ons, const cpl_imagelist *offs, int llx, int lly, int urx, int ury, const int pos, const int nskip, unsigned mode)
 Fill i-th row in Linearity Table: DIT or EXPTIME, MEAN, MED, MEAN_DIT, MED_DIT.
 
static cpl_error_code xsh_detmon_gain_table_fill_row (cpl_table *gain_table, double c_dit, int c_ndit, cpl_imagelist *autocorr_images, cpl_imagelist *diff_flats, const cpl_imagelist *ons, const cpl_imagelist *offs, double kappa, int nclip, int llx, int lly, int urx, int ury, int m, int n, double saturation_limit, double gain_threshold, const int pos, unsigned mode, int *rows_gain_affected)
 Operate on input ON and OFF images related to gain Computes all quantities needed to determine the gain:
 
static cpl_error_code xsh_detmon_check_saturation_on_pair (cpl_imagelist *autocorr_images, cpl_imagelist *diff_flats, const cpl_imagelist *ons, const cpl_imagelist *offs, double kappa, int nclip, int llx, int lly, int urx, int ury, double saturation_limit, const int pos, unsigned mode, int *rows_linear_affected)
 Operate on input ON and OFF images related to gain Computes all quantities needed to determine the gain:
 
static cpl_error_code xsh_detmon_lg_save (const cpl_parameterlist *parlist, cpl_frameset *frameset, const char *recipe_name, const char *pipeline_name, const char *pafregexp, const cpl_propertylist *pro_lintbl, const cpl_propertylist *pro_gaintbl, const cpl_propertylist *pro_coeffscube, const cpl_propertylist *pro_bpm, const cpl_propertylist *pro_corr, const cpl_propertylist *pro_diff, const char *package, cpl_imagelist *coeffs, cpl_table *gain_table, cpl_table *linear_table, cpl_image *bpms, cpl_imagelist *autocorr_images, cpl_imagelist *diff_flats, cpl_propertylist *gaint_qclist, cpl_propertylist *lint_qclist, cpl_propertylist *linc_qclist, cpl_propertylist *bpm_qclist, const int flag_sets, const int which_set, const cpl_frameset *usedframes, int whichext)
 Save all products.
 
static cpl_error_code xsh_detmon_lg_qc_ptc (const cpl_table *gain_table, cpl_propertylist *qclist, unsigned mode, int rows_in_gain)
 PTC (Photon Transfer Curve) method final computation.
 
static cpl_error_code xsh_detmon_lg_qc_med (const cpl_table *gain_table, cpl_propertylist *qclist, int rows_in_gain)
 MED method final computation. The median and stdev of the column "GAIN", and the median of the column "GAIN_CORR" are computed and corresponding QC keywords are set.
 
static double irplib_pfits_get_dit (const cpl_propertylist *plist)
 Find out the character string associated to the DIT keyword (NIR)
 
static double irplib_pfits_get_dit_opt (const cpl_propertylist *plist)
 Find out the character string associated to the DIT keyword (OPT)
 
static double irplib_pfits_get_prop_double (const cpl_propertylist *plist, const char *prop_name)
 
static cpl_image * xsh_detmon_bpixs (const cpl_imagelist *coeffs, cpl_boolean bpmbin, const double kappa, int *nbpixs)
 Produce bad pixel map according to coefficients' cube.
 
static double xsh_detmon_autocorr_factor (const cpl_image *image, cpl_image **autocorr_image, int m, int n)
 Produce bad pixel map by comparing to coefficients' cube fits to actual intensity values.
 
static cpl_error_code xsh_detmon_opt_contamination (const cpl_imagelist *ons, const cpl_imagelist *offs, unsigned mode, cpl_propertylist *qclist)
 Contamination computation (OPT only)
 
int xsh_detmon_lg_dfs_set_groups (cpl_frameset *set, const char *tag_on, const char *tag_off)
 DFS related function.
 
static cpl_error_code xsh_detmon_lg_reduce_all (const cpl_table *linear_table, cpl_propertylist *gaint_qclist, cpl_propertylist *lint_qclist, cpl_propertylist *linc_qclist, cpl_propertylist *bpm_qclist, cpl_imagelist **coeffs_ptr, cpl_image **bpms_ptr, const cpl_imagelist *linearity_inputs, const cpl_table *gain_table, int which_ext, cpl_boolean opt_nir)
 Final reduction step (after DIT-per-DIT reduction): fit linearity data and determine corresponding QC parameters, determine QC related gain parameters, determine linearity efficiency parameters, determines non linear pixels.
 
static cpl_error_code xsh_detmon_lg_check_defaults (const cpl_image *reference)
 Check and set default values with depend on the inputs.
 
static cpl_error_code xsh_detmon_lg_rescale (cpl_imagelist *to_rescale)
 Rescale of images (one to another level)
 
static cpl_error_code xsh_detmon_lg_reduce_init (cpl_table *gain_table, cpl_table *linear_table, cpl_imagelist **linearity_inputs, const cpl_boolean opt_nir)
 Create columns of product tables and init linearity_inputs.
 
static cpl_error_code xsh_detmon_add_adl_column (cpl_table *table, cpl_boolean opt_nir)
 Compute ADL column of Linearity Table.
 
static cpl_error_code xsh_detmon_lg_lamp_stab (const cpl_frameset *lamps, const cpl_frameset *darks, cpl_boolean opt_nir, int whichext)
 Compute lamp stability.
 
static cpl_error_code xsh_detmon_lg_reduce_dit (const cpl_frameset *set_on, int *index_on, double *exptime_on, const int dit_nb, int *dit_nskip, const cpl_frameset *set_off, int *index_off, double *exptime_off, int *next_on, int *next_off, cpl_table *linear_table, cpl_table *gain_table, cpl_imagelist *linearity_inputs, cpl_propertylist *qclist, cpl_boolean opt_nir, cpl_imagelist *autocorr_images, cpl_imagelist *diff_flats, cpl_imagelist *opt_offs, int whichext, int *rows_linear_affected, int *rows_gain_affected)
 Reduction step to be applied together to frames of same DIT.
 
static cpl_error_code xsh_detmon_lg_core (cpl_frameset *cur_fset_on, cpl_frameset *cur_fset_off, int *index_on, int *index_off, double *exptime_on, double *exptime_off, int whichext, int whichset, const char *recipe_name, const char *pipeline_name, const char *pafregexp, const cpl_propertylist *pro_lintbl, const cpl_propertylist *pro_gaintbl, const cpl_propertylist *pro_coeffscube, const cpl_propertylist *pro_bpm, const cpl_propertylist *pro_corr, const cpl_propertylist *pro_diff, const char *package, int(*load_fset)(const cpl_frameset *, cpl_type, cpl_imagelist *), int nsets, cpl_boolean opt_nir, cpl_frameset *frameset, const cpl_parameterlist *parlist, cpl_frameset *cur_fset)
 Core: Reduction and saving (encapsulated to avoid repetition)
 
static cpl_error_code xsh_detmon_lg_lineff (double *pcoeffs, cpl_propertylist *qclist, int ref_level, int order)
 Linearity effective correction (LIN.EFF) computation.
 
static cpl_error_code xsh_detmon_gain_table_create (cpl_table *, const cpl_boolean)
 
static cpl_error_code xsh_detmon_lin_table_create (cpl_table *, const cpl_boolean)
 
static cpl_vector * xsh_detmon_lg_find_dits (const cpl_vector *, double)
 
static cpl_error_code xsh_detmon_lg_find_dits_ndits (const cpl_vector *exptimes, const cpl_vector *vec_ndits, double tolerance, cpl_vector **diff_dits, cpl_vector **diff_ndits)
 
static cpl_error_code xsh_detmon_fpn_compute (const cpl_frameset *set_on, int *index_on, int last_linear_best, cpl_propertylist *lint_qclist, int llx, int lly, int urx, int ury, double gain, int whichext, FPN_METHOD fpn_method, int smooth_size)
 
static double irplib_fpn_lg (const cpl_image *f1, int *range, double gain, FPN_METHOD fpn_method, int, double *mse)
 
static double irplib_calculate_total_noise (const cpl_image *pimage)
 
static cpl_imagelist * irplib_load_fset_wrp (const cpl_frameset *, cpl_type, int whichext)
 
static cpl_imagelist * irplib_load_fset_wrp_ext (const cpl_frameset *, cpl_type, int)
 
static cpl_error_code irplib_table_create_column (cpl_table *ptable, cpl_propertylist *plist)
 
static cpl_error_code irplib_fill_table_DETWINUIT (cpl_table *ptable, cpl_propertylist *plist, int row)
 
static cpl_error_code xsh_detmon_pair_extract_next (const cpl_frameset *set, int *index, int *next_element, double *dit_array, cpl_frameset **pair, double tolerance)
 
static cpl_error_code xsh_detmon_single_extract_next (const cpl_frameset *set, int *index, int *next_element, double *dit_array, cpl_frameset **pair)
 
static cpl_error_code xsh_detmon_table_fill_invalid (cpl_table *ptable, double code)
 
static void xsh_detmon_lg_add_empty_image (cpl_imagelist *imlist, int pos)
 
static int xsh_detmon_lg_check_before_gain (const cpl_vector *x, const cpl_vector *y)
 
static int irplib_pfits_get_ndit (const cpl_propertylist *plist)
 find out the character string associated to the DIT keyword in a propertylist
 
cpl_error_code hdrldemo_detector_shotnoise_model (const cpl_image *ima_data, const double gain, const double ron, cpl_image **ima_errs)
 compute photon count error in [ADU]
 
static cpl_error_code xsh_detmon_lg_reduce_set (int i, cpl_frameset *frameset, int nsets, const char *tag_on, const char *tag_off, const char *recipe_name, const char *pipeline_name, const char *pafregexp, const cpl_propertylist *pro_lintbl, const cpl_propertylist *pro_gaintbl, const cpl_propertylist *pro_coeffscube, const cpl_propertylist *pro_bpm, const cpl_propertylist *pro_corr, const cpl_propertylist *pro_diff, const char *package, int(*load_fset)(const cpl_frameset *, cpl_type, cpl_imagelist *), const cpl_boolean opt_nir, const cpl_parameterlist *parlist, cpl_size *selection)
 
static double irplib_compute_err (double gain, double ron, double photon_noise)
 
static cpl_error_code xsh_detmon_lg_dfs_save_imagelist (cpl_frameset *frameset, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const cpl_imagelist *coeffs, const char *recipe_name, const cpl_propertylist *mypro_coeffscube, const char *package, const char *name_o)
 
static void irplib_free (char **pointer)
 
cpl_error_code xsh_detmon_lg (cpl_frameset *frameset, const cpl_parameterlist *parlist, const char *tag_on, const char *tag_off, const char *recipe_name, const char *pipeline_name, const char *pafregexp, const cpl_propertylist *pro_lintbl, const cpl_propertylist *pro_gaintbl, const cpl_propertylist *pro_coeffscube, const cpl_propertylist *pro_bpm, const cpl_propertylist *pro_corr, const cpl_propertylist *pro_diff, const char *package, int(*compare)(const cpl_frame *, const cpl_frame *), int(*load_fset)(const cpl_frameset *, cpl_type, cpl_imagelist *), const cpl_boolean opt_nir)
 
cpl_image * xsh_detmon_image_correlate (const cpl_image *image1, const cpl_image *image2, const int m, const int n)
 
cpl_image * xsh_detmon_autocorrelate (const cpl_image *input2, const int m, const int n)
 
cpl_error_code xsh_detmon_lg_fill_parlist_nir_default (cpl_parameterlist *parlist, const char *recipe_name, const char *pipeline_name)
 Parlist filling with NIR required parameters and its default values.
 
cpl_error_code xsh_detmon_lg_fill_parlist_opt_default (cpl_parameterlist *parlist, const char *recipe_name, const char *pipeline_name)
 Parlist filling with OPT required parameters and its default values.
 
cpl_error_code xsh_detmon_lg_fill_parlist_default_mr (cpl_parameterlist *parlist, const char *recipe_name, const char *pipeline_name)
 
cpl_error_code xsh_detmon_lg_fill_parlist_opt_default_mr (cpl_parameterlist *parlist, const char *recipe_name, const char *pipeline_name)
 
cpl_error_code xsh_detmon_lg_fill_parlist_nir_default_mr (cpl_parameterlist *parlist, const char *recipe_name, const char *pipeline_name)
 
cpl_error_code xsh_detmon_lg_fill_parlist (cpl_parameterlist *parlist, const char *recipe_name, const char *pipeline_name, const char *method, int order, double kappa, int niter, int llx, int lly, int urx, int ury, int ref_level, const char *intermediate, const char *autocorr, const char *collapse, const char *rescale, const char *pix2pix, const char *bpmbin, int filter, int m, int n, double tolerance, const char *pafgen, const char *pafname, int llx1, int lly1, int urx1, int ury1, int llx2, int lly2, int urx2, int ury2, int llx3, int lly3, int urx3, int ury3, int llx4, int lly4, int urx4, int ury4, int llx5, int lly5, int urx5, int ury5, int exts, cpl_boolean opt_nir)
 Generic parlist filling for Lin/Gain recipe.
 
static cpl_propertylist * xsh_detmon_load_pro_keys (const char *NAME_O)
 Load pro keys.
 
static cpl_error_code xsh_detmon_gain_compute_qc (double kappa, int nclip, const int pos, const cpl_imagelist *offs, unsigned mode, double double_adu, double avg_on1, double avg_on2, double avg_off1, double avg_off2, double sigma, double sig_off_dif, double gain, int c_ndit, double gain_corr, double autocorr, cpl_image *on_dif, cpl_table *gain_table)
 
double xsh_detmon_gain_prepare_autocorr (unsigned mode, const int pos, double autocorr, int m, int n, cpl_imagelist *diff_flats, cpl_image *on_dif, cpl_imagelist *autocorr_images)
 
double xsh_detmon_gain_prepare_table (const cpl_imagelist *offs, unsigned mode, int llx, int lly, int urx, int ury, double kappa, int nclip, double avg_off1, double std, const int pos, cpl_table *gain_table, double *avg_off2, double *sig_off_dif)
 
static cpl_propertylist * xsh_detmon_lg_extract_qclist_4plane (cpl_propertylist *linc_qclist, const int ip)
 
static cpl_error_code xsh_detmon_lg_extract_extention_header (cpl_frameset *frameset, cpl_propertylist *gaint_qclist, cpl_propertylist *lint_qclist, cpl_propertylist *linc_qclist, cpl_propertylist *bpm_qclist, int whichext)
 Extract extension headers if multi-extension.
 
static cpl_error_code xsh_detmon_lg_save_table_with_pro_keys (cpl_table *table, const char *name_o, cpl_propertylist *xheader, unsigned CPL_IO_MODE)
 Save cube product.
 
static cpl_error_code xsh_detmon_lg_save_image_with_pro_keys (cpl_image *image, const char *name_o, cpl_propertylist *xheader)
 Save cube product.
 
static cpl_error_code xsh_detmon_lg_save_imagelist_with_pro_keys (cpl_imagelist *imagelist, const char *name_o, cpl_propertylist *xheader)
 Save cube product.
 
static cpl_error_code xsh_detmon_lg_save_plane (const cpl_parameterlist *parlist, cpl_frameset *frameset, const cpl_frameset *usedframes, int whichext, const char *recipe_name, cpl_propertylist *mypro_coeffscube, cpl_propertylist *linc_plane_qclist, const char *package, const char *NAME_O, cpl_image *plane)
 Save cube product.
 
static cpl_error_code xsh_detmon_lg_save_cube (const cpl_parameterlist *parlist, cpl_frameset *frameset, const cpl_frameset *usedframes, int whichext, const char *recipe_name, cpl_propertylist *mypro_coeffscube, cpl_propertylist *linc_qclist, const char *package, const char *NAME_O, cpl_imagelist *coeffs)
 Save cube product.
 
static char * xsh_detmon_lg_set_paf_name_and_header (cpl_frame *ref_frame, int flag_sets, int which_set, int whichext, const char *paf_suf, cpl_propertylist **plist)
 
static char * xsh_detmon_lg_set_paf_name_and_header_ext (cpl_frame *ref_frame, int flag_sets, int which_set, int whichext, const char *paf_suf, cpl_propertylist **plist)
 
static cpl_error_code xsh_detmon_lg_save_paf_product (cpl_frame *ref_frame, int flag_sets, int which_set, int whichext, const char *pafregexp, const char *procatg, const char *pipeline_name, const char *recipe_name, const char *paf_suf, cpl_propertylist *qclist, const int ext)
 
static cpl_error_code xsh_detmon_lg_fits_coeffs_and_bpm2chip (cpl_imagelist **coeffs_ptr, cpl_image **bpms_ptr)
 Fits COEFFS_CUBE and BPM outputs to whole-chip size images (DFS05711)
 
int xsh_detmon_compute_badpixmap (cpl_boolean opt_nir, const int nsets, const cpl_table *linear_table, const cpl_imagelist *linearity_inputs, int nbpixs, cpl_vector *x, cpl_propertylist *gaint_qclist, cpl_image **bpms_ptr)
 
cpl_table * xsh_detmon_gain (const cpl_imagelist *imlist_on, const cpl_imagelist *imlist_off, const cpl_vector *exptimes, const cpl_vector *ndit, double tolerance, int llx, int lly, int urx, int ury, double kappa, int nclip, int xshift, int yshift, cpl_propertylist *qclist, unsigned mode, cpl_imagelist **diff_imlist, cpl_imagelist **autocorr_imlist)
 Gain computation.
 
cpl_table * xsh_detmon_lin (const cpl_imagelist *imlist_on, const cpl_imagelist *imlist_off, const cpl_vector *exptimes, double tolerance, int llx, int lly, int urx, int ury, int order, int ref_level, double kappa, cpl_boolean bpmbin, cpl_propertylist *qclist, unsigned mode, cpl_imagelist **coeffs_cube, cpl_image **bpm)
 Linearity computation.
 
static double irplib_calculate_total_noise_smooth (const cpl_image *pimage, int pattern_x, int pattern_y)
 
cpl_error_code xsh_detmon_check_order (const double *exptime, int sz, double tolerance, int order)
 
cpl_error_code xsh_detmon_lg_set_tag (cpl_frameset *set, const char **tag_on, const char **tag_off)
 

Typedef Documentation

◆ FPN_METHOD

typedef enum _FPN_METHOD FPN_METHOD

Definition at line 75 of file xsh_detmon_lg.c.

Enumeration Type Documentation

◆ _FPN_METHOD

Enumerator
FPN_UNKNOWN 
FPN_HISTOGRAM 
FPN_SMOOTH 

Definition at line 69 of file xsh_detmon_lg.c.

Function Documentation

◆ hdrldemo_detector_shotnoise_model()

cpl_error_code hdrldemo_detector_shotnoise_model ( const cpl_image *  ima_data,
const double  gain,
const double  ron,
cpl_image **  ima_errs 
)

compute photon count error in [ADU]

Parameters
ima_datain [ADU]
gaindetector's gain in [e- / ADU]
rondetector's read out noise in [ADU]
ima_errsoutput error image in [ADU]
Returns
cpl_error_code
Note
ima_errs need to be deallocated ima_data must contain the photon counts with no offsets this usually means the image must be overscan and bias corrected Then the shot noise can be calculated from the poissonian distribution as sqrt(electron-counts). To this (transformed back into ADUs) the readout noise is added in quadrature. @doc error is computed with standard formula

$ err_{ADU} = \sqrt{ \frac{ counts }{ gain } + ron^{ 2 } } $

If an image value is negative the associated error is set to RON

Definition at line 483 of file xsh_detmon_lg.c.

◆ irplib_calculate_total_noise()

static double irplib_calculate_total_noise ( const cpl_image *  pimage)
static

Definition at line 7151 of file xsh_detmon_lg.c.

Referenced by irplib_calculate_total_noise_smooth(), and irplib_fpn_lg().

◆ irplib_calculate_total_noise_smooth()

static double irplib_calculate_total_noise_smooth ( const cpl_image *  pimage,
int  pattern_x,
int  pattern_y 
)
static

Definition at line 7132 of file xsh_detmon_lg.c.

References irplib_calculate_total_noise().

Referenced by irplib_fpn_lg().

◆ irplib_compute_err()

static double irplib_compute_err ( double  gain,
double  ron,
double  photon_noise 
)
static

Definition at line 7216 of file xsh_detmon_lg.c.

Referenced by irplib_fpn_lg().

◆ irplib_fill_table_DETWINUIT()

static cpl_error_code irplib_fill_table_DETWINUIT ( cpl_table *  ptable,
cpl_propertylist *  plist,
int  row 
)
static

Definition at line 7362 of file xsh_detmon_lg.c.

References size.

Referenced by xsh_detmon_lg_reduce_dit().

◆ irplib_fpn_lg()

static double irplib_fpn_lg ( const cpl_image *  f1,
int *  range,
double  gain,
FPN_METHOD  fpn_method,
int  smooth_size,
double *  mse 
)
static

◆ irplib_free()

static void irplib_free ( char **  pointer)
static

Definition at line 540 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_save().

◆ irplib_load_fset_wrp()

static cpl_imagelist * irplib_load_fset_wrp ( const cpl_frameset *  pframeset,
cpl_type  type,
int  whichext 
)
static

Definition at line 7310 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config, and xsh_detmon_load_frameset_window().

Referenced by xsh_detmon_lg().

◆ irplib_load_fset_wrp_ext()

static cpl_imagelist * irplib_load_fset_wrp_ext ( const cpl_frameset *  pframeset,
cpl_type  type,
int  whichext 
)
static

Definition at line 7324 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config.

Referenced by xsh_detmon_lg().

◆ irplib_pfits_get_dit()

static double irplib_pfits_get_dit ( const cpl_propertylist *  plist)
static

Find out the character string associated to the DIT keyword (NIR)

Parameters
plistPropertylist
Returns
DIT value

Definition at line 3229 of file xsh_detmon_lg.c.

References irplib_pfits_get_prop_double().

Referenced by xsh_detmon_lg_lamp_stab(), and xsh_detmon_lg_reduce_dit().

◆ irplib_pfits_get_dit_opt()

static double irplib_pfits_get_dit_opt ( const cpl_propertylist *  plist)
static

Find out the character string associated to the DIT keyword (OPT)

Parameters
plistPropertylist
Returns
DIT value

Definition at line 3242 of file xsh_detmon_lg.c.

References irplib_pfits_get_prop_double().

Referenced by xsh_detmon_lg_lamp_stab().

◆ irplib_pfits_get_ndit()

static int irplib_pfits_get_ndit ( const cpl_propertylist *  plist)
static

find out the character string associated to the DIT keyword in a propertylist

Parameters
plistpropertylist
Returns
dit value

Definition at line 453 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce_dit().

◆ irplib_pfits_get_prop_double()

static double irplib_pfits_get_prop_double ( const cpl_propertylist *  plist,
const char *  prop_name 
)
static

Definition at line 3262 of file xsh_detmon_lg.c.

Referenced by irplib_pfits_get_dit(), and irplib_pfits_get_dit_opt().

◆ irplib_table_create_column()

static cpl_error_code irplib_table_create_column ( cpl_table *  ptable,
cpl_propertylist *  plist 
)
static

Definition at line 7334 of file xsh_detmon_lg.c.

References size.

Referenced by xsh_detmon_lg_reduce_dit().

◆ xsh_detmon_add_adl_column()

static cpl_error_code xsh_detmon_add_adl_column ( cpl_table *  table,
cpl_boolean  opt_nir 
)
static

Compute ADL column of Linearity Table.

Parameters
tableTable
Returns
CPL_ERROR_NONE on success or corresponding cpl_error_code on error.

Definition at line 3170 of file xsh_detmon_lg.c.

References OPT, and opt_nir.

Referenced by xsh_detmon_lg_reduce(), and xsh_detmon_lin().

◆ xsh_detmon_autocorr_factor()

static double xsh_detmon_autocorr_factor ( const cpl_image *  image,
cpl_image **  autocorr_image,
int  m,
int  n 
)
static

Produce bad pixel map by comparing to coefficients' cube fits to actual intensity values.

Parameters
coeffsCoeffs' cube; each plane correspond to a coefficient
nbpixsPointer to output total nb of bad pixels
Returns
Bad pixel map

Compute autocorr factor

Parameters
imageInput image to be autocorrelated
posDIT being processed (pos. in Corr imagelist)
autocorr_imagesCorr imagelist
Returns
Autocorrelation factor used as correction for gain formula
Note
Autocorrelation is only applied if –autocorr=TRUE; otherwise this function simply returns 1.
pos and autocorr_images are only used if –intermediate=TRUE to save the autocorrelation image.

Definition at line 3889 of file xsh_detmon_lg.c.

References autocorr, m, n, xsh_detmon_autocorrelate(), and xsh_detmon_image_correlate().

Referenced by xsh_detmon_gain_prepare_autocorr().

◆ xsh_detmon_autocorrelate()

cpl_image * xsh_detmon_autocorrelate ( const cpl_image *  input2,
const int  m,
const int  n 
)

Definition at line 1286 of file xsh_detmon_lg.c.

References autocorr, m, n, nx, and ny.

Referenced by xsh_detmon_autocorr_factor().

◆ xsh_detmon_bpixs()

static cpl_image * xsh_detmon_bpixs ( const cpl_imagelist *  coeffs,
cpl_boolean  bpmbin,
const double  kappa,
int *  nbpixs 
)
static

Produce bad pixel map according to coefficients' cube.

Parameters
coeffsCoeffs' cube; each plane correspond to a coefficient
nbpixsPointer to output total nb of bad pixels
Returns
Bad pixel map

Definition at line 3699 of file xsh_detmon_lg.c.

References bpmbin, first, kappa, and size.

Referenced by xsh_detmon_lin().

◆ xsh_detmon_check_order()

cpl_error_code xsh_detmon_check_order ( const double *  exptime,
int  sz,
double  tolerance,
int  order 
)

Definition at line 7393 of file xsh_detmon_lg.c.

References exptime, order, and tolerance.

Referenced by xsh_detmon_lg_reduce_set().

◆ xsh_detmon_check_saturation_on_pair()

static cpl_error_code xsh_detmon_check_saturation_on_pair ( cpl_imagelist *  autocorr_images,
cpl_imagelist *  diff_flats,
const cpl_imagelist *  ons,
const cpl_imagelist *  offs,
double  kappa,
int  nclip,
int  llx,
int  lly,
int  urx,
int  ury,
double  saturation_limit,
const int  pos,
unsigned  mode,
int *  rows_linear_affected 
)
static

Operate on input ON and OFF images related to gain Computes all quantities needed to determine the gain:

Parameters
autocorr_imagesCorr images (intermediate product)
diff_flatsDiff flats (intermediate product)
onsImages of the ON pair
offsImages of the OFF pair
posDIT being processed (entry pos. in table)
modePossible options (combined with bitwise or) autocorr true/false, opt/nir, collapse true/false pix2pix true/false
rows_linear_affectedthis parameter is set to skip gain computation

@doc To compute the gain are needed the following quantities: -a clean mean on each ON and OFF frame of the pair, -a clean standard deviation on each difference ON-OFF of the pair,

Returns
cpl_error_code.

Definition at line 3621 of file xsh_detmon_lg.c.

References IRPLIB_GAIN_WITH_AUTOCORR, kappa, llx, lly, mode, saturation_limit, urx, ury, xsh_detmon_lg_add_empty_image(), and xsh_ksigma_clip().

Referenced by xsh_detmon_lg_reduce_dit().

◆ xsh_detmon_compute_badpixmap()

int xsh_detmon_compute_badpixmap ( cpl_boolean  opt_nir,
const int  nsets,
const cpl_table *  linear_table,
const cpl_imagelist *  linearity_inputs,
int  nbpixs,
cpl_vector *  x,
cpl_propertylist *  gaint_qclist,
cpl_image **  bpms_ptr 
)

◆ xsh_detmon_fpn_compute()

static cpl_error_code xsh_detmon_fpn_compute ( const cpl_frameset *  set_on,
int *  index_on,
int  last_linear_best,
cpl_propertylist *  lint_qclist,
int  llx,
int  lly,
int  urx,
int  ury,
double  gain,
int  whichext,
FPN_METHOD  fpn_method,
int  smooth_size 
)
static

Definition at line 2641 of file xsh_detmon_lg.c.

References DETMON_QC_FPN, fpn_method, irplib_fpn_lg(), llx, lly, urx, ury, and xsh_detmon_lg_config.

Referenced by xsh_detmon_lg_reduce().

◆ xsh_detmon_gain()

cpl_table * xsh_detmon_gain ( const cpl_imagelist *  imlist_on,
const cpl_imagelist *  imlist_off,
const cpl_vector *  exptimes,
const cpl_vector *  ndit,
double  tolerance,
int  llx,
int  lly,
int  urx,
int  ury,
double  kappa,
int  nclip,
int  xshift,
int  yshift,
cpl_propertylist *  qclist,
unsigned  mode,
cpl_imagelist **  diff_imlist,
cpl_imagelist **  autocorr_imlist 
)

Gain computation.

Parameters
imlist_onInput ON imagelist
imlist_offInput OFF imagelist
exptimesVector containing EXPTIME values corresponding to input imagelists
toleranceTolerance allowed between EXPTIME of frames in a pair
llxRegion to compute
llyRegion to compute
urxRegion to compute
uryRegion to compute
kappaKappa used for kappa-sigma clipping
nclipNumber of iterative kappa-sigma clipping
xshiftShift applied on X axis (Autocorrelation)
yshiftShift applied on Y axis (Autocorrelation)
qclistQC list
modePossible options (combined with bitwise or) autocorr true/false, opt/nir, collapse true/false pix2pix true/false
diff_imlistOutput Difference imlist or NULL
autocorr_imlistOutput Autocorr imlist or NULL
Returns
Pointer to the Gain Table or NULL on error

imlist_on must have the same size of exptimes.

imlist_off must have either the same size of exptimes or contain only 2 images. (NOTE: the first case is the usual one in IR domain, the second one, the usual in OPT domain).

This function assumes image i in imlist_on has been taken with EXPTIME equal to position i in exptimes. The same is assumed for imlist_off if it is of the same length as imlist_on.

Every different EXPTIME value in exptimes must appear at least twice within the vector; in any case, an even number of times.

The algorithm for Gain computation involves several mean and stdev which are computed through an iterative kappa-sigma clipping.

The parameters xshift and yshift are ignored if mode & IRPLIB_GAIN_WITH_AUTOCORR = 0.

For the Difference and Autocorrelation imagelists NULL indicates these products are not required. Note that even being non-null, they will be ignored if IRPLIB_GAIN_WITH_AUTOCORR is not requested.

These are these supported modes: IRPLIB_GAIN_PTC : Use PTC method for Gain computation IRPLIB_GAIN_MEDIAN : use MEDIAN method for Gain computation IRPLIB_GAIN_NO_COLLAPSE : No collapse of darks/biases (NIR) IRPLIB_GAIN_COLLAPSE : Collapse of darks/biases (OPT) IRPLIB_GAIN_OPT : Optical data (output will have EXPTIME column) IRPLIB_GAIN_NIR : Optical data (output will have NIR column) IRPLIB_GAIN_WITH_AUTOCORR : Apply autocorrelation factor IRPLIB_GAIN_WITH_RESCALE : Rescale images in each pair one to the another

It is mandatory to choose at least the collapse / no collapse and the data. By default, MEDIAN method is applied.

Example:

int n = NEXP;
cpl_imagelist * my_imlist_on = create_on_imlist(n);
cpl_imagelist * my_imlist_off = create_off_imlist(n);
cpl_vector * exptimes = create_exptimes(n);
cpl_propertylist * qclist = cpl_propertylist_new();
cpl_table * gain_table = xsh_detmon_gain(imlist_on, imlist_off, exptimes,
0.0, 1, 1, IMAGESIZE, IMAGESIZE,
3.0, 5, 0, 0, qclist,
NULL, NULL);
int n
Definition: xsh_detmon_lg.c:92
cpl_table * xsh_detmon_gain(const cpl_imagelist *imlist_on, const cpl_imagelist *imlist_off, const cpl_vector *exptimes, const cpl_vector *ndit, double tolerance, int llx, int lly, int urx, int ury, double kappa, int nclip, int xshift, int yshift, cpl_propertylist *qclist, unsigned mode, cpl_imagelist **diff_imlist, cpl_imagelist **autocorr_imlist)
Gain computation.
#define IRPLIB_GAIN_NO_COLLAPSE
#define IRPLIB_GAIN_NIR

As said above, a minimum of 2 bitwise options must be passed to mode. In the example, IRPLIB_GAIN_NO_COLLAPSE can be replaced with IRPLIB_GAIN_COLLAPSE, IRPLIB_GAIN_NIR with IRPLIB_GAIN_OPT or both. Of course, other options can be added bitwise as well to the mode.

Possible #_cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input const pointer(s) is NULL

Definition at line 6236 of file xsh_detmon_lg.c.

References autocorr, DETMON_QC_AUTOCORR, DETMON_QC_AUTOCORR_C, DETMON_QC_METHOD, DETMON_QC_METHOD_C, IRPLIB_GAIN_COLLAPSE, IRPLIB_GAIN_NO_COLLAPSE, IRPLIB_GAIN_OPT, IRPLIB_GAIN_PTC, IRPLIB_GAIN_WITH_AUTOCORR, IRPLIB_GAIN_WITH_RESCALE, kappa, llx, lly, method, mode, NIR, OPT, opt_nir, tolerance, urx, ury, xsh_detmon_gain_table_create(), xsh_detmon_gain_table_fill_row(), xsh_detmon_lg_find_dits_ndits(), xsh_detmon_lg_qc_med(), xsh_detmon_lg_qc_ptc(), and xsh_detmon_lg_rescale().

Referenced by xsh_gain().

◆ xsh_detmon_gain_compute_qc()

static cpl_error_code xsh_detmon_gain_compute_qc ( double  kappa,
int  nclip,
const int  pos,
const cpl_imagelist *  offs,
unsigned  mode,
double  double_adu,
double  avg_on1,
double  avg_on2,
double  avg_off1,
double  avg_off2,
double  sigma,
double  sig_off_dif,
double  gain,
int  c_ndit,
double  gain_corr,
double  autocorr,
cpl_image *  on_dif,
cpl_table *  gain_table 
)
static

◆ xsh_detmon_gain_prepare_autocorr()

double xsh_detmon_gain_prepare_autocorr ( unsigned  mode,
const int  pos,
double  autocorr,
int  m,
int  n,
cpl_imagelist *  diff_flats,
cpl_image *  on_dif,
cpl_imagelist *  autocorr_images 
)

◆ xsh_detmon_gain_prepare_table()

double xsh_detmon_gain_prepare_table ( const cpl_imagelist *  offs,
unsigned  mode,
int  llx,
int  lly,
int  urx,
int  ury,
double  kappa,
int  nclip,
double  avg_off1,
double  std,
const int  pos,
cpl_table *  gain_table,
double *  avg_off2,
double *  sig_off_dif 
)

◆ xsh_detmon_gain_table_create()

static cpl_error_code xsh_detmon_gain_table_create ( cpl_table *  gain_table,
const cpl_boolean  opt_nir 
)
static

Definition at line 6453 of file xsh_detmon_lg.c.

References NIR, and opt_nir.

Referenced by xsh_detmon_gain(), and xsh_detmon_lg_reduce_init().

◆ xsh_detmon_gain_table_fill_row()

static cpl_error_code xsh_detmon_gain_table_fill_row ( cpl_table *  gain_table,
double  c_dit,
int  c_ndit,
cpl_imagelist *  autocorr_images,
cpl_imagelist *  diff_flats,
const cpl_imagelist *  ons,
const cpl_imagelist *  offs,
double  kappa,
int  nclip,
int  llx,
int  lly,
int  urx,
int  ury,
int  m,
int  n,
double  saturation_limit,
double  gain_threshold,
const int  pos,
unsigned  mode,
int *  rows_gain_affected 
)
static

Operate on input ON and OFF images related to gain Computes all quantities needed to determine the gain:

Parameters
gain_tableGain table
autocorr_imagesCorr images (intermediate product)
diff_flatsDiff flats (intermediate product)
onsImages of the ON pair
offsImages of the OFF pair
posDIT being processed (entry pos. in table)
modePossible options (combined with bitwise or) autocorr true/false, opt/nir, collapse true/false pix2pix true/false
rows_affectedthis parameter is set to skip gain computation

@doc To compute the gain are needed the following quantities: -a clean mean on each ON and OFF frame of the pair, -a clean standard deviation on each difference ON-OFF of the pair,

gain=[(mon_1+mon_2)-(mof_1+mof_2)]/[sig(on_dif)^2-sig(off_dif)]*alpha+a

     where alpha is the autocorrelation factor and a is a correction
     which is an estimates of the noise.
     Also the autocorrelation factor and the corresponding corrected
     gain are computed. As the gain is the slope of the PTC curve
     to help the user we actually compute also the Y and X (taking
     into account or not of autocorrelation) terms
     of the linear relation and store them respectively in the
     Y_FIT, X_FIT and X_FIT_CORR columns.
Returns
cpl_error_code.

Definition at line 3468 of file xsh_detmon_lg.c.

References autocorr, gain_threshold, IRPLIB_GAIN_NIR, IRPLIB_GAIN_OPT, IRPLIB_GAIN_WITH_AUTOCORR, kappa, llx, lly, m, mode, n, sigma, urx, ury, xsh_detmon_gain_compute_qc(), xsh_detmon_gain_prepare_autocorr(), xsh_detmon_gain_prepare_table(), xsh_detmon_lg_add_empty_image(), xsh_detmon_subtract_create_window(), and xsh_ksigma_clip().

Referenced by xsh_detmon_gain(), and xsh_detmon_lg_reduce_dit().

◆ xsh_detmon_image_correlate()

cpl_image * xsh_detmon_image_correlate ( const cpl_image *  image1,
const cpl_image *  image2,
const int  m,
const int  n 
)

Definition at line 1117 of file xsh_detmon_lg.c.

References m, n, nx, and ny.

Referenced by xsh_detmon_autocorr_factor().

◆ xsh_detmon_lg()

cpl_error_code xsh_detmon_lg ( cpl_frameset *  frameset,
const cpl_parameterlist *  parlist,
const char *  tag_on,
const char *  tag_off,
const char *  recipe_name,
const char *  pipeline_name,
const char *  pafregexp,
const cpl_propertylist *  pro_lintbl,
const cpl_propertylist *  pro_gaintbl,
const cpl_propertylist *  pro_coeffscube,
const cpl_propertylist *  pro_bpm,
const cpl_propertylist *  pro_corr,
const cpl_propertylist *  pro_diff,
const char *  package,
int(*)(const cpl_frame *, const cpl_frame *)  compare,
int(*)(const cpl_frameset *, cpl_type, cpl_imagelist *)  load_fset,
const cpl_boolean  opt_nir 
)

◆ xsh_detmon_lg_add_empty_image()

static void xsh_detmon_lg_add_empty_image ( cpl_imagelist *  imlist,
int  pos 
)
static

◆ xsh_detmon_lg_check_before_gain()

static int xsh_detmon_lg_check_before_gain ( const cpl_vector *  x,
const cpl_vector *  y 
)
static

The function is used to identify "empty" ("zero") frames

Parameters
xX_FIT column of the gain table
xY_FIT column of the gain table
Returns
true if the data are not zero

Definition at line 5924 of file xsh_detmon_lg.c.

References x, and y.

Referenced by xsh_detmon_lg_qc_med(), and xsh_detmon_lg_qc_ptc().

◆ xsh_detmon_lg_check_defaults()

static cpl_error_code xsh_detmon_lg_check_defaults ( const cpl_image *  reference)
static

Check and set default values with depend on the inputs.

Parameters
referenceReference image for default definition
Returns
CPL_ERROR_NONE or corresponding cpl_error_code() on error.

Definition at line 2231 of file xsh_detmon_lg.c.

References nx, ny, and xsh_detmon_lg_config.

Referenced by xsh_detmon_lg().

◆ xsh_detmon_lg_core()

static cpl_error_code xsh_detmon_lg_core ( cpl_frameset *  cur_fset_on,
cpl_frameset *  cur_fset_off,
int *  index_on,
int *  index_off,
double *  exptime_on,
double *  exptime_off,
int  whichext,
int  whichset,
const char *  recipe_name,
const char *  pipeline_name,
const char *  pafregexp,
const cpl_propertylist *  pro_lintbl,
const cpl_propertylist *  pro_gaintbl,
const cpl_propertylist *  pro_coeffscube,
const cpl_propertylist *  pro_bpm,
const cpl_propertylist *  pro_corr,
const cpl_propertylist *  pro_diff,
const char *  package,
int(*)(const cpl_frameset *, cpl_type, cpl_imagelist *)  load_fset,
int  nsets,
cpl_boolean  opt_nir,
cpl_frameset *  frameset,
const cpl_parameterlist *  parlist,
cpl_frameset *  cur_fset 
)
static

Core: Reduction and saving (encapsulated to avoid repetition)

Parameters
cur_fset_onFrames tagged ON
cur_fset_offFrames tagged OFF
nsets_onNumber of different labels
whichextExtension being processed
whichsetSetting being processed
recipe_nameRecipe name
pipeline_namePipeline_name
pafregexpRegexp of instrument-specific keywords for PAF
procatg_lintblPROCATG of the Linearity Table product (pr.)
procatg_gaintblPROCATG of the Gain Table pr.
procatg_coeffscubePROCATG of the Polynomial Coefficients Cube pr.
procatg_bpmPROCATG of the Bad Pixel Map pr.
procatg_diffPROCATG of the Difference Image intermediate pr. (only produced if –intermediate=TRUE)
procatg_corrPROCATG of the Autocorrelation Image intermediate pr. (only produced if –intermediate=TRUE)
packagePackage identifier
load_fsetLoading function for preprocessing of input frames with special data format (needed for AMBER and MIDI processing)
nsetsNumber of different settings
opt_nirBoolean for OPT/NIR cases
framesetInput frameset
parlistInput parlist
cur_fsetUsed frames
Returns
CPL_ERROR_NONE or corresponding cpl_error_code on error.

Definition at line 976 of file xsh_detmon_lg.c.

References load_fset, opt_nir, xsh_detmon_lg_config, xsh_detmon_lg_reduce(), and xsh_detmon_lg_save().

Referenced by xsh_detmon_lg_reduce_set().

◆ xsh_detmon_lg_dfs_save_imagelist()

static cpl_error_code xsh_detmon_lg_dfs_save_imagelist ( cpl_frameset *  frameset,
const cpl_parameterlist *  parlist,
const cpl_frameset *  usedframes,
const cpl_imagelist *  coeffs,
const char *  recipe_name,
const cpl_propertylist *  mypro_coeffscube,
const char *  package,
const char *  name_o 
)
static

Definition at line 7426 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_save_cube().

◆ xsh_detmon_lg_dfs_set_groups()

int xsh_detmon_lg_dfs_set_groups ( cpl_frameset *  set,
const char *  tag_on,
const char *  tag_off 
)

DFS related function.

Parameters
setFrameset
tag_onON tag
tag_offOFF tag
Returns
0 on success.

Definition at line 4989 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg().

◆ xsh_detmon_lg_extract_extention_header()

static cpl_error_code xsh_detmon_lg_extract_extention_header ( cpl_frameset *  frameset,
cpl_propertylist *  gaint_qclist,
cpl_propertylist *  lint_qclist,
cpl_propertylist *  linc_qclist,
cpl_propertylist *  bpm_qclist,
int  whichext 
)
static

Extract extension headers if multi-extension.

Parameters
framesetInput frameset
gaint_qclistPROCATG of the Gain Table pr.
lint_qclistPROCATG of the Linearity Table product (pr.)
linc_qclistPROCATG of the Linearity Table product (pr.)
bpm_qclistPROCATG of the Bad Pixel Map pr.
whichextExtension being processed

Definition at line 3948 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config.

Referenced by xsh_detmon_lg_save().

◆ xsh_detmon_lg_extract_qclist_4plane()

static cpl_propertylist * xsh_detmon_lg_extract_qclist_4plane ( cpl_propertylist *  linc_qclist,
const int  ip 
)
static

Definition at line 3922 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_save().

◆ xsh_detmon_lg_fill_parlist()

cpl_error_code xsh_detmon_lg_fill_parlist ( cpl_parameterlist *  parlist,
const char *  recipe_name,
const char *  pipeline_name,
const char *  method,
int  order,
double  kappa,
int  niter,
int  llx,
int  lly,
int  urx,
int  ury,
int  ref_level,
const char *  intermediate,
const char *  autocorr,
const char *  collapse,
const char *  rescale,
const char *  pix2pix,
const char *  bpmbin,
int  filter,
int  m,
int  n,
double  tolerance,
const char *  pafgen,
const char *  pafname,
int  llx1,
int  lly1,
int  urx1,
int  ury1,
int  llx2,
int  lly2,
int  urx2,
int  ury2,
int  llx3,
int  lly3,
int  urx3,
int  ury3,
int  llx4,
int  lly4,
int  urx4,
int  ury4,
int  llx5,
int  lly5,
int  urx5,
int  ury5,
int  exts,
cpl_boolean  opt_nir 
)

Generic parlist filling for Lin/Gain recipe.

Parameters
parlistPointer to parlist where parameters will be inserted
recipe_nameRecipe name (used for parameter name construction)
pipeline_namePipeline name (used for parameter name construction)
methodMethod to be used for Gain computation
orderOrder of the polynomial linearity fitting
kappaKappa value for kappa-sigma clipping (used for Gain)
niterNumber of iterations in kappa-sigma clipping
threshold_minMinimum threshold (not used now)
threshold_maxMaximum threshold (not used now)
llxLower left point of the ROI, x-coordinate
llyLower left point of the POI, y-coordinate
urxUpper right point of the ROI, x-coordinate
uryUpper right point of the POI, y-coordinate
ref_levelReference level to compute Linearity Correction
thresholdThreshold (not used now)
intermediateString. Must be <"CPL_FALSE"|"CPL_TRUE">
autocorrString. Must be <"CPL_FALSE"|"CPL_TRUE">
collapseString. Must be <"CPL_FALSE"|"CPL_TRUE">
rescaleString. Must be <"CPL_FALSE"|"CPL_TRUE">
pix2pixString. Must be <"CPL_FALSE"|"CPL_TRUE">
filterLevel to filter saturated frames
mX-axis shift of the autocorrelation
nY-axis shift of the autocorrelation
llx1llx for contamination - 1. region (OPT only)
lly1lly for contamination - 1. region (OPT only)
urx1urx for contamination - 1. region (OPT only)
ury1ury for contamination - 1. region (OPT only)
llx2llx for contamination - 2. region (OPT only)
lly2lly for contamination - 2. region (OPT only)
urx2urx for contamination - 2. region (OPT only)
ury2ury for contamination - 2. region (OPT only)
llx3llx for contamination - 3. region (OPT only)
lly3lly for contamination - 3. region (OPT only)
urx3urx for contamination - 3. region (OPT only)
ury3ury for contamination - 3. region (OPT only)
llx4llx for contamination - 4. region (OPT only)
lly4lly for contamination - 4. region (OPT only)
urx4urx for contamination - 4. region (OPT only)
ury4ury for contamination - 4. region (OPT only)
llx5llx for contamination - 5. region (OPT only)
lly5lly for contamination - 5. region (OPT only)
urx5urx for contamination - 5. region (OPT only)
ury5ury for contamination - 5. region (OPT only)
extsExtension to be computed
opt_nirControls insertion of llx{1,...} only in OPT case
Returns
CPL_ERROR_NONE or corresponding cpl_error_code() on error.
Note
This function is not used inside the main function xsh_detmon_lg(). It is used for testing purposes and offered for use, for example, at recipe plugin creation. It is also called from xsh_detmon_lg_fill_parlist_{opt,nir}_default().

Definition at line 1662 of file xsh_detmon_lg.c.

References autocorr, bpmbin, collapse, exts, filter, intermediate, kappa, llx, llx1, llx2, llx3, llx4, llx5, lly, lly1, lly2, lly3, lly4, lly5, m, method, n, niter, opt_nir, order, pafgen, pafname, pix2pix, ref_level, rescale, tolerance, urx, urx1, urx2, urx3, urx4, urx5, ury, ury1, ury2, ury3, ury4, ury5, and xsh_detmon_fill_parlist().

Referenced by xsh_detmon_lg_fill_parlist_nir_default(), and xsh_detmon_lg_fill_parlist_opt_default().

◆ xsh_detmon_lg_fill_parlist_default_mr()

cpl_error_code xsh_detmon_lg_fill_parlist_default_mr ( cpl_parameterlist *  parlist,
const char *  recipe_name,
const char *  pipeline_name 
)

◆ xsh_detmon_lg_fill_parlist_nir_default()

cpl_error_code xsh_detmon_lg_fill_parlist_nir_default ( cpl_parameterlist *  parlist,
const char *  recipe_name,
const char *  pipeline_name 
)

Parlist filling with NIR required parameters and its default values.

Parameters
parlistPointer to parlist where parameters will be inserted
recipe_nameRecipe name (used for parameter name construction)
pipeline_namePipeline name (used for parameter name construction)
Returns
CPL_ERROR_NONE or corresponding cpl_error_code() on error.
Note
This function is not used inside the main function xsh_detmon_lg(). It is used for testing purposed and offered for use, for example, at recipe plugin creation.

Definition at line 1426 of file xsh_detmon_lg.c.

References NIR, and xsh_detmon_lg_fill_parlist().

Referenced by xsh_detmon_lg_fill_parlist_nir_default_mr(), and xsh_lingain_fill_parlist_default_nir().

◆ xsh_detmon_lg_fill_parlist_nir_default_mr()

cpl_error_code xsh_detmon_lg_fill_parlist_nir_default_mr ( cpl_parameterlist *  parlist,
const char *  recipe_name,
const char *  pipeline_name 
)

◆ xsh_detmon_lg_fill_parlist_opt_default()

cpl_error_code xsh_detmon_lg_fill_parlist_opt_default ( cpl_parameterlist *  parlist,
const char *  recipe_name,
const char *  pipeline_name 
)

Parlist filling with OPT required parameters and its default values.

Parameters
parlistPointer to parlist where parameters will be inserted
recipe_nameRecipe name (used for parameter name construction)
pipeline_namePipeline name (used for parameter name construction)
Returns
CPL_ERROR_NONE or corresponding cpl_error_code() on error.
Note
This function is not used inside the main function xsh_detmon_lg(). It is used for testing purposed and offered for use, for example, at recipe plugin creation.

Definition at line 1495 of file xsh_detmon_lg.c.

References OPT, and xsh_detmon_lg_fill_parlist().

Referenced by xsh_detmon_lg_fill_parlist_opt_default_mr(), and xsh_lingain_fill_parlist_default_opt().

◆ xsh_detmon_lg_fill_parlist_opt_default_mr()

cpl_error_code xsh_detmon_lg_fill_parlist_opt_default_mr ( cpl_parameterlist *  parlist,
const char *  recipe_name,
const char *  pipeline_name 
)

◆ xsh_detmon_lg_find_dits()

static cpl_vector * xsh_detmon_lg_find_dits ( const cpl_vector *  exptimes,
double  tolerance 
)
static

Definition at line 6503 of file xsh_detmon_lg.c.

References tolerance.

Referenced by xsh_detmon_lin().

◆ xsh_detmon_lg_find_dits_ndits()

static cpl_error_code xsh_detmon_lg_find_dits_ndits ( const cpl_vector *  exptimes,
const cpl_vector *  vec_ndits,
double  tolerance,
cpl_vector **  diff_dits,
cpl_vector **  diff_ndits 
)
static

Definition at line 6538 of file xsh_detmon_lg.c.

References size, and tolerance.

Referenced by xsh_detmon_gain().

◆ xsh_detmon_lg_fits_coeffs_and_bpm2chip()

static cpl_error_code xsh_detmon_lg_fits_coeffs_and_bpm2chip ( cpl_imagelist **  coeffs_ptr,
cpl_image **  bpms_ptr 
)
static

Fits COEFFS_CUBE and BPM outputs to whole-chip size images (DFS05711)

Parameters
coeffs_ptrPointer to output coeffs' cube imagelist
bpms_ptrPointer to output bpm image

Definition at line 5032 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config.

Referenced by xsh_detmon_lg_reduce_all().

◆ xsh_detmon_lg_lamp_stab()

static cpl_error_code xsh_detmon_lg_lamp_stab ( const cpl_frameset *  lamps,
const cpl_frameset *  darks,
cpl_boolean  opt_nir,
int  whichext 
)
static

Compute lamp stability.

Parameters
lampsLamps (ON) sub-frameset
darksDarks (OFF) sub-frameset
opt_nirBoolean to make difference between OPT and NIR cases
Returns
CPL_ERROR_NONE or corresponding cpl_error_code().

Definition at line 2703 of file xsh_detmon_lg.c.

References irplib_pfits_get_dit(), irplib_pfits_get_dit_opt(), opt_nir, xsh_detmon_lg_config, and xsh_detmon_load_frameset_window().

Referenced by xsh_detmon_lg_reduce().

◆ xsh_detmon_lg_lineff()

static cpl_error_code xsh_detmon_lg_lineff ( double *  pcoeffs,
cpl_propertylist *  qclist,
int  ref_level,
int  order 
)
static

Linearity effective correction (LIN.EFF) computation.

Parameters
pcoeffsPointer to array of polynomial coefficients of the fit
qclistqclist
ref_levelreference level used in the construction of the polynomial F_m(F_r) from F_m(t), using F_r = a_1 * t
Returns
CPL_ERROR_NONE or cpl_error_code on error.

Definition at line 5686 of file xsh_detmon_lg.c.

References DETMON_QC_LIN_EFF, DETMON_QC_LIN_EFF_C, DETMON_QC_LIN_EFF_FLUX, DETMON_QC_LIN_EFF_FLUX_C, order, and ref_level.

Referenced by xsh_detmon_lg_reduce_all(), and xsh_detmon_lin().

◆ xsh_detmon_lg_qc_med()

static cpl_error_code xsh_detmon_lg_qc_med ( const cpl_table *  gain_table,
cpl_propertylist *  qclist,
int  rows_in_gain 
)
static

MED method final computation. The median and stdev of the column "GAIN", and the median of the column "GAIN_CORR" are computed and corresponding QC keywords are set.

Parameters
gain_tableGain Table (with data required by the method)
qclistqclist
Returns
CPL_ERROR_NONE or cpl_error_code on error.

Definition at line 5955 of file xsh_detmon_lg.c.

References DETMON_QC_CONAD, DETMON_QC_CONAD_C, DETMON_QC_CONAD_CORR, DETMON_QC_CONAD_CORR_C, DETMON_QC_GAIN, DETMON_QC_GAIN_C, DETMON_QC_GAIN_CORR, DETMON_QC_GAIN_CORR_C, DETMON_QC_GAIN_MSE, DETMON_QC_GAIN_MSE_C, x, xsh_detmon_lg_check_before_gain(), and y.

Referenced by xsh_detmon_gain(), and xsh_detmon_lg_reduce_all().

◆ xsh_detmon_lg_qc_ptc()

static cpl_error_code xsh_detmon_lg_qc_ptc ( const cpl_table *  gain_table,
cpl_propertylist *  qclist,
unsigned  mode,
int  rows_in_gain 
)
static

PTC (Photon Transfer Curve) method final computation.

Parameters
gain_tableGain Table (with data required by the method)
qclistqclist
Returns
CPL_ERROR_NONE or cpl_error_code on error.

Definition at line 5791 of file xsh_detmon_lg.c.

References DETMON_QC_CONAD, DETMON_QC_CONAD_C, DETMON_QC_CONAD_CORR, DETMON_QC_CONAD_CORR_C, DETMON_QC_GAIN, DETMON_QC_GAIN_C, DETMON_QC_GAIN_CORR, DETMON_QC_GAIN_CORR_C, IRPLIB_GAIN_WITH_AUTOCORR, mode, x, xsh_detmon_lg_check_before_gain(), and y.

Referenced by xsh_detmon_gain(), and xsh_detmon_lg_reduce_all().

◆ xsh_detmon_lg_reduce()

static cpl_error_code xsh_detmon_lg_reduce ( const cpl_frameset *  set_on,
const cpl_frameset *  set_off,
int *  index_on,
int *  index_off,
double *  exptime_on,
double *  exptime_off,
int *  next_index_on,
int *  next_index_off,
cpl_imagelist **  coeffs_ptr,
cpl_table *  gain_table,
cpl_table *  linear_table,
cpl_image **  bpm_ptr,
cpl_imagelist *  autocorr_images,
cpl_imagelist *  diff_flats,
cpl_propertylist *  gaint_qclist,
cpl_propertylist *  lint_qclist,
cpl_propertylist *  linc_qclist,
cpl_propertylist *  bpm_qclist,
int(*)(const cpl_frameset *, cpl_type, cpl_imagelist *)  load_fset,
const cpl_boolean  opt_nir,
int  whichext 
)
static

Apply linearity and gain reduction algorithms.

Parameters
set_onON sub-frameset
set_offOFF sub-frameset
nsets_extractedNumber of different labels (DITs)
coeffs_ptrPointer to output coeffs imagelist
gain_tableGain table
linear_tableLinearity table
bpm_ptrPointer to output bad pixel map
autocorr_imagesCorr imagelist (intermediate product)
diff_flatsDiff imagelist (intermediate product)
qclistqclist
load_fsetLoading function for preprocessing of input frames with special data format (needed for AMBER and MIDI processing)
opt_nirBoolean to differ OPT and NIR cases
whichextExtension currently being processed
Returns
CPL_ERROR_NONE or corresponding cpl_error_code().
Note
The variable nsets_extracted is needed for cases when more than a pair have the same DIT.

Definition at line 2411 of file xsh_detmon_lg.c.

References DETMON_QC_GAIN, first, load_fset, opt_nir, xsh_detmon_add_adl_column(), xsh_detmon_fpn_compute(), xsh_detmon_lg_config, xsh_detmon_lg_lamp_stab(), xsh_detmon_lg_reduce_all(), xsh_detmon_lg_reduce_dit(), xsh_detmon_lg_reduce_init(), and xsh_detmon_table_fill_invalid().

Referenced by xsh_detmon_lg_core().

◆ xsh_detmon_lg_reduce_all()

static cpl_error_code xsh_detmon_lg_reduce_all ( const cpl_table *  linear_table,
cpl_propertylist *  gaint_qclist,
cpl_propertylist *  lint_qclist,
cpl_propertylist *  linc_qclist,
cpl_propertylist *  bpm_qclist,
cpl_imagelist **  coeffs_ptr,
cpl_image **  bpms_ptr,
const cpl_imagelist *  linearity_inputs,
const cpl_table *  gain_table,
int  which_ext,
cpl_boolean  opt_nir 
)
static

Final reduction step (after DIT-per-DIT reduction): fit linearity data and determine corresponding QC parameters, determine QC related gain parameters, determine linearity efficiency parameters, determines non linear pixels.

Parameters
linear_tableLinearity Table
qclistqclist
coeffs_ptrPointer to output coeffs' cube imagelist
bpms_ptrPointer to output bpm image
linearity_inputsInput imagelist for pix2pix fitting
gain_tableGain Table
whichextExtension being currently processed
Returns
CPL_ERROR_NONE on success or corresponding cpl_error_code on error.

Definition at line 5380 of file xsh_detmon_lg.c.

References autocorr, DETMON_QC_AUTOCORR, DETMON_QC_AUTOCORR_C, DETMON_QC_COUNTS_MAX, DETMON_QC_COUNTS_MAX_C, DETMON_QC_COUNTS_MIN, DETMON_QC_COUNTS_MIN_C, DETMON_QC_ERRFIT, DETMON_QC_ERRFIT_C, DETMON_QC_ERRFIT_MSE_C, DETMON_QC_LAMP_FLUX, DETMON_QC_LAMP_FLUX_C, DETMON_QC_LAMP_STAB, DETMON_QC_LAMP_STAB_C, DETMON_QC_LIN_COEF_C, DETMON_QC_LIN_COEF_ERR_C, DETMON_QC_METHOD, DETMON_QC_METHOD_C, DETMON_QC_NUM_BPM, DETMON_QC_NUM_BPM_C, first, IRPLIB_GAIN_WITH_AUTOCORR, mode, NIR, opt_nir, order, x, xsh_detmon_compute_badpixmap(), xsh_detmon_lg_config, xsh_detmon_lg_fits_coeffs_and_bpm2chip(), xsh_detmon_lg_lineff(), xsh_detmon_lg_qc_med(), xsh_detmon_lg_qc_ptc(), and y.

Referenced by xsh_detmon_lg_reduce().

◆ xsh_detmon_lg_reduce_dit()

static cpl_error_code xsh_detmon_lg_reduce_dit ( const cpl_frameset *  set_on,
int *  index_on,
double *  exptime_on,
const int  dit_nb,
int *  dit_nskip,
const cpl_frameset *  set_off,
int *  index_off,
double *  exptime_off,
int *  next_on,
int *  next_off,
cpl_table *  linear_table,
cpl_table *  gain_table,
cpl_imagelist *  linearity_inputs,
cpl_propertylist *  qclist,
cpl_boolean  opt_nir,
cpl_imagelist *  autocorr_images,
cpl_imagelist *  diff_flats,
cpl_imagelist *  opt_offs,
int  whichext,
int *  rows_linear_affected,
int *  rows_gain_affected 
)
static

Reduction step to be applied together to frames of same DIT.

Parameters
set_onON sub-frameset
dit_nbDIT of frames to be processed in this call
nsets_extractedNumber of different labels (DITs)
set_offOFF sub-frameset
selection_offArray of labels to identify pairs in set_off
linear_tableLinearity table
gain_tableGain table
linearity_inputsImagelist to be input of pix2pix fitting
qclistqclist
opt_nirBoolean to differ OPT and NIR cases
autocorr_imagesCorr imagelist (intermediate product)
diff_flatsDiff imagelist (intermediate product)
opt_offsOFF imagelist used in OPT (eq. for all DITs)
whichextExtension currently being processed
Returns
CPL_ERROR_NONE or corresponding cpl_error_code().
Note
The variable nsets_extracted is needed for cases when more than a pair have the same DIT.
Calls to this function with different DIT value could be easily parallelised, as processing is independent for each DIT.

Definition at line 2892 of file xsh_detmon_lg.c.

References irplib_fill_table_DETWINUIT(), IRPLIB_GAIN_COLLAPSE, IRPLIB_GAIN_NIR, IRPLIB_GAIN_NO_COLLAPSE, IRPLIB_GAIN_OPT, IRPLIB_GAIN_WITH_AUTOCORR, IRPLIB_LIN_COLLAPSE, IRPLIB_LIN_NIR, IRPLIB_LIN_NO_COLLAPSE, IRPLIB_LIN_OPT, IRPLIB_LIN_PIX2PIX, irplib_pfits_get_dit(), irplib_pfits_get_exptime(), irplib_pfits_get_ndit(), irplib_table_create_column(), mode, NIR, OPT, opt_nir, xsh_detmon_check_saturation_on_pair(), xsh_detmon_gain_table_fill_row(), xsh_detmon_lg_config, xsh_detmon_lg_rescale(), xsh_detmon_lin_table_fill_row(), xsh_detmon_opt_contamination(), xsh_detmon_pair_extract_next(), and xsh_detmon_single_extract_next().

Referenced by xsh_detmon_lg_reduce().

◆ xsh_detmon_lg_reduce_init()

static cpl_error_code xsh_detmon_lg_reduce_init ( cpl_table *  gain_table,
cpl_table *  linear_table,
cpl_imagelist **  linearity_inputs,
const cpl_boolean  opt_nir 
)
static

Create columns of product tables and init linearity_inputs.

Parameters
gain_tableGain Table
linear_tableLinearity Table
linearity_inputsImagelist to be input of pix2pix fitting
Returns
CPL_ERROR_NONE on success or corresponding cpl_error_code on error.

Definition at line 3203 of file xsh_detmon_lg.c.

References opt_nir, xsh_detmon_gain_table_create(), xsh_detmon_lg_config, and xsh_detmon_lin_table_create().

Referenced by xsh_detmon_lg_reduce().

◆ xsh_detmon_lg_reduce_set()

static cpl_error_code xsh_detmon_lg_reduce_set ( int  i,
cpl_frameset *  frameset,
int  nsets,
const char *  tag_on,
const char *  tag_off,
const char *  recipe_name,
const char *  pipeline_name,
const char *  pafregexp,
const cpl_propertylist *  pro_lintbl,
const cpl_propertylist *  pro_gaintbl,
const cpl_propertylist *  pro_coeffscube,
const cpl_propertylist *  pro_bpm,
const cpl_propertylist *  pro_corr,
const cpl_propertylist *  pro_diff,
const char *  package,
int(*)(const cpl_frameset *, cpl_type, cpl_imagelist *)  load_fset,
const cpl_boolean  opt_nir,
const cpl_parameterlist *  parlist,
cpl_size *  selection 
)
static

◆ xsh_detmon_lg_rescale()

static cpl_error_code xsh_detmon_lg_rescale ( cpl_imagelist *  to_rescale)
static

Rescale of images (one to another level)

Parameters
to_rescaleImagelist to be rescaled
Returns
CPL_ERROR_NONE or cpl_error_code on error.
Note
This function is associated with –rescale parameter.
The function always rescales the image of higher median level to the median level of the other one (the one of lower median level)

Definition at line 6030 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config.

Referenced by xsh_detmon_gain(), xsh_detmon_lg_reduce_dit(), and xsh_detmon_lin().

◆ xsh_detmon_lg_retrieve_parlist()

static cpl_error_code xsh_detmon_lg_retrieve_parlist ( const char *  pipeline_name,
const char *  recipe_name,
const cpl_parameterlist *  parlist,
cpl_boolean  opt_nir 
)
static

Parlist extraction and copy to global struct variable.

Parameters
parlistParlist
recipe_nameRecipe name (used for parameter name construction)
pipeline_namePipeline name (used for parameter name construction)
opt_nirBoolean to make difference between OPT and NIR cases
Returns
CPL_ERROR_NONE or corresponding cpl_error_code() on error.

Definition at line 1913 of file xsh_detmon_lg.c.

References FPN_HISTOGRAM, FPN_SMOOTH, OPT, opt_nir, xsh_detmon_lg_config, xsh_detmon_retrieve_par_double(), and xsh_detmon_retrieve_par_int().

Referenced by xsh_detmon_lg().

◆ xsh_detmon_lg_save()

static cpl_error_code xsh_detmon_lg_save ( const cpl_parameterlist *  parlist,
cpl_frameset *  frameset,
const char *  recipe_name,
const char *  pipeline_name,
const char *  pafregexp,
const cpl_propertylist *  pro_lintbl,
const cpl_propertylist *  pro_gaintbl,
const cpl_propertylist *  pro_coeffscube,
const cpl_propertylist *  pro_bpm,
const cpl_propertylist *  pro_corr,
const cpl_propertylist *  pro_diff,
const char *  package,
cpl_imagelist *  coeffs,
cpl_table *  gain_table,
cpl_table *  linear_table,
cpl_image *  bpms,
cpl_imagelist *  autocorr_images,
cpl_imagelist *  diff_flats,
cpl_propertylist *  gaint_qclist,
cpl_propertylist *  lint_qclist,
cpl_propertylist *  linc_qclist,
cpl_propertylist *  bpm_qclist,
const int  flag_sets,
const int  which_set,
const cpl_frameset *  usedframes,
int  whichext 
)
static

Save all products.

Parameters
framesetInput frameset
parlistInput parlist
recipe_nameRecipe name
pipeline_namePipeline_name
pafregexpRegexp of instrument-specific keywords for PAF
procatg_lintblPROCATG of the Linearity Table product (pr.)
procatg_gaintblPROCATG of the Gain Table pr.
procatg_coeffscubePROCATG of the Polynomial Coefficients Cube pr.
procatg_bpmPROCATG of the Bad Pixel Map pr.
procatg_corrPROCATG of the Autocorrelation Image intermediate pr. (only produced if –intermediate=TRUE)
procatg_diffPROCATG of the Difference Image intermediate pr. (only produced if –intermediate=TRUE)
packagePackage identifier
coeffsCoefficients' cube
gain_tableGain Table
linear_tableLinearity Table
bpmsBad Pixel Map
autocorr_imagesAutocorrelation Images
diff_flatsDifference Images
qclistqclist
flag_setsFlag to indicate if there is more than a setting
which_setCurrent setting
usedframesusedframes
whichextExtension being processed

@return CPL_ERROR_NONE or corresponding cpl_error_code on error.

Definition at line 4402 of file xsh_detmon_lg.c.

References irplib_free(), xsh_detmon_lg_config, xsh_detmon_lg_extract_extention_header(), xsh_detmon_lg_extract_qclist_4plane(), xsh_detmon_lg_save_cube(), xsh_detmon_lg_save_image_with_pro_keys(), xsh_detmon_lg_save_paf_product(), xsh_detmon_lg_save_plane(), and xsh_detmon_lg_save_table_with_pro_keys().

Referenced by xsh_detmon_lg_core().

◆ xsh_detmon_lg_save_cube()

static cpl_error_code xsh_detmon_lg_save_cube ( const cpl_parameterlist *  parlist,
cpl_frameset *  frameset,
const cpl_frameset *  usedframes,
int  whichext,
const char *  recipe_name,
cpl_propertylist *  mypro_coeffscube,
cpl_propertylist *  linc_qclist,
const char *  package,
const char *  NAME_O,
cpl_imagelist *  coeffs 
)
static

Save cube product.

Parameters
parlistInput parlist
framesetInput frameset
usedframesusedframes
whichextExtension being processed
recipe_nameRecipe name
mypro_coeffscubecube header
mypro_coeffscubecube QC header
packagePackage identifier
NAME_Ocube filename
coeffsCoefficients' cube

@return CPL_ERROR_NONE or corresponding cpl_error_code on error.

Definition at line 4180 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config, xsh_detmon_lg_dfs_save_imagelist(), and xsh_detmon_lg_save_imagelist_with_pro_keys().

Referenced by xsh_detmon_lg_save().

◆ xsh_detmon_lg_save_image_with_pro_keys()

static cpl_error_code xsh_detmon_lg_save_image_with_pro_keys ( cpl_image *  image,
const char *  name_o,
cpl_propertylist *  xheader 
)
static

Save cube product.

Parameters
imageImage to save
name_oOutput filename
xheaderextention header
Returns
CPL_ERROR opr none

Definition at line 4045 of file xsh_detmon_lg.c.

References xsh_detmon_load_pro_keys().

Referenced by xsh_detmon_lg_save(), and xsh_detmon_lg_save_plane().

◆ xsh_detmon_lg_save_imagelist_with_pro_keys()

static cpl_error_code xsh_detmon_lg_save_imagelist_with_pro_keys ( cpl_imagelist *  imagelist,
const char *  name_o,
cpl_propertylist *  xheader 
)
static

Save cube product.

Parameters
imageImage to save
name_oOutput filename
xheaderextention header
Returns
CPL_ERROR opr none

Definition at line 4072 of file xsh_detmon_lg.c.

References xsh_detmon_load_pro_keys().

Referenced by xsh_detmon_lg_save_cube().

◆ xsh_detmon_lg_save_paf_product()

static cpl_error_code xsh_detmon_lg_save_paf_product ( cpl_frame *  ref_frame,
int  flag_sets,
int  which_set,
int  whichext,
const char *  pafregexp,
const char *  procatg,
const char *  pipeline_name,
const char *  recipe_name,
const char *  paf_suf,
cpl_propertylist *  qclist,
const int  ext 
)
static

◆ xsh_detmon_lg_save_plane()

static cpl_error_code xsh_detmon_lg_save_plane ( const cpl_parameterlist *  parlist,
cpl_frameset *  frameset,
const cpl_frameset *  usedframes,
int  whichext,
const char *  recipe_name,
cpl_propertylist *  mypro_coeffscube,
cpl_propertylist *  linc_plane_qclist,
const char *  package,
const char *  NAME_O,
cpl_image *  plane 
)
static

Save cube product.

Parameters
parlistInput parlist
framesetInput frameset
usedframesusedframes
whichextExtension being processed
recipe_nameRecipe name
mypro_coeffscubecube header
mypro_coeffscubecube QC header
packagePackage identifier
NAME_Ocube filename
planeCoefficients' cube plane

@return CPL_ERROR_NONE or corresponding cpl_error_code on error.

Definition at line 4108 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config, and xsh_detmon_lg_save_image_with_pro_keys().

Referenced by xsh_detmon_lg_save().

◆ xsh_detmon_lg_save_table_with_pro_keys()

static cpl_error_code xsh_detmon_lg_save_table_with_pro_keys ( cpl_table *  table,
const char *  name_o,
cpl_propertylist *  xheader,
unsigned  CPL_IO_MODE 
)
static

Save cube product.

Parameters
imageImage to save
name_oOutput filename
xheaderextention header
CPL_IO_MODEIO mode
Returns
CPL_ERROR opr none

Definition at line 4009 of file xsh_detmon_lg.c.

References xsh_detmon_load_pro_keys().

Referenced by xsh_detmon_lg_save().

◆ xsh_detmon_lg_set_paf_name_and_header()

static char * xsh_detmon_lg_set_paf_name_and_header ( cpl_frame *  ref_frame,
int  flag_sets,
int  which_set,
int  whichext,
const char *  paf_suf,
cpl_propertylist **  plist 
)
static

Definition at line 4230 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config.

Referenced by xsh_detmon_lg_save_paf_product().

◆ xsh_detmon_lg_set_paf_name_and_header_ext()

static char * xsh_detmon_lg_set_paf_name_and_header_ext ( cpl_frame *  ref_frame,
int  flag_sets,
int  which_set,
int  whichext,
const char *  paf_suf,
cpl_propertylist **  plist 
)
static

Definition at line 4277 of file xsh_detmon_lg.c.

References xsh_detmon_lg_config.

Referenced by xsh_detmon_lg_save_paf_product().

◆ xsh_detmon_lg_set_tag()

cpl_error_code xsh_detmon_lg_set_tag ( cpl_frameset *  set,
const char **  tag_on,
const char **  tag_off 
)

◆ xsh_detmon_lg_split_onoff()

static cpl_error_code xsh_detmon_lg_split_onoff ( const cpl_frameset *  cur_fset,
cpl_frameset *  cur_fset_on,
cpl_frameset *  cur_fset_off,
const char *  tag_on,
const char *  tag_off 
)
static

Split the input frameset into two sub-framesets (ON and OFF)

Parameters
cur_fsetPointer to input frameset
cur_fset_onPointer to output ON sub-frameset
cur_fset_offPointer to output OFF sub-frameset
tag_onTag to identify ON frames
tag_offTag to identify OFF frames
opt_nirBoolean to make difference between OPT and NIR
Returns
CPL_ERROR_NONE or corresponding cpl_error_code() on error.

Definition at line 2329 of file xsh_detmon_lg.c.

References first, OPT, opt_nir, and xsh_detmon_lg_config.

Referenced by xsh_detmon_lg_reduce_set().

◆ xsh_detmon_lin()

cpl_table * xsh_detmon_lin ( const cpl_imagelist *  imlist_on,
const cpl_imagelist *  imlist_off,
const cpl_vector *  exptimes,
double  tolerance,
int  llx,
int  lly,
int  urx,
int  ury,
int  order,
int  ref_level,
double  kappa,
cpl_boolean  bpmbin,
cpl_propertylist *  qclist,
unsigned  mode,
cpl_imagelist **  coeffs_cube,
cpl_image **  bpm 
)

Linearity computation.

Parameters
imlist_onInput ON imagelist
imlist_offInput OFF imagelist
exptimesVector containing EXPTIME values corresponding to input imagelists
toleranceTolerance allowed between EXPTIME of frames in a pair
llxRegion to compute
llyRegion to compute
urxRegion to compute
uryRegion to compute
orderpolynomial order used to fit linearity relation
ref_levelreference level used in the construction of the polynomial F_m(F_r) from F_m(t), using F_r = a_1 * t
kappakappa used in kappa-sigma clipping
bpmbinswitch to De-/Activate the binary bpm option
qclistQC list
modePossible options (combined with bitwise or) autocorr true/false, opt/nir, collapse true/false pix2pix true/false
coeffs_cubeOutput Coefficients Cube (only if IRPLIB_LIN_PIX2PIX)
bpmBad pixel map (only if IRPLIB_LIN_PIX2PIX)
Returns
Pointer to the Linearity Table or NULL on error

imlist_on must have the same size of exptimes.

imlist_off must have either the same size of exptimes only if using mode IRPLIB_LIN_NO_COLLAPSE. (NOTE: this is usual case in IR domain). Otherwise (OPT domain) any size is accepted (as all images will be collapse to a MASTERBIAS).

This function assumes image i in imlist_on has been taken with EXPTIME equal to position i in exptimes. The same is assumed for imlist_off if it is of the same length as imlist_on.

Every different EXPTIME value in exptimes must appear at least twice within the vector; in any case, an even number of times.

These are these supported modes: IRPLIB_LIN_PIX2PIX : Fit for each pixel position IRPLIB_LIN_WITH_RESCALE : Rescale images in each pair one to the another IRPLIB_LIN_NO_COLLAPSE : No collapse of darks/biases (NIR) IRPLIB_LIN_COLLAPSE : Collapse of darks/biases (OPT) IRPLIB_LIN_OPT : Optical data (output will have EXPTIME column) IRPLIB_LIN_NIR : Optical data (output will have NIR column)

It is mandatory to choose at least the collapse / no collapse and the data. By default, MEDIAN method is applied.

Example:

int n = NEXP;
cpl_imagelist * my_imlist_on = create_on_imlist(n);
cpl_imagelist * my_imlist_off = create_off_imlist(n);
cpl_vector * exptimes = create_exptimes(n);
cpl_propertylist * qclist = cpl_propertylist_new();
cpl_table * lin_table = xsh_detmon_lin(imlist_on, imlist_off, exptimes,
0.0, 1, 1, IMAGESIZE, IMAGESIZE,
3, 10000, 3, FALSE, qclist,
NULL, NULL);
cpl_table * xsh_detmon_lin(const cpl_imagelist *imlist_on, const cpl_imagelist *imlist_off, const cpl_vector *exptimes, double tolerance, int llx, int lly, int urx, int ury, int order, int ref_level, double kappa, cpl_boolean bpmbin, cpl_propertylist *qclist, unsigned mode, cpl_imagelist **coeffs_cube, cpl_image **bpm)
Linearity computation.
#define IRPLIB_LIN_NO_COLLAPSE
#define IRPLIB_LIN_NIR

As said above, a minimum of 2 bitwise options must be passed to mode. In the example, IRPLIB_LIN_NO_COLLAPSE can be replaced with IRPLIB_LIN_COLLAPSE, IRPLIB_LIN_NIR with IRPLIB_LIN_OPT or both. Of course, other options can be added bitwise as well to the mode.

Possible #_cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input const pointer(s) is NULL

Definition at line 6668 of file xsh_detmon_lg.c.

References bpmbin, collapse, DETMON_QC_ERRFIT, DETMON_QC_ERRFIT_C, DETMON_QC_ERRFIT_MSE_C, DETMON_QC_LIN_COEF_C, DETMON_QC_LIN_COEF_ERR_C, DETMON_QC_NUM_BPM, DETMON_QC_NUM_BPM_C, first, IRPLIB_LIN_COLLAPSE, IRPLIB_LIN_NO_COLLAPSE, IRPLIB_LIN_OPT, IRPLIB_LIN_PIX2PIX, IRPLIB_LIN_WITH_RESCALE, kappa, llx, lly, mode, NIR, OPT, opt_nir, order, ref_level, tolerance, urx, ury, x, xsh_detmon_add_adl_column(), xsh_detmon_bpixs(), xsh_detmon_lg_find_dits(), xsh_detmon_lg_lineff(), xsh_detmon_lg_rescale(), xsh_detmon_lin_table_create(), xsh_detmon_lin_table_fill_row(), and y.

◆ xsh_detmon_lin_table_create()

static cpl_error_code xsh_detmon_lin_table_create ( cpl_table *  lin_table,
const cpl_boolean  opt_nir 
)
static

Definition at line 6484 of file xsh_detmon_lg.c.

References NIR, and opt_nir.

Referenced by xsh_detmon_lg_reduce_init(), and xsh_detmon_lin().

◆ xsh_detmon_lin_table_fill_row()

static cpl_error_code xsh_detmon_lin_table_fill_row ( cpl_table *  lin_table,
double  c_dit,
cpl_imagelist *  linearity_inputs,
const cpl_imagelist *  ons,
const cpl_imagelist *  offs,
int  llx,
int  lly,
int  urx,
int  ury,
const int  pos,
const int  nskip,
unsigned  mode 
)
static

Fill i-th row in Linearity Table: DIT or EXPTIME, MEAN, MED, MEAN_DIT, MED_DIT.

Parameters
lin_tableLinearity Table
linearity_inputsImagelist for later use in algorithm
onsImages of the ON pair
offsImages of the OFF pai
llxlower left x
llylower left y
urxupper right x
uryupper right y
posPosition in table
nskipPositions to skip (due to saturated images)
modeswitch to know if OPT or NIR mode

@doc For each frame integradion time (DIT or EXPTIME), computes mean and median value of the extracted signal in a given rectangular region of a difference frame obtained by subtracting pixel by pixel the 2 difference frames obtained subtracting each off frame from the corresponding on frame.

Returns
CPL_ERROR_NONE or corresponding cpl_error_code() on error.

Definition at line 7063 of file xsh_detmon_lg.c.

References IRPLIB_LIN_COLLAPSE, IRPLIB_LIN_NIR, IRPLIB_LIN_OPT, IRPLIB_LIN_PIX2PIX, llx, lly, mode, urx, ury, and xsh_detmon_subtracted_avg().

Referenced by xsh_detmon_lg_reduce_dit(), and xsh_detmon_lin().

◆ xsh_detmon_load_pro_keys()

static cpl_propertylist * xsh_detmon_load_pro_keys ( const char *  NAME_O)
static

Load pro keys.

Parameters
NAME_Oproduct file name

Definition at line 3254 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_save_image_with_pro_keys(), xsh_detmon_lg_save_imagelist_with_pro_keys(), and xsh_detmon_lg_save_table_with_pro_keys().

◆ xsh_detmon_opt_contamination()

static cpl_error_code xsh_detmon_opt_contamination ( const cpl_imagelist *  ons,
const cpl_imagelist *  offs,
unsigned  mode,
cpl_propertylist *  qclist 
)
static

Contamination computation (OPT only)

Parameters
reducedImage to compute contamination
qclistqclist @doc The median flux ion 5 fields of a reduced flat field (on-off frame) are computed and stored as QC in QC CONTAM MED | STD
Returns
CPL_ERROR_NONE or cpl_error_code on error.

Definition at line 4907 of file xsh_detmon_lg.c.

References DETMON_QC_CONTAM, DETMON_QC_CONTAM_C, IRPLIB_LIN_COLLAPSE, llx, lly, mode, urx, ury, xsh_detmon_lg_config, and xsh_detmon_subtracted_avg().

Referenced by xsh_detmon_lg_reduce_dit().

◆ xsh_detmon_pair_extract_next()

static cpl_error_code xsh_detmon_pair_extract_next ( const cpl_frameset *  set,
int *  index,
int *  next_element,
double *  dit_array,
cpl_frameset **  pair,
double  tolerance 
)
static

Definition at line 6062 of file xsh_detmon_lg.c.

References tolerance.

Referenced by xsh_detmon_lg_reduce_dit().

◆ xsh_detmon_single_extract_next()

static cpl_error_code xsh_detmon_single_extract_next ( const cpl_frameset *  set,
int *  index,
int *  next_element,
double *  dit_array,
cpl_frameset **  pair 
)
static

Definition at line 6113 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce_dit().

◆ xsh_detmon_table_fill_invalid()

static cpl_error_code xsh_detmon_table_fill_invalid ( cpl_table *  ptable,
double  code 
)
static

Definition at line 2608 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce().

Variable Documentation

◆ autocorr

cpl_boolean autocorr

◆ bpmbin

cpl_boolean bpmbin

Definition at line 121 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_bpixs(), xsh_detmon_lg_fill_parlist(), and xsh_detmon_lin().

◆ collapse

cpl_boolean collapse

Definition at line 118 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist(), and xsh_detmon_lin().

◆ cr

double cr

Definition at line 127 of file xsh_detmon_lg.c.

Referenced by calc_resp_qc().

◆ exts

int exts

Definition at line 128 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ filter

int filter

◆ fpn_method

FPN_METHOD fpn_method

Definition at line 135 of file xsh_detmon_lg.c.

Referenced by irplib_fpn_lg(), and xsh_detmon_fpn_compute().

◆ fpn_smooth

int fpn_smooth

Definition at line 136 of file xsh_detmon_lg.c.

◆ gain_threshold

double gain_threshold

Definition at line 138 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_gain_table_fill_row().

◆ intermediate

cpl_boolean intermediate

Definition at line 117 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ kappa

double kappa

◆ lamp_ok

cpl_boolean lamp_ok

Definition at line 131 of file xsh_detmon_lg.c.

◆ lamp_stability

double lamp_stability

Definition at line 130 of file xsh_detmon_lg.c.

◆ llx

int llx

◆ llx1

int llx1

Definition at line 93 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ llx2

int llx2

Definition at line 97 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ llx3

int llx3

Definition at line 101 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ llx4

int llx4

Definition at line 105 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ llx5

int llx5

Definition at line 109 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ lly

int lly

◆ lly1

int lly1

Definition at line 94 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ lly2

int lly2

Definition at line 98 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ lly3

int lly3

Definition at line 102 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ lly4

int lly4

Definition at line 106 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ lly5

int lly5

Definition at line 110 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ load_fset

int(* load_fset) (const cpl_frameset *, cpl_type, cpl_imagelist *) ( const cpl_frameset *  ,
cpl_type  ,
cpl_imagelist *   
)

◆ load_fset_wrp

cpl_imagelist *(* load_fset_wrp) (const cpl_frameset *, cpl_type, int) ( const cpl_frameset *  ,
cpl_type  ,
int   
)

Definition at line 134 of file xsh_detmon_lg.c.

◆ m

int m

◆ method

const char* method

◆ n

int n

Definition at line 92 of file xsh_detmon_lg.c.

Referenced by clean_arclist_data(), create_resid_tab(), data_wavesol_fit_with_sigma(), deriv(), equilibrate(), esp_det_line(), esp_fit_lcont(), esp_spec_deriv(), esp_spec_smooth(), expb_df(), expb_f(), find_left_right_continuum_pos(), fitngauss(), irplib_matrix_product_normal_create(), irplib_matrix_solve_chol_transpose(), irplib_polynomial_shift_double(), main(), poly_fitn(), reverse_tanh_kernel(), set_qc_parameters(), smooth(), test_gsl_example(), theo_tab_filter(), theo_tab_model(), xsh_bspline_fit_smooth(), xsh_bspline_fit_smooth_data(), xsh_bspline_fit_smooth_data2(), xsh_clean_mean(), xsh_compute_scale(), xsh_compute_scale_tab(), xsh_compute_scale_tab2(), xsh_compute_scale_tab3(), xsh_detect_raw_data_outliers_1d(), xsh_detect_raw_data_outliers_1d_slice(), xsh_detmon_autocorr_factor(), xsh_detmon_autocorrelate(), xsh_detmon_gain_prepare_autocorr(), xsh_detmon_gain_table_fill_row(), xsh_detmon_image_correlate(), xsh_detmon_lg_fill_parlist(), xsh_detmon_load_frameset_window(), xsh_fit_imagelist_is_zero_macro(), xsh_fit_spline1(), xsh_fit_spline2(), xsh_frameset_dump(), xsh_frameset_dump_nod_info(), xsh_get_exptimes(), xsh_gsl_bspline_non_uniform(), xsh_gsl_fit_gaussian(), xsh_image_extract_optimal(), xsh_image_search_bad_pixels_via_noise(), xsh_image_stats_on_rectangle(), xsh_imagelist_collapse_sigclip_iter_create(), xsh_matrix_product_normal_create(), xsh_merge_ord_with_tag(), xsh_poisson_random(), xsh_rectify_orders(), xsh_SAanneal(), xsh_SAmelt(), xsh_skycorr_sample_continuum(), xsh_sort_double_pairs(), xsh_spline_hermite(), xsh_spline_hermite_table(), xsh_table_column_clip(), xsh_tools_sort_double(), xsh_tools_sort_float(), xsh_tools_sort_int(), xsh_tools_tchebitchev_poly_eval(), xsh_util_apply_response(), xsh_util_bpmap2rp(), xsh_util_bpmap_coadd(), xsh_util_compute_response(), xsh_util_ima_arith(), xsh_util_ima_shift(), and zeroscenterfind().

◆ nb_extensions

int nb_extensions

Definition at line 129 of file xsh_detmon_lg.c.

◆ niter

int niter

◆ nx

int nx

Definition at line 113 of file xsh_detmon_lg.c.

Referenced by chunk_coadd(), compute_specres(), create_frame(), create_order_image(), detect_centroid(), fill_img(), flag_noisy_pixels(), get_average_qc_from_raws(), get_lambda(), irplib_fit_imagelist_polynomial(), irplib_fit_imagelist_residual(), main(), make_data_cube(), mkHeader(), set_masterdark_qc(), setHeader(), xsh_badpixel_flag_rejected(), xsh_badpixelmap_fill_bp_pattern_holes(), xsh_badpixelmap_flag_saturated_pixels(), xsh_badpixelmap_image_coadd(), xsh_bpmap_bitwise_to_flag(), xsh_bpmap_collapse_bpmap_create(), xsh_bpmap_collapse_mean(), xsh_bpmap_collapse_median(), xsh_bpmap_count(), xsh_bpmap_mask_bad_pixel(), xsh_build_ifu_cube(), xsh_code_is_in_qual(), xsh_collapse_errs(), xsh_compute_linearity(), xsh_compute_noise_map(), xsh_convert_xy_to_ws(), xsh_crea_grid_from_mask(), xsh_create_blaze(), xsh_create_master_dark_bpmap(), xsh_create_master_flat_with_mask(), xsh_detect_continuum(), xsh_detect_edges(), xsh_detmon_autocorrelate(), xsh_detmon_image_correlate(), xsh_detmon_lg_check_defaults(), xsh_detmon_load_frameset_window(), xsh_dispersol_list_to_slitmap(), xsh_dispersol_list_to_wavemap(), xsh_edge_check(), xsh_eval_y_avg_chunk(), xsh_fill_bkg_mask_range(), xsh_fit_gaussian(), xsh_fit_imagelist_polynomial(), xsh_fixed_pattern_noise_bias(), xsh_flag_ima_bad_pix(), xsh_follow_arclines(), xsh_frame_image_get_step(), xsh_frameset_add(), xsh_get_sky_edges_min_max_and_size(), xsh_ifu_trace_object_calibrate(), xsh_image_3d_get_size_x(), xsh_image_3d_insert(), xsh_image_3d_new(), xsh_image_clean_badpixel(), xsh_image_clean_mask_pixs(), xsh_image_create_gaussian_image(), xsh_image_create_model_image(), xsh_image_div_by_fct(), xsh_image_divide_1D(), xsh_image_extract_optimal(), xsh_image_extract_standard(), xsh_image_fill_noise_uniform(), xsh_image_filter_mode(), xsh_image_filter_wrapper(), xsh_image_find_barycenter(), xsh_image_fit_spline(), xsh_image_flag_bp(), xsh_image_gaussian_fit_y(), xsh_image_local_cold_pixs(), xsh_image_local_hot_pixs(), xsh_image_mult_by_fct(), xsh_image_warp_polynomial_scale(), xsh_imagelist_collapse_sigclip_iter_create(), xsh_interpolate_linear(), xsh_ksigma_clip(), xsh_normalize_spectrum_image(), xsh_opt_extract_orders(), xsh_optextract_produce_model(), xsh_order_table_from_fmtchk(), xsh_pre_3d_new(), xsh_pre_data_window_median_flux_pa(), xsh_pre_median_mean_stdev(), xsh_pre_median_mean_stdev_window(), xsh_pre_new(), xsh_pre_subsample(), xsh_qc_flats_raw(), xsh_qual_to_cpl_mask(), xsh_rec_list_rectify(), xsh_remove_cr(), xsh_remove_crh_single(), xsh_subtract_sky_at_pix(), xsh_subtract_sky_at_pix2(), xsh_subtract_sky_on_obj_at_pix(), xsh_test_create_bias_image(), xsh_test_create_frame(), xsh_util_ima_rebin(), xsh_wavecal_list_pupulate(), xsh_wavelist_subtract_sky(), xsh_wavemap_lambda_range(), xsh_wavemap_list_full_sky_save(), xsh_wavemap_list_new(), xsh_wavemap_list_save(), and xsh_wavemap_list_save2().

◆ ny

int ny

Definition at line 114 of file xsh_detmon_lg.c.

Referenced by chunk_coadd(), compute_specres(), create_frame(), create_order_image(), detect_centroid(), fill_img(), flag_noisy_pixels(), get_average_qc_from_raws(), get_lambda(), irplib_fit_imagelist_polynomial(), main(), make_data_cube(), mkHeader(), set_masterdark_qc(), setHeader(), xsh_badpixel_flag_rejected(), xsh_badpixelmap_fill_bp_pattern_holes(), xsh_badpixelmap_flag_saturated_pixels(), xsh_badpixelmap_image_coadd(), xsh_bpmap_bitwise_to_flag(), xsh_bpmap_collapse_bpmap_create(), xsh_bpmap_collapse_mean(), xsh_bpmap_collapse_median(), xsh_bpmap_count(), xsh_bpmap_mask_bad_pixel(), xsh_build_ifu_cube(), xsh_code_is_in_qual(), xsh_collapse_errs(), xsh_compute_linearity(), xsh_compute_noise_map(), xsh_crea_grid_from_mask(), xsh_create_blaze(), xsh_create_master_dark_bpmap(), xsh_create_master_flat_with_mask(), xsh_detect_max_y(), xsh_detect_order_edge(), xsh_detmon_autocorrelate(), xsh_detmon_image_correlate(), xsh_detmon_lg_check_defaults(), xsh_detmon_load_frameset_window(), xsh_dispersol_list_to_slitmap(), xsh_dispersol_list_to_wavemap(), xsh_eval_y_avg_chunk(), xsh_fit_imagelist_polynomial(), xsh_fixed_pattern_noise_bias(), xsh_flag_ima_bad_pix(), xsh_follow_arclines(), xsh_frameset_add(), xsh_ifu_trace_object_calibrate(), xsh_image_3d_get_size_y(), xsh_image_3d_insert(), xsh_image_3d_new(), xsh_image_clean_badpixel(), xsh_image_clean_mask_pixs(), xsh_image_create_gaussian_image(), xsh_image_create_model_image(), xsh_image_div_by_fct(), xsh_image_divide_1D(), xsh_image_extract_optimal(), xsh_image_extract_standard(), xsh_image_fill_noise_uniform(), xsh_image_filter_mode(), xsh_image_filter_wrapper(), xsh_image_find_barycenter(), xsh_image_fit_spline(), xsh_image_flag_bp(), xsh_image_gaussian_fit_y(), xsh_image_local_cold_pixs(), xsh_image_local_hot_pixs(), xsh_image_mult_by_fct(), xsh_image_warp_polynomial_scale(), xsh_imagelist_collapse_sigclip_iter_create(), xsh_interpolate_linear(), xsh_ksigma_clip(), xsh_model_reduce(), xsh_normalize_spectrum_image(), xsh_opt_extract_orders(), xsh_order_list_save(), xsh_order_list_verify(), xsh_order_table_from_fmtchk(), xsh_pre_3d_new(), xsh_pre_data_window_median_flux_pa(), xsh_pre_median_mean_stdev(), xsh_pre_median_mean_stdev_window(), xsh_pre_new(), xsh_pre_subsample(), xsh_qc_flats_raw(), xsh_qual_to_cpl_mask(), xsh_rec_list_rectify(), xsh_remove_cr(), xsh_remove_crh_single(), xsh_test_create_bias_image(), xsh_test_create_frame(), xsh_util_ima_rebin(), xsh_wavelist_subtract_sky(), xsh_wavemap_lambda_range(), xsh_wavemap_list_full_sky_save(), xsh_wavemap_list_save(), and xsh_wavemap_list_save2().

◆ order

int order

Definition at line 80 of file xsh_detmon_lg.c.

Referenced by add_to_order_list(), analyse_extraction(), create_rectify_nod_list(), cumulate_qc_parameter(), esp_fit_lcont(), fill_rectified(), get_meas_coordinates(), lambda_fit(), main(), save_centers(), theo_tab_filter(), xsh_afcthetab_create(), xsh_bspline_fit_smooth(), xsh_bspline_fit_smooth_data(), xsh_bspline_fit_smooth_data2(), xsh_cube_trace_fit(), xsh_detect_arclines(), xsh_detect_arclines_dan(), xsh_detect_outliers_thres_new(), xsh_detect_raw_data_outliers_1d(), xsh_detect_raw_data_outliers_1d_slice(), xsh_detmon_check_order(), xsh_detmon_lg_fill_parlist(), xsh_detmon_lg_lineff(), xsh_detmon_lg_reduce_all(), xsh_detmon_lin(), xsh_extract_clean_with_tag(), xsh_extract_with_tag(), xsh_fit_gaussian(), xsh_fit_spline1(), xsh_fit_spline2(), xsh_flexcor(), xsh_follow_arclines(), xsh_get_sky_edges_min_max_and_size(), xsh_linetilt_is_duplicate(), xsh_model2tab(), xsh_model_fill_fit(), xsh_model_fill_fit_bfit(), xsh_model_fill_fit_slice(), xsh_model_fill_fit_slice_bfit(), xsh_model_fill_obj(), xsh_model_to_table(), xsh_normalize_spectrum_image(), xsh_obj_fit_dump(), xsh_order_edge_list_fit(), xsh_order_list_fit(), xsh_predict_qc(), xsh_rec_list1D_save_as_tab(), xsh_rec_list_duplicate(), xsh_rec_list_frame_invert(), xsh_rec_list_load(), xsh_rec_list_load_eso(), xsh_rec_list_load_eso_1d(), xsh_rec_list_save(), xsh_rec_list_save2(), xsh_rec_list_save_table(), xsh_rectify_orders(), xsh_resid_tab_create(), xsh_resid_tab_create_not_flagged(), xsh_resid_tab_load(), xsh_resid_tab_log(), xsh_resid_tab_save(), xsh_shift(), xsh_spectrum_load_order(), xsh_spectrum_save_order(), xsh_star_flux_list_save_order(), xsh_the_map_set_arcline(), xsh_util_multiply_by_response_ord(), xsh_wavecal_list_pupulate(), xsh_wavelist_subtract_sky(), xsh_wavemap_lambda_range(), xsh_wavemap_list_build_sky(), xsh_wavemap_list_new(), xsh_wavemap_list_object_image_save(), xsh_wavemap_list_rms_sky_image_save(), xsh_wavemap_list_save(), xsh_wavemap_list_save2(), xsh_wavemap_list_save4debug(), xsh_wavemap_list_save_poly(), xsh_wavemap_list_sky_image_save(), xsh_wavesol_compute(), xsh_wavesol_eval_polx(), xsh_wavesol_eval_poly(), xsh_wavesol_residual(), and xsh_wavesol_trace().

◆ pafgen

cpl_boolean pafgen

Definition at line 124 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ pafname

const char* pafname

Definition at line 125 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ pix2pix

cpl_boolean pix2pix

Definition at line 120 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ ref_level

int ref_level

◆ rescale

cpl_boolean rescale

◆ saturation_limit

double saturation_limit

Definition at line 137 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_check_saturation_on_pair().

◆ split_coeffs

cpl_boolean split_coeffs

Definition at line 139 of file xsh_detmon_lg.c.

◆ threshold

int threshold

◆ threshold_max

int threshold_max

Definition at line 84 of file xsh_detmon_lg.c.

◆ threshold_min

int threshold_min

Definition at line 83 of file xsh_detmon_lg.c.

◆ tolerance

double tolerance

◆ urx

int urx

◆ urx1

int urx1

Definition at line 95 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ urx2

int urx2

Definition at line 99 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ urx3

int urx3

Definition at line 103 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ urx4

int urx4

Definition at line 107 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ urx5

int urx5

Definition at line 111 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ ury

int ury

◆ ury1

int ury1

Definition at line 96 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ ury2

int ury2

Definition at line 100 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ ury3

int ury3

Definition at line 104 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ ury4

int ury4

Definition at line 108 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ ury5

int ury5

Definition at line 112 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_fill_parlist().

◆ wholechip

cpl_boolean wholechip

Definition at line 115 of file xsh_detmon_lg.c.

◆ 

struct { ... } xsh_detmon_lg_config