X-shooter Pipeline Reference Manual 3.8.15
Macros | Typedefs | Functions
xsh_detmon_lg.h File Reference
#include <cpl.h>
#include <xsh_cpl_size.h>

Go to the source code of this file.

Macros

#define DETMON_LG_ON_RAW_OLD   "ON_RAW"
 
#define DETMON_LG_OFF_RAW_OLD   "OFF_RAW"
 
#define DETMON_LG_ON_RAW_NEW   "DETMON_LAMP_ON"
 
#define DETMON_LG_OFF_RAW_NEW   "DETMON_LAMP_OFF"
 
#define NIR   TRUE
 
#define OPT   FALSE
 
#define DETMON_QC_COUNTS_MIN   "ESO QC COUNTS MIN"
 
#define DETMON_QC_COUNTS_MIN_C   "Minimum median value used in linearity test (in a user defined region) [ADU]"
 
#define DETMON_QC_COUNTS_MAX   "ESO QC COUNTS MAX"
 
#define DETMON_QC_COUNTS_MAX_C   "Maximum median value used in linearity test (in a user defined region) [ADU]"
 
#define DETMON_QC_CONAD   "ESO QC CONAD"
 
#define DETMON_QC_CONAD_C   "Conversion from e- to ADUs [ADU/e-]"
 
#define DETMON_QC_CONAD_CORR   "ESO QC CONAD CORR"
 
#define DETMON_QC_CONAD_CORR_C   "CONAD value taken QC.AUTOCORR into account [ADU/e-]"
 
#define DETMON_QC_GAIN   "ESO QC GAIN"
 
#define DETMON_QC_GAIN_C   "GAIN (see QC.METHOD) [e-/ADU]"
 
#define DETMON_QC_GAIN_MSE   "ESO QC GAIN MSE"
 
#define DETMON_QC_GAIN_MSE_C   "Measured Squared error in GAIN computation"
 
#define DETMON_QC_RON   "ESO QC RON"
 
#define DETMON_QC_RON_C   "RON obtained as independent term (PTC method)"
 
#define DETMON_QC_AUTOCORR   "ESO QC AUTOCORR"
 
#define DETMON_QC_AUTOCORR_C
 
#define DETMON_QC_GAIN_CORR   "ESO QC GAIN CORR"
 
#define DETMON_QC_GAIN_CORR_C   "GAIN taken QC.AUTOCORR into account [e-/ADU]"
 
#define DETMON_QC_LAMP_FLUX   "ESO QC LAMP FLUX"
 
#define DETMON_QC_LAMP_FLUX_C   "Lamp flux"
 
#define DETMON_QC_NUM_BPM   "ESO QC NUM BPM"
 
#define DETMON_QC_NUM_BPM_C
 
#define DETMON_QC_LAMP_STAB   "ESO QC LAMP STAB"
 
#define DETMON_QC_LAMP_STAB_C   "Lamp stability"
 
#define DETMON_QC_METHOD   "ESO QC METHOD"
 
#define DETMON_QC_METHOD_C   "Method applied to compute GAIN"
 
#define DETMON_QC_LIN_EFF   "ESO QC LIN EFF"
 
#define DETMON_QC_LIN_EFF_C   "Effective non-linearity correction"
 
#define DETMON_QC_LIN_EFF_FLUX   "ESO QC LIN EFF FLUX"
 
#define DETMON_QC_LIN_EFF_FLUX_C   "FLux level at which effective non-linearity correction is computed"
 
#define DETMON_QC_LIN_COEF   "ESO QC LIN COEF"
 
#define DETMON_QC_LIN_COEF_C   "Linearity coefficient value"
 
#define DETMON_QC_LIN_COEF_ERR   "ESO QC LIN EFF ERR"
 
#define DETMON_QC_LIN_COEF_ERR_C   "Linearity coefficient error value"
 
#define DETMON_QC_LIN_COEF_MSE_ERR_C   "Linearity coefficient measured square error value"
 
#define DETMON_QC_ERRFIT   "ESO QC ERRFIT"
 
#define DETMON_QC_ERRFIT_C   "Error of fit"
 
#define DETMON_QC_ERRFIT_MSE_C   "Measured square error of fit"
 
#define DETMON_QC_CONTAM   "ESO QC CONTAM"
 
#define DETMON_QC_CONTAM_C   "Detector contamination in a region"
 
#define DETMON_QC_FPN   "ESO QC FPN"
 
#define DETMON_QC_FPN_C   "Flat pattern noise"
 
#define xsh_detmon_lg_get_description(RECIPE_NAME, PIPE_NAME, DETMON_LG_ON_RAW_NEW, DETMON_LG_OFF_RAW_NEW, DETMON_LG_ON_RAW_OLD, DETMON_LG_OFF_RAW_OLD)
 
#define REGEXP   "ARCFILE|MJD-OBS|ESO TPL ID|DATE-OBS|ESO DET DIT|ESO DET NDIT"
 
#define IRPLIB_GAIN_PTC   ((irplib_gain_flag) 1 << 1)
 
#define IRPLIB_GAIN_MEDIAN   ((irplib_gain_flag) 1 << 2)
 
#define IRPLIB_GAIN_NO_COLLAPSE   ((irplib_gain_flag) 1 << 3)
 
#define IRPLIB_GAIN_COLLAPSE   ((irplib_gain_flag) 1 << 4)
 
#define IRPLIB_GAIN_WITH_AUTOCORR   ((irplib_gain_flag) 1 << 5)
 
#define IRPLIB_GAIN_WITH_RESCALE   ((irplib_gain_flag) 1 << 6)
 
#define IRPLIB_GAIN_OPT   ((irplib_gain_flag) 1 << 7)
 
#define IRPLIB_GAIN_NIR   ((irplib_gain_flag) 1 << 8)
 
#define IRPLIB_LIN_NO_COLLAPSE   ((irplib_lin_flag) 1 << 10)
 
#define IRPLIB_LIN_COLLAPSE   ((irplib_lin_flag) 1 << 11)
 
#define IRPLIB_LIN_PIX2PIX   ((irplib_lin_flag) 1 << 12)
 
#define IRPLIB_LIN_WITH_RESCALE   ((irplib_lin_flag) 1 << 13)
 
#define IRPLIB_LIN_OPT   ((irplib_lin_flag) 1 << 14)
 
#define IRPLIB_LIN_NIR   ((irplib_lin_flag) 1 << 15)
 

Typedefs

typedef unsigned long irplib_gain_flag
 
typedef unsigned long irplib_lin_flag
 

Functions

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 *, const cpl_image *, const int, const int)
 
cpl_error_code xsh_detmon_lg_fill_parlist_nir_default (cpl_parameterlist *, const char *, const char *)
 Parlist filling with NIR required parameters and its default values.
 
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_opt_default (cpl_parameterlist *, const char *, const char *)
 Parlist filling with OPT required parameters and its default values.
 
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 (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.
 
cpl_image * xsh_detmon_autocorrelate (const cpl_image *, const int, const int)
 
cpl_table * xsh_detmon_gain (const cpl_imagelist *, const cpl_imagelist *, const cpl_vector *, const cpl_vector *, double, int, int, int, int, double, int, int, int, cpl_propertylist *, unsigned, cpl_imagelist **, cpl_imagelist **)
 Gain computation.
 
cpl_table * xsh_detmon_lin (const cpl_imagelist *, const cpl_imagelist *, const cpl_vector *, double, int, int, int, int, int, int, double, cpl_boolean, cpl_propertylist *, unsigned, cpl_imagelist **, cpl_image **)
 Linearity computation.
 
cpl_error_code xsh_detmon_lg_set_tag (cpl_frameset *set, const char **tag_on, const char **tag_off)
 

Macro Definition Documentation

◆ DETMON_LG_OFF_RAW_NEW

#define DETMON_LG_OFF_RAW_NEW   "DETMON_LAMP_OFF"

Definition at line 45 of file xsh_detmon_lg.h.

◆ DETMON_LG_OFF_RAW_OLD

#define DETMON_LG_OFF_RAW_OLD   "OFF_RAW"

Definition at line 43 of file xsh_detmon_lg.h.

◆ DETMON_LG_ON_RAW_NEW

#define DETMON_LG_ON_RAW_NEW   "DETMON_LAMP_ON"

Definition at line 44 of file xsh_detmon_lg.h.

◆ DETMON_LG_ON_RAW_OLD

#define DETMON_LG_ON_RAW_OLD   "ON_RAW"

Definition at line 42 of file xsh_detmon_lg.h.

◆ DETMON_QC_AUTOCORR

#define DETMON_QC_AUTOCORR   "ESO QC AUTOCORR"

Definition at line 72 of file xsh_detmon_lg.h.

◆ DETMON_QC_AUTOCORR_C

#define DETMON_QC_AUTOCORR_C
Value:
"Autocorrelation factor computed as sum of " \
"all pixels in autocorrelation image"

Definition at line 73 of file xsh_detmon_lg.h.

◆ DETMON_QC_CONAD

#define DETMON_QC_CONAD   "ESO QC CONAD"

Definition at line 57 of file xsh_detmon_lg.h.

◆ DETMON_QC_CONAD_C

#define DETMON_QC_CONAD_C   "Conversion from e- to ADUs [ADU/e-]"

Definition at line 58 of file xsh_detmon_lg.h.

◆ DETMON_QC_CONAD_CORR

#define DETMON_QC_CONAD_CORR   "ESO QC CONAD CORR"

Definition at line 60 of file xsh_detmon_lg.h.

◆ DETMON_QC_CONAD_CORR_C

#define DETMON_QC_CONAD_CORR_C   "CONAD value taken QC.AUTOCORR into account [ADU/e-]"

Definition at line 61 of file xsh_detmon_lg.h.

◆ DETMON_QC_CONTAM

#define DETMON_QC_CONTAM   "ESO QC CONTAM"

Definition at line 111 of file xsh_detmon_lg.h.

◆ DETMON_QC_CONTAM_C

#define DETMON_QC_CONTAM_C   "Detector contamination in a region"

Definition at line 112 of file xsh_detmon_lg.h.

◆ DETMON_QC_COUNTS_MAX

#define DETMON_QC_COUNTS_MAX   "ESO QC COUNTS MAX"

Definition at line 54 of file xsh_detmon_lg.h.

◆ DETMON_QC_COUNTS_MAX_C

#define DETMON_QC_COUNTS_MAX_C   "Maximum median value used in linearity test (in a user defined region) [ADU]"

Definition at line 55 of file xsh_detmon_lg.h.

◆ DETMON_QC_COUNTS_MIN

#define DETMON_QC_COUNTS_MIN   "ESO QC COUNTS MIN"

Definition at line 51 of file xsh_detmon_lg.h.

◆ DETMON_QC_COUNTS_MIN_C

#define DETMON_QC_COUNTS_MIN_C   "Minimum median value used in linearity test (in a user defined region) [ADU]"

Definition at line 52 of file xsh_detmon_lg.h.

◆ DETMON_QC_ERRFIT

#define DETMON_QC_ERRFIT   "ESO QC ERRFIT"

Definition at line 106 of file xsh_detmon_lg.h.

◆ DETMON_QC_ERRFIT_C

#define DETMON_QC_ERRFIT_C   "Error of fit"

Definition at line 107 of file xsh_detmon_lg.h.

◆ DETMON_QC_ERRFIT_MSE_C

#define DETMON_QC_ERRFIT_MSE_C   "Measured square error of fit"

Definition at line 108 of file xsh_detmon_lg.h.

◆ DETMON_QC_FPN

#define DETMON_QC_FPN   "ESO QC FPN"

Definition at line 114 of file xsh_detmon_lg.h.

◆ DETMON_QC_FPN_C

#define DETMON_QC_FPN_C   "Flat pattern noise"

Definition at line 115 of file xsh_detmon_lg.h.

◆ DETMON_QC_GAIN

#define DETMON_QC_GAIN   "ESO QC GAIN"

Definition at line 63 of file xsh_detmon_lg.h.

◆ DETMON_QC_GAIN_C

#define DETMON_QC_GAIN_C   "GAIN (see QC.METHOD) [e-/ADU]"

Definition at line 64 of file xsh_detmon_lg.h.

◆ DETMON_QC_GAIN_CORR

#define DETMON_QC_GAIN_CORR   "ESO QC GAIN CORR"

Definition at line 75 of file xsh_detmon_lg.h.

◆ DETMON_QC_GAIN_CORR_C

#define DETMON_QC_GAIN_CORR_C   "GAIN taken QC.AUTOCORR into account [e-/ADU]"

Definition at line 76 of file xsh_detmon_lg.h.

◆ DETMON_QC_GAIN_MSE

#define DETMON_QC_GAIN_MSE   "ESO QC GAIN MSE"

Definition at line 66 of file xsh_detmon_lg.h.

◆ DETMON_QC_GAIN_MSE_C

#define DETMON_QC_GAIN_MSE_C   "Measured Squared error in GAIN computation"

Definition at line 67 of file xsh_detmon_lg.h.

◆ DETMON_QC_LAMP_FLUX

#define DETMON_QC_LAMP_FLUX   "ESO QC LAMP FLUX"

Definition at line 78 of file xsh_detmon_lg.h.

◆ DETMON_QC_LAMP_FLUX_C

#define DETMON_QC_LAMP_FLUX_C   "Lamp flux"

Definition at line 79 of file xsh_detmon_lg.h.

◆ DETMON_QC_LAMP_STAB

#define DETMON_QC_LAMP_STAB   "ESO QC LAMP STAB"

Definition at line 85 of file xsh_detmon_lg.h.

◆ DETMON_QC_LAMP_STAB_C

#define DETMON_QC_LAMP_STAB_C   "Lamp stability"

Definition at line 86 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_COEF

#define DETMON_QC_LIN_COEF   "ESO QC LIN COEF"

Definition at line 97 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_COEF_C

#define DETMON_QC_LIN_COEF_C   "Linearity coefficient value"

Definition at line 98 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_COEF_ERR

#define DETMON_QC_LIN_COEF_ERR   "ESO QC LIN EFF ERR"

Definition at line 101 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_COEF_ERR_C

#define DETMON_QC_LIN_COEF_ERR_C   "Linearity coefficient error value"

Definition at line 102 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_COEF_MSE_ERR_C

#define DETMON_QC_LIN_COEF_MSE_ERR_C   "Linearity coefficient measured square error value"

Definition at line 103 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_EFF

#define DETMON_QC_LIN_EFF   "ESO QC LIN EFF"

Definition at line 91 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_EFF_C

#define DETMON_QC_LIN_EFF_C   "Effective non-linearity correction"

Definition at line 92 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_EFF_FLUX

#define DETMON_QC_LIN_EFF_FLUX   "ESO QC LIN EFF FLUX"

Definition at line 94 of file xsh_detmon_lg.h.

◆ DETMON_QC_LIN_EFF_FLUX_C

#define DETMON_QC_LIN_EFF_FLUX_C   "FLux level at which effective non-linearity correction is computed"

Definition at line 95 of file xsh_detmon_lg.h.

◆ DETMON_QC_METHOD

#define DETMON_QC_METHOD   "ESO QC METHOD"

Definition at line 88 of file xsh_detmon_lg.h.

◆ DETMON_QC_METHOD_C

#define DETMON_QC_METHOD_C   "Method applied to compute GAIN"

Definition at line 89 of file xsh_detmon_lg.h.

◆ DETMON_QC_NUM_BPM

#define DETMON_QC_NUM_BPM   "ESO QC NUM BPM"

Definition at line 81 of file xsh_detmon_lg.h.

◆ DETMON_QC_NUM_BPM_C

#define DETMON_QC_NUM_BPM_C
Value:
"Number of bad pixels detected according to "\
"polynomial information"

Definition at line 82 of file xsh_detmon_lg.h.

◆ DETMON_QC_RON

#define DETMON_QC_RON   "ESO QC RON"

Definition at line 69 of file xsh_detmon_lg.h.

◆ DETMON_QC_RON_C

#define DETMON_QC_RON_C   "RON obtained as independent term (PTC method)"

Definition at line 70 of file xsh_detmon_lg.h.

◆ IRPLIB_GAIN_COLLAPSE

#define IRPLIB_GAIN_COLLAPSE   ((irplib_gain_flag) 1 << 4)

Definition at line 155 of file xsh_detmon_lg.h.

◆ IRPLIB_GAIN_MEDIAN

#define IRPLIB_GAIN_MEDIAN   ((irplib_gain_flag) 1 << 2)

Definition at line 153 of file xsh_detmon_lg.h.

◆ IRPLIB_GAIN_NIR

#define IRPLIB_GAIN_NIR   ((irplib_gain_flag) 1 << 8)

Definition at line 159 of file xsh_detmon_lg.h.

◆ IRPLIB_GAIN_NO_COLLAPSE

#define IRPLIB_GAIN_NO_COLLAPSE   ((irplib_gain_flag) 1 << 3)

Definition at line 154 of file xsh_detmon_lg.h.

◆ IRPLIB_GAIN_OPT

#define IRPLIB_GAIN_OPT   ((irplib_gain_flag) 1 << 7)

Definition at line 158 of file xsh_detmon_lg.h.

◆ IRPLIB_GAIN_PTC

#define IRPLIB_GAIN_PTC   ((irplib_gain_flag) 1 << 1)

Definition at line 152 of file xsh_detmon_lg.h.

◆ IRPLIB_GAIN_WITH_AUTOCORR

#define IRPLIB_GAIN_WITH_AUTOCORR   ((irplib_gain_flag) 1 << 5)

Definition at line 156 of file xsh_detmon_lg.h.

◆ IRPLIB_GAIN_WITH_RESCALE

#define IRPLIB_GAIN_WITH_RESCALE   ((irplib_gain_flag) 1 << 6)

Definition at line 157 of file xsh_detmon_lg.h.

◆ IRPLIB_LIN_COLLAPSE

#define IRPLIB_LIN_COLLAPSE   ((irplib_lin_flag) 1 << 11)

Definition at line 164 of file xsh_detmon_lg.h.

◆ IRPLIB_LIN_NIR

#define IRPLIB_LIN_NIR   ((irplib_lin_flag) 1 << 15)

Definition at line 168 of file xsh_detmon_lg.h.

◆ IRPLIB_LIN_NO_COLLAPSE

#define IRPLIB_LIN_NO_COLLAPSE   ((irplib_lin_flag) 1 << 10)

Definition at line 163 of file xsh_detmon_lg.h.

◆ IRPLIB_LIN_OPT

#define IRPLIB_LIN_OPT   ((irplib_lin_flag) 1 << 14)

Definition at line 167 of file xsh_detmon_lg.h.

◆ IRPLIB_LIN_PIX2PIX

#define IRPLIB_LIN_PIX2PIX   ((irplib_lin_flag) 1 << 12)

Definition at line 165 of file xsh_detmon_lg.h.

◆ IRPLIB_LIN_WITH_RESCALE

#define IRPLIB_LIN_WITH_RESCALE   ((irplib_lin_flag) 1 << 13)

Definition at line 166 of file xsh_detmon_lg.h.

◆ NIR

#define NIR   TRUE

Definition at line 48 of file xsh_detmon_lg.h.

◆ OPT

#define OPT   FALSE

Definition at line 49 of file xsh_detmon_lg.h.

◆ REGEXP

#define REGEXP   "ARCFILE|MJD-OBS|ESO TPL ID|DATE-OBS|ESO DET DIT|ESO DET NDIT"

Definition at line 148 of file xsh_detmon_lg.h.

◆ xsh_detmon_lg_get_description

#define xsh_detmon_lg_get_description (   RECIPE_NAME,
  PIPE_NAME,
  DETMON_LG_ON_RAW_NEW,
  DETMON_LG_OFF_RAW_NEW,
  DETMON_LG_ON_RAW_OLD,
  DETMON_LG_OFF_RAW_OLD 
)
Value:
RECIPE_NAME " -- " PIPE_NAME " linearity/gain recipe for OPT/IR.\n" \
"The files listed in the Set Of Frames must be tagged:\n" \
"the raw-on-file.fits "DETMON_LG_ON_RAW_NEW" and\n" \
"the raw-off-file.fits "DETMON_LG_OFF_RAW_NEW"\n" \
"For backward compatibility are alternatively still supported the following tags:\n" \
"the raw-on-file.fits "DETMON_LG_ON_RAW_OLD" and\n" \
"the raw-off-file.fits "DETMON_LG_OFF_RAW_OLD"\n" \
"The recipe requires at least order+1 valid pairs of ON frames\n" \
"and order+1 valid pairs of OFF frames, \n" \
"where order is the value of the 'order' parameter.\n" \
"There is no requirement for pairs of OFF frames if collapse parameter " \
"is set to true.\n" \
"Frames with median flux over --filter will be excluded from the " \
"computation.\n" \
"To perform a stability check you need frames with at least 2 DIT " \
"values\n" \
"NOTE for multiextension cases: it is mandatory to modify the --exts " \
"parameter, either to -1 (all extensions) or to any valid extension nb.\n" \
"\n" \
"The output PRO.CATG are:\n" \
"GAIN_INFO - the gain table\n" \
"DET_LIN_INFO - the linearity table\n" \
"BP_MAP_NL - the bad pixel map (only produced with --pix2pix=TRUE)\n" \
"COEFFS_CUBE - the fit coefficient cube (only produced with --pix2pix=TRUE)\n"
#define DETMON_LG_OFF_RAW_OLD
Definition: xsh_detmon_lg.h:43
#define DETMON_LG_OFF_RAW_NEW
Definition: xsh_detmon_lg.h:45
#define DETMON_LG_ON_RAW_NEW
Definition: xsh_detmon_lg.h:44
#define DETMON_LG_ON_RAW_OLD
Definition: xsh_detmon_lg.h:42

Definition at line 118 of file xsh_detmon_lg.h.

Typedef Documentation

◆ irplib_gain_flag

typedef unsigned long irplib_gain_flag

Definition at line 150 of file xsh_detmon_lg.h.

◆ irplib_lin_flag

typedef unsigned long irplib_lin_flag

Definition at line 161 of file xsh_detmon_lg.h.

Function Documentation

◆ 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_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_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_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_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_set_tag()

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

◆ 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.