/home/amodigli/releases/xsh/1.2.10/pso/xsh.26608/xshp/xsh/xsh_detmon_lg.c File Reference

#include <complex.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include <cpl.h>
#include <cpl_fft.h>
#include "xsh_detmon.h"
#include "xsh_detmon_lg.h"
#include "xsh_detmon_lg_impl.h"
#include "xsh_irplib_utils.h"
#include "xsh_hist.h"

Go to the source code of this file.

Typedefs

typedef enum _FPN_METHOD FPN_METHOD

Enumerations

enum  _FPN_METHOD { FPN_UNKNOWN, FPN_HISTOGRAM, FPN_SMOOTH }

Functions

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, const int pos, unsigned mode, int *rows_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)
 Compute autocorr factor.
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)
 Lamp count rate computation (OPT only).
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_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_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
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, int *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)
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 (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_propertylist * 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).
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)

Variables

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
   cpl_boolean   split_coeffs
detmon_lg_config

Typedef Documentation

typedef enum _FPN_METHOD FPN_METHOD

Definition at line 70 of file xsh_detmon_lg.c.


Enumeration Type Documentation

Enumerator:
FPN_UNKNOWN 
FPN_HISTOGRAM 
FPN_SMOOTH 

Definition at line 64 of file xsh_detmon_lg.c.


Function Documentation

static cpl_propertylist* detmon_lg_extract_qclist_4plane ( cpl_propertylist *  linc_qclist,
const int  ip 
) [static]

Definition at line 3427 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_save().

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

Definition at line 6402 of file xsh_detmon_lg.c.

References irplib_calculate_total_noise().

Referenced by irplib_fpn_lg().

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

Definition at line 6484 of file xsh_detmon_lg.c.

Referenced by irplib_fpn_lg().

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

Definition at line 6647 of file xsh_detmon_lg.c.

References size.

Referenced by xsh_detmon_lg_reduce_dit().

static double irplib_fpn_lg ( const cpl_image *  f1,
int *  range,
double  gain,
FPN_METHOD  fpn_method,
int  smooth_size,
double *  mse 
) [static]
static cpl_imagelist * irplib_load_fset_wrp ( const cpl_frameset *  pframeset,
cpl_type  type,
int  whichext 
) [static]

Definition at line 6576 of file xsh_detmon_lg.c.

References detmon_lg_config.

Referenced by xsh_detmon_lg().

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

Definition at line 6611 of file xsh_detmon_lg.c.

References detmon_lg_config.

Referenced by xsh_detmon_lg().

static double irplib_pfits_get_dit ( const cpl_propertylist *  plist  )  [static]

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

Parameters:
plist Propertylist
Returns:
DIT value

Definition at line 3018 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().

static double irplib_pfits_get_dit_opt ( const cpl_propertylist *  plist  )  [static]

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

Parameters:
plist Propertylist
Returns:
DIT value

Definition at line 3031 of file xsh_detmon_lg.c.

References irplib_pfits_get_prop_double().

Referenced by xsh_detmon_lg_lamp_stab().

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:
plist propertylist
Returns:
dit value

Definition at line 429 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce_dit().

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

Definition at line 3051 of file xsh_detmon_lg.c.

Referenced by irplib_pfits_get_dit(), and irplib_pfits_get_dit_opt().

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

Definition at line 6620 of file xsh_detmon_lg.c.

References size.

Referenced by xsh_detmon_lg_reduce_dit().

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

Compute ADL column of Linearity Table.

Parameters:
table Table
Returns:
CPL_ERROR_NONE on success or corresponding cpl_error_code on error.

Definition at line 2959 of file xsh_detmon_lg.c.

References OPT.

Referenced by xsh_detmon_lg_reduce(), and xsh_detmon_lin().

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

Compute autocorr factor.

Parameters:
image Input image to be autocorrelated
pos DIT being processed (pos. in Corr imagelist)
autocorr_images Corr 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 3394 of file xsh_detmon_lg.c.

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

Referenced by xsh_detmon_gain_table_fill_row().

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

Definition at line 1219 of file xsh_detmon_lg.c.

References autocorr, nx, and ny.

Referenced by xsh_detmon_autocorr_factor().

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:
coeffs Coeffs' cube; each plane correspond to a coefficient
nbpixs Pointer to output total nb of bad pixels
Returns:
Bad pixel map

Definition at line 3311 of file xsh_detmon_lg.c.

References first, and size.

Referenced by xsh_detmon_lg_reduce_all(), and xsh_detmon_lin().

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

Definition at line 6676 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce_set().

static cpl_error_code xsh_detmon_fpn_compute ( const cpl_frameset *  set_on,
int *  index_on,
int  last_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 2466 of file xsh_detmon_lg.c.

References detmon_lg_config, DETMON_QC_FPN, irplib_fpn_lg(), gauss_res::mse, and skip_if.

Referenced by xsh_detmon_lg_reduce().

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_on Input ON imagelist
imlist_off Input OFF imagelist
exptimes Vector containing EXPTIME values corresponding to input imagelists
tolerance Tolerance allowed between EXPTIME of frames in a pair
llx Region to compute
lly Region to compute
urx Region to compute
ury Region to compute
kappa Kappa used for kappa-sigma clipping
nclip Number of iterative kappa-sigma clipping
xshift Shift applied on X axis (Autocorrelation)
yshift Shift applied on Y axis (Autocorrelation)
qclist QC list
mode Possible options (combined with bitwise or)
diff_imlist Output Difference imlist or NULL
autocorr_imlist Output 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,
                          IRPLIB_GAIN_NO_COLLAPSE |
                          IRPLIB_GAIN_NIR,
                          NULL, NULL);

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 5494 of file xsh_detmon_lg.c.

References autocorr, DETMON_QC_AUTOCORR, DETMON_QC_AUTOCORR_C, DETMON_QC_METHOD, DETMON_QC_METHOD_C, end_skip, IRPLIB_GAIN_COLLAPSE, IRPLIB_GAIN_NO_COLLAPSE, IRPLIB_GAIN_OPT, IRPLIB_GAIN_PTC, IRPLIB_GAIN_WITH_AUTOCORR, IRPLIB_GAIN_WITH_RESCALE, method, NIR, OPT, opt_nir, skip_if, 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().

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

Definition at line 5710 of file xsh_detmon_lg.c.

References end_skip, NIR, and skip_if.

Referenced by xsh_detmon_gain(), and xsh_detmon_lg_reduce_init().

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,
const int  pos,
unsigned  mode,
int *  rows_affected 
) [static]

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

Parameters:
gain_table Gain table
autocorr_images Corr images (intermediate product)
diff_flats Diff flats (intermediate product)
ons Images of the ON pair
offs Images of the OFF pair
pos DIT being processed (entry pos. in table)

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 3095 of file xsh_detmon_lg.c.

References autocorr, end_skip, IRPLIB_GAIN_COLLAPSE, IRPLIB_GAIN_NIR, IRPLIB_GAIN_NO_COLLAPSE, IRPLIB_GAIN_OPT, IRPLIB_GAIN_WITH_AUTOCORR, sigma, skip_if, xsh_detmon_autocorr_factor(), xsh_detmon_lg_add_empty_image(), and xsh_ksigma_clip().

Referenced by xsh_detmon_gain(), and xsh_detmon_lg_reduce_dit().

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

Definition at line 1049 of file xsh_detmon_lg.c.

References nx, and ny.

Referenced by xsh_detmon_autocorr_factor().

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 
)
static void xsh_detmon_lg_add_empty_image ( cpl_imagelist *  imlist,
int  pos 
) [static]

Definition at line 6722 of file xsh_detmon_lg.c.

References first, x, and y.

Referenced by xsh_detmon_gain_table_fill_row().

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:
x X_FIT column of the gain table
x Y_FIT column of the gain table
Returns:
true if the data are not zero

Definition at line 5189 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_qc_med(), and xsh_detmon_lg_qc_ptc().

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:
reference Reference image for default definition
Returns:
CPL_ERROR_NONE or corresponding cpl_error_code() on error.

Definition at line 2087 of file xsh_detmon_lg.c.

References detmon_lg_config, nx, and ny.

Referenced by xsh_detmon_lg().

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_on Frames tagged ON
cur_fset_off Frames tagged OFF
nsets_on Number of different labels
whichext Extension being processed
whichset Setting being processed
recipe_name Recipe name
pipeline_name Pipeline_name
pafregexp Regexp of instrument-specific keywords for PAF
procatg_lintbl PROCATG of the Linearity Table product (pr.)
procatg_gaintbl PROCATG of the Gain Table pr.
procatg_coeffscube PROCATG of the Polynomial Coefficients Cube pr.
procatg_bpm PROCATG of the Bad Pixel Map pr.
procatg_diff PROCATG of the Difference Image intermediate pr. (only produced if --intermediate=TRUE)
procatg_corr PROCATG of the Autocorrelation Image intermediate pr. (only produced if --intermediate=TRUE)
package Package identifier
load_fset Loading function for preprocessing of input frames with special data format (needed for AMBER and MIDI processing)
nsets Number of different settings
opt_nir Boolean for OPT/NIR cases
frameset Input frameset
parlist Input parlist
cur_fset Used frames
Returns:
CPL_ERROR_NONE or corresponding cpl_error_code on error.

Definition at line 920 of file xsh_detmon_lg.c.

References detmon_lg_config, end_skip, load_fset, skip_if, xsh_detmon_lg_reduce(), and xsh_detmon_lg_save().

Referenced by xsh_detmon_lg_reduce_set().

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 6707 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_save_cube().

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

Lamp count rate computation (OPT only).

Parameters:
frameset Current frameset
ext Current extension being processed
Returns:
CPL_ERROR_NONE or cpl_error_code on error. DFS related function
Parameters:
set Frameset
tag_on ON tag
tag_off OFF tag
Returns:
0 on success.

Definition at line 4557 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg().

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:
frameset Input frameset
gaint_qclist PROCATG of the Gain Table pr.
lint_qclist PROCATG of the Linearity Table product (pr.)
linc_qclist PROCATG of the Linearity Table product (pr.)
bpm_qclist PROCATG of the Bad Pixel Map pr.
whichext Extension being processed

Definition at line 3452 of file xsh_detmon_lg.c.

References detmon_lg_config.

Referenced by xsh_detmon_lg_save().

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:
parlist Pointer to parlist where parameters will be inserted
recipe_name Recipe name (used for parameter name construction)
pipeline_name Pipeline name (used for parameter name construction)
method Method to be used for Gain computation
order Order of the polynomial linearity fitting
kappa Kappa value for kappa-sigma clipping (used for Gain)
niter Number of iterations in kappa-sigma clipping
threshold_min Minimum threshold (not used now)
threshold_max Maximum threshold (not used now)
llx Lower left point of the ROI, x-coordinate
lly Lower left point of the POI, y-coordinate
urx Upper right point of the ROI, x-coordinate
ury Upper right point of the POI, y-coordinate
ref_level Reference level to compute Linearity Correction
threshold Threshold (not used now)
intermediate String. Must be <"CPL_FALSE"|"CPL_TRUE">
autocorr String. Must be <"CPL_FALSE"|"CPL_TRUE">
collapse String. Must be <"CPL_FALSE"|"CPL_TRUE">
rescale String. Must be <"CPL_FALSE"|"CPL_TRUE">
pix2pix String. Must be <"CPL_FALSE"|"CPL_TRUE">
filter Level to filter saturated frames
m X-axis shift of the autocorrelation
n Y-axis shift of the autocorrelation
llx1 llx for contamination - 1. region (OPT only)
lly1 lly for contamination - 1. region (OPT only)
urx1 urx for contamination - 1. region (OPT only)
ury1 ury for contamination - 1. region (OPT only)
llx2 llx for contamination - 2. region (OPT only)
lly2 lly for contamination - 2. region (OPT only)
urx2 urx for contamination - 2. region (OPT only)
ury2 ury for contamination - 2. region (OPT only)
llx3 llx for contamination - 3. region (OPT only)
lly3 lly for contamination - 3. region (OPT only)
urx3 urx for contamination - 3. region (OPT only)
ury3 ury for contamination - 3. region (OPT only)
llx4 llx for contamination - 4. region (OPT only)
lly4 lly for contamination - 4. region (OPT only)
urx4 urx for contamination - 4. region (OPT only)
ury4 ury for contamination - 4. region (OPT only)
llx5 llx for contamination - 5. region (OPT only)
lly5 lly for contamination - 5. region (OPT only)
urx5 urx for contamination - 5. region (OPT only)
ury5 ury for contamination - 5. region (OPT only)
exts Extension to be computed
opt_nir Controls 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 1539 of file xsh_detmon_lg.c.

References xsh_detmon_fill_parlist().

Referenced by xsh_detmon_lg_fill_parlist_nir_default(), and xsh_detmon_lg_fill_parlist_opt_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:
parlist Pointer to parlist where parameters will be inserted
recipe_name Recipe name (used for parameter name construction)
pipeline_name Pipeline 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 1359 of file xsh_detmon_lg.c.

References NIR, and xsh_detmon_lg_fill_parlist().

Referenced by xsh_lingain_fill_parlist_default_nir().

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:
parlist Pointer to parlist where parameters will be inserted
recipe_name Recipe name (used for parameter name construction)
pipeline_name Pipeline 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 1428 of file xsh_detmon_lg.c.

References OPT, and xsh_detmon_lg_fill_parlist().

Referenced by xsh_lingain_fill_parlist_default_opt().

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

Definition at line 5760 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lin().

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 5795 of file xsh_detmon_lg.c.

References size.

Referenced by xsh_detmon_gain().

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_ptr Pointer to output coeffs' cube imagelist
bpms_ptr Pointer to output bpm image

Definition at line 4600 of file xsh_detmon_lg.c.

References detmon_lg_config.

Referenced by xsh_detmon_lg_reduce_all().

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:
lamps Lamps (ON) sub-frameset
darks Darks (OFF) sub-frameset
opt_nir Boolean to make difference between OPT and NIR cases
Returns:
CPL_ERROR_NONE or corresponding cpl_error_code().

Definition at line 2528 of file xsh_detmon_lg.c.

References detmon_lg_config, end_skip, irplib_pfits_get_dit(), irplib_pfits_get_dit_opt(), and skip_if.

Referenced by xsh_detmon_lg_reduce().

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:
pcoeffs Pointer to array of polynomial coefficients of the fit
qclist qclist
ref_level reference 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 4965 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, end_skip, and skip_if.

Referenced by xsh_detmon_lg_reduce_all(), and xsh_detmon_lin().

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_table Gain Table (with data required by the method)
qclist qclist
Returns:
CPL_ERROR_NONE or cpl_error_code on error.

Definition at line 5220 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, end_skip, skip_if, x, xsh_detmon_lg_check_before_gain(), and y.

Referenced by xsh_detmon_gain(), and xsh_detmon_lg_reduce_all().

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_table Gain Table (with data required by the method)
qclist qclist
Returns:
CPL_ERROR_NONE or cpl_error_code on error.

Definition at line 5056 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, end_skip, IRPLIB_GAIN_WITH_AUTOCORR, irplib_polynomial_fit_1d_create(), irplib_polynomial_fit_1d_create_chiq(), gauss_res::mse, skip_if, x, xsh_detmon_lg_check_before_gain(), and y.

Referenced by xsh_detmon_gain(), and xsh_detmon_lg_reduce_all().

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_on ON sub-frameset
set_off OFF sub-frameset
nsets_extracted Number of different labels (DITs)
coeffs_ptr Pointer to output coeffs imagelist
gain_table Gain table
linear_table Linearity table
bpm_ptr Pointer to output bad pixel map
autocorr_images Corr imagelist (intermediate product)
diff_flats Diff imagelist (intermediate product)
qclist qclist
load_fset Loading function for preprocessing of input frames with special data format (needed for AMBER and MIDI processing)
opt_nir Boolean to differ OPT and NIR cases
whichext Extension 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 2270 of file xsh_detmon_lg.c.

References detmon_lg_config, DETMON_QC_GAIN, end_skip, first, load_fset, skip_if, xsh_detmon_add_adl_column(), xsh_detmon_fpn_compute(), 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().

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_table Linearity Table
qclist qclist
coeffs_ptr Pointer to output coeffs' cube imagelist
bpms_ptr Pointer to output bpm image
linearity_inputs Input imagelist for pix2pix fitting
gain_table Gain Table
whichext Extension being currently processed
Returns:
CPL_ERROR_NONE on success or corresponding cpl_error_code on error.

Definition at line 4680 of file xsh_detmon_lg.c.

References autocorr, detmon_lg_config, 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, end_skip, first, irplib_ensure, IRPLIB_GAIN_WITH_AUTOCORR, irplib_polynomial_fit_1d_create(), mode, gauss_res::mse, NIR, skip_if, x, xsh_detmon_bpixs(), 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().

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_affected 
) [static]

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

Parameters:
set_on ON sub-frameset
dit_nb DIT of frames to be processed in this call
nsets_extracted Number of different labels (DITs)
set_off OFF sub-frameset
selection_off Array of labels to identify pairs in set_off
linear_table Linearity table
gain_table Gain table
linearity_inputs Imagelist to be input of pix2pix fitting
qclist qclist
opt_nir Boolean to differ OPT and NIR cases
autocorr_images Corr imagelist (intermediate product)
diff_flats Diff imagelist (intermediate product)
opt_offs OFF imagelist used in OPT (eq. for all DITs)
whichext Extension 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 2692 of file xsh_detmon_lg.c.

References collapse, detmon_lg_config, end_skip, 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, skip_if, xsh_detmon_gain_table_fill_row(), 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().

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_table Gain Table
linear_table Linearity Table
linearity_inputs Imagelist to be input of pix2pix fitting
Returns:
CPL_ERROR_NONE on success or corresponding cpl_error_code on error.

Definition at line 2992 of file xsh_detmon_lg.c.

References detmon_lg_config, end_skip, skip_if, xsh_detmon_gain_table_create(), and xsh_detmon_lin_table_create().

Referenced by xsh_detmon_lg_reduce().

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,
int *  selection 
) [static]
static cpl_error_code xsh_detmon_lg_rescale ( cpl_imagelist *  to_rescale  )  [static]

Rescale of images (one to another level).

Parameters:
to_rescale Imagelist 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 5296 of file xsh_detmon_lg.c.

References end_skip, and skip_if.

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

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:
parlist Parlist
recipe_name Recipe name (used for parameter name construction)
pipeline_name Pipeline name (used for parameter name construction)
opt_nir Boolean to make difference between OPT and NIR cases
Returns:
CPL_ERROR_NONE or corresponding cpl_error_code() on error.

Definition at line 1783 of file xsh_detmon_lg.c.

References detmon_lg_config, FPN_HISTOGRAM, FPN_SMOOTH, OPT, xsh_detmon_retrieve_par_double(), and xsh_detmon_retrieve_par_int().

Referenced by xsh_detmon_lg().

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:
frameset Input frameset
parlist Input parlist
recipe_name Recipe name
pipeline_name Pipeline_name
pafregexp Regexp of instrument-specific keywords for PAF
procatg_lintbl PROCATG of the Linearity Table product (pr.)
procatg_gaintbl PROCATG of the Gain Table pr.
procatg_coeffscube PROCATG of the Polynomial Coefficients Cube pr.
procatg_bpm PROCATG of the Bad Pixel Map pr.
procatg_corr PROCATG of the Autocorrelation Image intermediate pr. (only produced if --intermediate=TRUE)
procatg_diff PROCATG of the Difference Image intermediate pr. (only produced if --intermediate=TRUE)
package Package identifier
coeffs Coefficients' cube
gain_table Gain Table
linear_table Linearity Table
bpms Bad Pixel Map
autocorr_images Autocorrelation Images
diff_flats Difference Images
qclist qclist
flag_sets Flag to indicate if there is more than a setting
which_set Current setting
usedframes usedframes
whichext Extension being processed
Returns:
CPL_ERROR_NONE or corresponding cpl_error_code on error. ---------------------------------------------------------------------------

Definition at line 3904 of file xsh_detmon_lg.c.

References detmon_lg_config, detmon_lg_extract_qclist_4plane(), end_skip, skip_if, xsh_detmon_lg_extract_extention_header(), 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().

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:
parlist Input parlist
frameset Input frameset
usedframes usedframes
whichext Extension being processed
recipe_name Recipe name
mypro_coeffscube cube header
mypro_coeffscube cube QC header
package Package identifier
NAME_O cube filename
coeffs Coefficients' cube
Returns:
CPL_ERROR_NONE or corresponding cpl_error_code on error. ---------------------------------------------------------------------------

Definition at line 3686 of file xsh_detmon_lg.c.

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

Referenced by xsh_detmon_lg_save().

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:
image Image to save
name_o Output filename
xheader extention header
Returns:
CPL_ERROR opr none

Definition at line 3550 of file xsh_detmon_lg.c.

References xsh_detmon_load_pro_keys().

Referenced by xsh_detmon_lg_save(), and xsh_detmon_lg_save_plane().

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:
image Image to save
name_o Output filename
xheader extention header
Returns:
CPL_ERROR opr none

Definition at line 3577 of file xsh_detmon_lg.c.

References xsh_detmon_load_pro_keys().

Referenced by xsh_detmon_lg_save_cube().

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]
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:
parlist Input parlist
frameset Input frameset
usedframes usedframes
whichext Extension being processed
recipe_name Recipe name
mypro_coeffscube cube header
mypro_coeffscube cube QC header
package Package identifier
NAME_O cube filename
plane Coefficients' cube plane
Returns:
CPL_ERROR_NONE or corresponding cpl_error_code on error. ---------------------------------------------------------------------------

Definition at line 3613 of file xsh_detmon_lg.c.

References detmon_lg_config, and xsh_detmon_lg_save_image_with_pro_keys().

Referenced by xsh_detmon_lg_save().

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:
image Image to save
name_o Output filename
xheader extention header
CPL_IO_MODE IO mode
Returns:
CPL_ERROR opr none

Definition at line 3513 of file xsh_detmon_lg.c.

References xsh_detmon_load_pro_keys().

Referenced by xsh_detmon_lg_save().

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 3730 of file xsh_detmon_lg.c.

References detmon_lg_config.

Referenced by xsh_detmon_lg_save_paf_product().

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 3777 of file xsh_detmon_lg.c.

References detmon_lg_config.

Referenced by xsh_detmon_lg_save_paf_product().

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_fset Pointer to input frameset
cur_fset_on Pointer to output ON sub-frameset
cur_fset_off Pointer to output OFF sub-frameset
tag_on Tag to identify ON frames
tag_off Tag to identify OFF frames
opt_nir Boolean to make difference between OPT and NIR
Returns:
CPL_ERROR_NONE or corresponding cpl_error_code() on error.

Definition at line 2185 of file xsh_detmon_lg.c.

References detmon_lg_config, end_skip, first, OPT, opt_nir, and skip_if.

Referenced by xsh_detmon_lg_reduce_set().

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_on Input ON imagelist
imlist_off Input OFF imagelist
exptimes Vector containing EXPTIME values corresponding to input imagelists
tolerance Tolerance allowed between EXPTIME of frames in a pair
llx Region to compute
lly Region to compute
urx Region to compute
ury Region to compute
order polynomial order used to fit linearity relation
ref_level reference level used in the construction of the polynomial F_m(F_r) from F_m(t), using F_r = a_1 * t
kappa kappa used in kappa-sigma clipping
bpmbin switch to De-/Activate the binary bpm option
qclist QC list
mode Possible options (combined with bitwise or)
coeffs_cube Output Coefficients Cube (only if IRPLIB_LIN_PIX2PIX)
bpm Bad 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,
                        IRPLIB_LIN_NO_COLLAPSE |
                        IRPLIB_LIN_NIR,
                        NULL, NULL);

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 5923 of file xsh_detmon_lg.c.

References 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, end_skip, first, irplib_ensure, IRPLIB_LIN_COLLAPSE, IRPLIB_LIN_NO_COLLAPSE, IRPLIB_LIN_OPT, IRPLIB_LIN_PIX2PIX, IRPLIB_LIN_WITH_RESCALE, irplib_polynomial_fit_1d_create_chiq(), gauss_res::mse, NIR, OPT, opt_nir, skip_if, 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.

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

Definition at line 5741 of file xsh_detmon_lg.c.

References end_skip, NIR, and skip_if.

Referenced by xsh_detmon_lg_reduce_init(), and xsh_detmon_lin().

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_table Linearity Table
linearity_inputs Imagelist for later use in algorithm
ons Images of the ON pair
offs Images of the OFF pai
llx lower left x
lly lower left y
urx upper right x
ury upper right y
pos Position in table
nskip Positions to skip (due to saturated images)
mode switch to know if OPT or NIR mode

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 6317 of file xsh_detmon_lg.c.

References IRPLIB_LIN_NIR, IRPLIB_LIN_NO_COLLAPSE, IRPLIB_LIN_OPT, and IRPLIB_LIN_PIX2PIX.

Referenced by xsh_detmon_lg_reduce_dit(), and xsh_detmon_lin().

static cpl_propertylist* xsh_detmon_load_pro_keys ( const char *  NAME_O  )  [static]

Load pro keys.

Parameters:
NAME_O product file name

Definition at line 3043 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().

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:
reduced Image to compute contamination
qclist qclist 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 4390 of file xsh_detmon_lg.c.

References detmon_lg_config, DETMON_QC_CONTAM, DETMON_QC_CONTAM_C, end_skip, IRPLIB_LIN_COLLAPSE, IRPLIB_LIN_NO_COLLAPSE, and skip_if.

Referenced by xsh_detmon_lg_reduce_dit().

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 5320 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce_dit().

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 5370 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce_dit().

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

Definition at line 2433 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce().


Variable Documentation

cpl_boolean autocorr
cpl_boolean bpmbin

Definition at line 116 of file xsh_detmon_lg.c.

cpl_boolean collapse

Definition at line 113 of file xsh_detmon_lg.c.

Referenced by xsh_detmon_lg_reduce_dit(), and xsh_detmon_lin().

double cr

Definition at line 122 of file xsh_detmon_lg.c.

struct { ... } detmon_lg_config [static]
int exts

Definition at line 123 of file xsh_detmon_lg.c.

int filter

Definition at line 117 of file xsh_detmon_lg.c.

Referenced by xsh_image_smooth_fft().

Definition at line 134 of file xsh_detmon_lg.c.

Definition at line 135 of file xsh_detmon_lg.c.

cpl_boolean intermediate

Definition at line 112 of file xsh_detmon_lg.c.

double kappa

Definition at line 76 of file xsh_detmon_lg.c.

cpl_boolean lamp_ok

Definition at line 126 of file xsh_detmon_lg.c.

Definition at line 125 of file xsh_detmon_lg.c.

int llx

Definition at line 80 of file xsh_detmon_lg.c.

int llx1

Definition at line 88 of file xsh_detmon_lg.c.

int llx2

Definition at line 92 of file xsh_detmon_lg.c.

int llx3

Definition at line 96 of file xsh_detmon_lg.c.

int llx4

Definition at line 100 of file xsh_detmon_lg.c.

int llx5

Definition at line 104 of file xsh_detmon_lg.c.

int lly

Definition at line 81 of file xsh_detmon_lg.c.

int lly1

Definition at line 89 of file xsh_detmon_lg.c.

int lly2

Definition at line 93 of file xsh_detmon_lg.c.

int lly3

Definition at line 97 of file xsh_detmon_lg.c.

int lly4

Definition at line 101 of file xsh_detmon_lg.c.

int lly5

Definition at line 105 of file xsh_detmon_lg.c.

int(* load_fset)(const cpl_frameset *, cpl_type, cpl_imagelist *)
cpl_imagelist*(* load_fset_wrp)(const cpl_frameset *, cpl_type, int)
int m
const char* method

Definition at line 73 of file xsh_detmon_lg.c.

int n

Definition at line 124 of file xsh_detmon_lg.c.

int niter
int nx

Definition at line 108 of file xsh_detmon_lg.c.

Referenced by compute_specres(), create_blaze(), detect_centroid(), fill_img(), irplib_fit_imagelist_polynomial(), irplib_fit_imagelist_residual(), irplib_image_split(), main(), make_data_cube(), set_masterdark_qc(), subtract_background(), xsh_badpixelmap_coadd(), xsh_bpmap_bitwise_to_flag(), xsh_bpmap_collapse_bpmap_create(), xsh_bpmap_collapse_mean(), xsh_bpmap_collapse_median(), xsh_bpmap_mask_bad_pixel(), xsh_collapse_errs(), xsh_compute_noise_map(), xsh_create_master_bpmap(), xsh_detect_continuum(), xsh_detect_edges(), xsh_detmon_autocorrelate(), xsh_detmon_image_correlate(), xsh_detmon_lg_check_defaults(), xsh_detmon_pernoise(), xsh_detmon_ronbias_check_defaults(), xsh_detmon_ronbias_preoverscan(), xsh_detmon_ronbias_region(), 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_follow_arclines(), xsh_frameset_add(), xsh_frameset_average_pre(), xsh_ifu_trace_object_calibrate(), xsh_image_3d_get_size_x(), xsh_image_3d_insert(), xsh_image_clean_badpixel(), xsh_image_clean_mask_pixs(), xsh_image_create_gaussian_image(), xsh_image_create_model_image(), 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_gaussian_fit_y(), xsh_image_local_cold_pixs(), xsh_image_local_hot_pixs(), xsh_image_mult_1D(), xsh_image_warp_polynomial_scale(), xsh_imagelist_collapse_sigclip_iter_create(), xsh_ksigma_clip(), xsh_my_detmon_ronbias_preoverscan(), xsh_my_detmon_ronbias_region(), xsh_normalize_spectrum_image(), xsh_opt_extract_orders(), xsh_optextract_produce_model(), xsh_order_table_from_fmtchk(), xsh_pre_data_window_median_flux_pa(), xsh_pre_data_window_sample_flux_pa(), xsh_pre_median_mean_stdev(), xsh_pre_median_mean_stdev_window(), xsh_rec_list_rectify(), xsh_remove_cr(), xsh_subtract_background(), xsh_util_ima_oversample(), xsh_util_ima_rebin(), xsh_util_ima_subsample(), xsh_wavelist_subtract_sky(), xsh_wavemap_lambda_range(), xsh_wavemap_list_new(), xsh_wavemap_list_save(), and xsh_wavemap_list_save2().

int ny

Definition at line 109 of file xsh_detmon_lg.c.

Referenced by compute_specres(), create_blaze(), detect_centroid(), fill_img(), irplib_fit_imagelist_polynomial(), irplib_image_split(), main(), make_data_cube(), set_masterdark_qc(), subtract_background(), xsh_badpixelmap_coadd(), xsh_bpmap_bitwise_to_flag(), xsh_bpmap_collapse_bpmap_create(), xsh_bpmap_collapse_mean(), xsh_bpmap_collapse_median(), xsh_bpmap_mask_bad_pixel(), xsh_collapse_errs(), xsh_compute_noise_map(), xsh_create_master_bpmap(), xsh_detect_max_y(), xsh_detect_order_edge(), xsh_detmon_autocorrelate(), xsh_detmon_image_correlate(), xsh_detmon_lg_check_defaults(), xsh_detmon_pernoise(), xsh_detmon_ronbias_check_defaults(), xsh_detmon_ronbias_preoverscan(), xsh_detmon_ronbias_region(), 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_follow_arclines(), xsh_frameset_add(), xsh_frameset_average_pre(), xsh_ifu_trace_object_calibrate(), xsh_image_3d_get_size_y(), xsh_image_3d_insert(), xsh_image_clean_badpixel(), xsh_image_clean_mask_pixs(), xsh_image_create_gaussian_image(), xsh_image_create_model_image(), 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_gaussian_fit_y(), xsh_image_local_cold_pixs(), xsh_image_local_hot_pixs(), xsh_image_mult_1D(), xsh_image_warp_polynomial_scale(), xsh_imagelist_collapse_sigclip_iter_create(), xsh_ksigma_clip(), xsh_model_reduce(), xsh_my_detmon_ronbias_preoverscan(), xsh_my_detmon_ronbias_region(), xsh_normalize_spectrum_image(), xsh_opt_extract_orders(), xsh_order_table_from_fmtchk(), xsh_pre_data_window_median_flux_pa(), xsh_pre_data_window_sample_flux_pa(), xsh_pre_median_mean_stdev(), xsh_pre_median_mean_stdev_window(), xsh_rec_list_rectify(), xsh_remove_cr(), xsh_util_ima_oversample(), xsh_util_ima_rebin(), xsh_util_ima_subsample(), xsh_wavelist_subtract_sky(), xsh_wavemap_lambda_range(), xsh_wavemap_list_new(), xsh_wavemap_list_save(), and xsh_wavemap_list_save2().

int order
cpl_boolean pafgen

Definition at line 119 of file xsh_detmon_lg.c.

const char* pafname

Definition at line 120 of file xsh_detmon_lg.c.

cpl_boolean pix2pix

Definition at line 115 of file xsh_detmon_lg.c.

int ref_level

Definition at line 84 of file xsh_detmon_lg.c.

cpl_boolean rescale

Definition at line 114 of file xsh_detmon_lg.c.

Definition at line 136 of file xsh_detmon_lg.c.

cpl_boolean split_coeffs

Definition at line 137 of file xsh_detmon_lg.c.

int threshold

Definition at line 79 of file xsh_detmon_lg.c.

Definition at line 78 of file xsh_detmon_lg.c.

double tolerance

Definition at line 118 of file xsh_detmon_lg.c.

Referenced by xsh_cfg_recover_pattern_match(), xsh_gain(), and xsh_ksigma_clip().

int urx

Definition at line 82 of file xsh_detmon_lg.c.

int urx1

Definition at line 90 of file xsh_detmon_lg.c.

int urx2

Definition at line 94 of file xsh_detmon_lg.c.

int urx3

Definition at line 98 of file xsh_detmon_lg.c.

int urx4

Definition at line 102 of file xsh_detmon_lg.c.

int urx5

Definition at line 106 of file xsh_detmon_lg.c.

int ury

Definition at line 83 of file xsh_detmon_lg.c.

int ury1

Definition at line 91 of file xsh_detmon_lg.c.

int ury2

Definition at line 95 of file xsh_detmon_lg.c.

int ury3

Definition at line 99 of file xsh_detmon_lg.c.

int ury4

Definition at line 103 of file xsh_detmon_lg.c.

int ury5

Definition at line 107 of file xsh_detmon_lg.c.

cpl_boolean wholechip

Definition at line 110 of file xsh_detmon_lg.c.


Generated on 9 Mar 2011 for X-shooter Pipeline Reference Manual by  doxygen 1.6.1