    Name                    Type    Description                                             Status
cr2res_cal_detlin                                                                          
    QC DETLIN NBBAD         int     The number of bad pixels computed                       TODO
    QC DETLIN NBSUCCESS     int     The number of pixels where the polynomial               TODO
                                    fitting succeeds
    QC DETLIN NBFAILED      int     The number of pixels where the polynomia                TODO
                                    fitting fails
    QC DETLIN MEDIAN        double  The detlin median non-linearity                         TODO
    QC DETLIN MINLEVEL      double  The detlin minimum level                                TODO
    QC DETLIN MAXLEVEL      double  The detlin maximum level                                TODO

cr2res_cal_dark                                                                             
    ESO QC DARK RON1        double  Measured read-out noise (1-2) on the whole array        DONE
    ESO QC DARK RON2        double  Measured read-out noise (3-2) on the whole array        DONE
    ESO QC DARK MEAN        double  Average of the master dark                              DONE
    ESO QC DARK MEDIAN      double  Median of the master dark                               DONE
    ESO QC DARK STDDEV      double  Standard dev. of the master dark                        DONE
    ESO QC DARK NBAD        int     The number of bad pixels                                DONE

    Detector pickup noise
    Template: CRIRES_spec_cal_Darks
    There is a new method recently introduced for UVES and Xshooter that characterises pickup noise on their detectors via 
    Fourier transforms. Presumably the Xshooter NIR arm is the most relevant example for CRIRES+. Please investigate if this 
    can be adapted.

cr2res_cal_flat (https://jira.eso.org/browse/PIPE-9388)
    ESO QC FLAT MEAN        double  mean flux, over the illuminated area, of the 1st        DONE
                                    input RAW frame 
    ESO QC FLAT MEDIAN      double  median flux, over the illuminated area, of the 1st      DONE
                                    input RAW frame 
    ESO QC FLAT EFFICIENCY  double  mean flux of the 1st raw/DIT                            DONE
    ESO QC FLAT RMS         double  rms measured over the illuminated area of the MASTER    DONE
                                    lampflat
    ESO QC FLAT S2NMED      double                                                          TODO                   
        
    ESO QC FLAT ORDERPOSi   double  Y position of the center of the order                   DONE    
    ESO QC FLAT TRACE CENTERY double  Y Position of the center order at the center of the   DONE
                                      detector  
    ESO QC FLAT NBBAD       int     The number of bad pixels

cr2res_cal_wave (https://jira.eso.org/browse/PIPE-9389)
    ESO QC WAVE BESTXCORR-order-trace   double  The solution cross correlation factor for   DONE
                                                each order and traces
    ESO QC WAVE CENTWL                  double  Wavelength at x=1024 order INS.GRAT1.ORDER  DONE
        Description:    Central wavelength of a given order


    ESO QC WAVE RESPOW      double                                                          TODO
        Description:    Spectral resolution in L & M bands
        Deadline PAC
        DRS: For the moment we will simply measure the FWHM of the 3392.22nm laser line in the L3412 setting with 0.2” and 
        0.4” slits. R=D_lambda/3392.22nm, where D_lambda is FWHM_pix * local wavelength scale (in nm/pix).
        Later we aim to use sky lines for L and M-band resolution monitoring (molecfit on ozone lines), but this is not a 
        priority now.

    ESO QC WAVE RESOL FWHM[N=1-5]   double  
        Description:    Spectral resolution from UNe
        Deadline    01.08.2021
        Need as input for each setting the list of 5 lines positions. Stored in a dedicated static calibration file
        Need a utilities to create the FITS file from a TXT input.
        For each position, measure the FWHM for lines in the provided list, Calculate R=D_lambda/lambda, where D_lambda is 
        FWHM_pix * local wavelength scale (in nm/pix). 

    ESO QC HCL UFLUX        double                                                          TODO
        Description:    UNe Lamp flux for UNe
        Deadline PAC
        Use as input the same list of lines as ESO QC WAVE RESOL FWHM[N=1-5]
            measure flux in lines in the list and output the average of the 5.

    ESO QC FPI CONTRAST     double                                                          TODO
        Description:    Fabry Perot Interferometer (Etalon) contrast
        Deadline PAC
        measure Imax and Imin (peak and trough flux in the extracted 1D spectrum) for each fringe on the 
        central order on the central detector and compute (Imax-Imin)/(Imax+Imin), output the mean value.

    ESO QC FPI SEPARATION   double                                                          TODO
        Description:    Fabry Perot Interferometer (Etalon) wavelength interval
        Deadline PAC
        For the central order on the central detector the first and last fully visible fringes are identified, their 
        centroids are measured in wavelength space and the number, N, of fringes separating them are counted, then the 
        wavelength interval is calculated as (wlen_end_fringe-wlen_start_fringe)/N

    ESO QC SGC WAVE CEN     double                                                          TODO
        Description:    Central wavelength in YJHK from Short Gas Cell spectrum
        Deadline PAC
        Additional input to be provided: SGC spectrum
        DRS: Output wavelength at pix 1024 on middle detector for the default central order (as defined in crmcfgWLEN table) 
        of the given standard setting as determined for the SGC spectrum.
        Question: I don’t remember, is a wavelength calibration with the gas cell already possible, or would this be a 
        significant development? (In the latter case I would make this LOW priority)

cr2res_obs_nodding

    ESO QC STANDARD FLUX    double  Mean of extracted between 2 specified Wavelengths      DONE
                                    for the 4th order spectrum
        Description:    Fractional throughput
        Need a wl_start/wl_end depending on the setting. Only produced if the setting is supported
        Values hardcoded - Provided by Jonathan before end of June

    ESO QC OVEREXPOSED      double  Number of Pixels above a certain threshold              DONE




======================================================================================
Other Requirements
======================================================================================
Central wavelength in L & M bands: ESO QC SKY WAVE CEN[L/M]
Template: CRIRES_spec_cal_SkyObs
Additional input to be provided: CRIRES_spec_cal_SkyObs to be tested in comm3; list of suitable emission lines (a twilight test will be attempted in comm3)
DRS: Output wavelength at pix 1024 on middle detector for the default central order (as defined in crmcfgWLEN table) of the given standard setting as determined for the sky emission lines

Order merging discontinuities ESO QC ORDER OVERLAP FLUX DIFF
Template: CRIRES_spec_cal_Lampflat
DRS: From the wavelength solution compute compute wavelength range of the Y-band orders that overlap. Compute the mean flux in these ranges for each pair of orders and compute the difference between the pair. Then sum the absolute value of each difference and divide by the number of pairs.

Fabry Perot Interferometer (Etalon) lamp flux: ESO QC FPI FLUX
Template: CRIRES_spec_cal_Wave
DRS: While computing ESO QC FPI CONTRASTJ also compute the mean Imax

Optical Ghosts: ESO QC LITTROW GHOST FLUX; ESO QC LASER GHOST FLUX
Template: cr2res_cal_flat, CRIRES_spec_cal_Wave (with laser)
Additional input to be provided: Co-odinates of (inter-order) area on science detector for littrow ghost evaluation; Co-odinates of area on science detector for laser ghost evaluation
DRS: For flat fields, after dark subtraction, sum the flux in the designated littrow ghost evaluation area and output the mean ADU/pix/s. For wavecals with the laser (INS1.LAMP5.NAME=5), sum the flux in the designated laser ghost evaluation area and output the mean ADU/pix/s

Slit central position repeatability ESO QC SLIT CEN REP0.2, ESO QC SLIT CEN REP0.4, ESO QC SLIT CEN REP DIFF
Template: CRIRES_spec_cal_Wave/TBD
DRS: Process (i.e. wavelength calibrate with cr2res_wave_cal) a series of UNe wavecal exposures taken (alternating) with 0.2” and 0.4” slits. Find the central wavelength as for the ESO QC UNE WAVE CEN parameter for each one. Then compute the standard deviation in this parameter for all of the 0.2” exposures and for all of the 0.4” exposures. Finally compute the difference between the mean central wavelength for the 0.2” exposures and the mean central wavelength for the 0.4” exposures.

Spectral resolution along the slit ESO QC SPEC RES SLITTOP, ESO QC SPEC RES SLITMID, ESO QC SPEC RES SLITBOT
Template: CRIRES_spec_cal_Wave
DRS: For wavecal exposures with the laser (i.e. L3412 and J1228), measure the FWHM of the laser line 10% of the way from the op of the slit image, 10% of the way from the bottom of the slit image and in the middle.             
======================================================================================

cr2res_obs_nodding
    ESO QC SIGNAL           double  Median of the central part of the 4th order spectrum    DONE
    ESO QC SNR%d            double  SNR of the a extracted spectra for each order           DONE
    ESO QC SLITFWHM MED     double  Median of the FWHM of the slit on the orders            DONE
    ESO QC SLITFWHM%d       double  FWHM of the slit for a given order                      DONE
    ESO QC REALORDER%d      int     Real order value                                        DONE

cr2res_obs_staring
    ESO QC SIGNAL                                                                           DONE
    ESO QC SNR%d                                                                            DONE
    ESO QC SLITFWHM MED                                                                     DONE
    ESO QC SLITFWHM%d                                                                       DONE
    ESO QC REALORDER%d                                                                      DONE

cr2res_obs_2d
    ESO QC REALORDER%d                                                                      DONE

cr2res_obs_pol
    ESO QC REALORDER%d                                                                      DONE

ALL
    ESO QC NPIX SAT     int                                                                 TODO
        Description:    Saturated pixels in the calibration frames
        Deadline PAC
        For any calibration exposures, count all pixels with >40000ADU in raw frames
        (QC then filters for lamp type and DIT)
