fors_sumflux.c

00001 /* $Id: fors_sumflux.c,v 1.11 2013-04-24 14:14:13 cgarcia Exp $
00002  *
00003  * This file is part of the FORS Data Reduction Pipeline
00004  * Copyright (C) 2002-2010 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 /*
00022  * $Author: cgarcia $
00023  * $Date: 2013-04-24 14:14:13 $
00024  * $Revision: 1.11 $
00025  * $Name: not supported by cvs2svn $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 #include <math.h>
00033 #include <cpl.h>
00034 #include <moses.h>
00035 #include <fors_dfs.h>
00036 #include <fors_qc.h>
00037 
00038 static int fors_sumflux_create(cpl_plugin *);
00039 static int fors_sumflux_exec(cpl_plugin *);
00040 static int fors_sumflux_destroy(cpl_plugin *);
00041 static int fors_sumflux(cpl_parameterlist *, cpl_frameset *);
00042 
00043 static char fors_sumflux_description[] =
00044 "This recipe is used to monitor any lamp flux on the CCD. The input raw\n"
00045 "image should be either a FLUX_ARC_LSS or a FLUX_FLAT_LSS frame. After the\n"
00046 "background subtraction the total signal is integrated and divided by the\n"
00047 "exposure time and by the total number of CCD original pixels (keeping\n"
00048 "into account a possible rebinned readout). In the case of FORS2 frames\n"
00049 "the background is the median level evaluated from the available overscan\n"
00050 "regions. In the case of FORS1 data, where overscan regions are missing,\n"
00051 "the background is evaluated as the median level of the first 200 CCD columns\n"
00052 "for flat field data, while for arc lamp data a background map evaluated\n"
00053 "from the regions without spectral lines is computed and subtracted. The\n"
00054 "background subtracted frame is written to output in all cases, and the QC\n"
00055 "parameters QC LAMP FLUX and QC LAMP FLUXERR are computed.\n\n"
00056 "Input files:\n\n"
00057 "  DO category:      Type:       Explanation:         Required:\n"
00058 "  FLUX_FLAT_LSS     Raw         Flat field exposure     Y\n"
00059 "  or FLUX_ARC_LSS   Raw         Arc lamp exposure       Y\n\n"
00060 "Output files:\n\n"
00061 "  DO category:      Data type:  Explanation:\n"
00062 "  FLUX_LAMP_LSS     FITS image  Background subtracted integration region\n\n";
00063 
00064 #define fors_sumflux_exit(message)            \
00065 {                                             \
00066 if ((const char *)message != NULL) cpl_msg_error(recipe, message);  \
00067 cpl_free(instrume);                           \
00068 cpl_free(pipefile);                           \
00069 cpl_image_delete(master_bias);                \
00070 cpl_image_delete(exposure);                   \
00071 cpl_propertylist_delete(header);              \
00072 cpl_propertylist_delete(qclist);              \
00073 cpl_table_delete(overscans);                  \
00074 cpl_msg_indent_less();                        \
00075 return -1;                                    \
00076 }
00077 
00078 #define fors_sumflux_exit_memcheck(message)   \
00079 {                                             \
00080 if ((const char *)message != NULL) cpl_msg_info(recipe, message);   \
00081 cpl_free(instrume);                           \
00082 cpl_free(pipefile);                           \
00083 cpl_image_delete(master_bias);                \
00084 cpl_image_delete(exposure);                   \
00085 cpl_propertylist_delete(header);              \
00086 cpl_propertylist_delete(qclist);              \
00087 cpl_table_delete(overscans);                  \
00088 cpl_msg_indent_less();                        \
00089 return 0;                                     \
00090 }
00091 
00092 
00104 int cpl_plugin_get_info(cpl_pluginlist *list)
00105 {
00106     cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe );
00107     cpl_plugin *plugin = &recipe->interface;
00108 
00109     cpl_plugin_init(plugin,
00110                     CPL_PLUGIN_API,
00111                     FORS_BINARY_VERSION,
00112                     CPL_PLUGIN_TYPE_RECIPE,
00113                     "fors_sumflux",
00114                     "Integrate flux from all or part of the input frame",
00115                     fors_sumflux_description,
00116                     "Carlo Izzo",
00117                     PACKAGE_BUGREPORT,
00118     "This file is currently part of the FORS Instrument Pipeline\n"
00119     "Copyright (C) 2002-2010 European Southern Observatory\n\n"
00120     "This program is free software; you can redistribute it and/or modify\n"
00121     "it under the terms of the GNU General Public License as published by\n"
00122     "the Free Software Foundation; either version 2 of the License, or\n"
00123     "(at your option) any later version.\n\n"
00124     "This program is distributed in the hope that it will be useful,\n"
00125     "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
00126     "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
00127     "GNU General Public License for more details.\n\n"
00128     "You should have received a copy of the GNU General Public License\n"
00129     "along with this program; if not, write to the Free Software Foundation,\n"
00130     "Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\n",
00131                     fors_sumflux_create,
00132                     fors_sumflux_exec,
00133                     fors_sumflux_destroy);
00134 
00135     cpl_pluginlist_append(list, plugin);
00136     
00137     return 0;
00138 }
00139 
00140 
00151 static int fors_sumflux_create(cpl_plugin *plugin)
00152 {
00153     cpl_recipe    *recipe;
00154     cpl_parameter *p;
00155 
00156 
00157     /* 
00158      * Check that the plugin is part of a valid recipe 
00159      */
00160 
00161     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00162         recipe = (cpl_recipe *)plugin;
00163     else 
00164         return -1;
00165 
00166     /* 
00167      * Create the parameters list in the cpl_recipe object 
00168      */
00169 
00170     recipe->parameters = cpl_parameterlist_new(); 
00171 
00172 
00173     /*
00174      * X coordinate of lower left corner
00175      */
00176 
00177     p = cpl_parameter_new_value("fors.fors_sumflux.xlow",
00178                                 CPL_TYPE_INT,
00179                                 "X coordinate of lower left corner "
00180                                 "of integration region (pixel)",
00181                                 "fors.fors_sumflux",
00182                                 0);
00183     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xlow");
00184     cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
00185     cpl_parameterlist_append(recipe->parameters, p);
00186 
00187     /*
00188      * Y coordinate of lower left corner
00189      */
00190 
00191     p = cpl_parameter_new_value("fors.fors_sumflux.ylow",
00192                                 CPL_TYPE_INT,
00193                                 "Y coordinate of lower left corner "
00194                                 "of integration region (pixel)",
00195                                 "fors.fors_sumflux",
00196                                 0);
00197     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ylow");
00198     cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
00199     cpl_parameterlist_append(recipe->parameters, p);
00200 
00201     /*
00202      * X coordinate of upper right corner
00203      */
00204 
00205     p = cpl_parameter_new_value("fors.fors_sumflux.xhigh",
00206                                 CPL_TYPE_INT,
00207                                 "X coordinate of upper right corner "
00208                                 "of integration region (pixel) (0 = CCD size)",
00209                                 "fors.fors_sumflux",
00210                                 0);
00211     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xhigh");
00212     cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
00213     cpl_parameterlist_append(recipe->parameters, p);
00214 
00215     /*
00216      * Y coordinate of upper right corner
00217      */
00218 
00219     p = cpl_parameter_new_value("fors.fors_sumflux.yhigh",
00220                                 CPL_TYPE_INT,
00221                                 "Y coordinate of upper right corner "
00222                                 "of integration region (pixel) (0 = CCD size)",
00223                                 "fors.fors_sumflux",
00224                                 0);
00225     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "yhigh");
00226     cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
00227     cpl_parameterlist_append(recipe->parameters, p);
00228 
00229     return 0;
00230 }
00231 
00232 
00241 static int fors_sumflux_exec(cpl_plugin *plugin)
00242 {
00243     cpl_recipe *recipe;
00244     
00245     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00246         recipe = (cpl_recipe *)plugin;
00247     else 
00248         return -1;
00249 
00250     return fors_sumflux(recipe->parameters, recipe->frames);
00251 }
00252 
00253 
00262 static int fors_sumflux_destroy(cpl_plugin *plugin)
00263 {
00264     cpl_recipe *recipe;
00265     
00266     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00267         recipe = (cpl_recipe *)plugin;
00268     else 
00269         return -1;
00270 
00271     cpl_parameterlist_delete(recipe->parameters); 
00272 
00273     return 0;
00274 }
00275 
00276 
00286 static int fors_sumflux(cpl_parameterlist *parlist, cpl_frameset *frameset)
00287 {
00288 
00289     const char *recipe = "fors_sumflux";
00290 
00291 
00292     /*
00293      * Input parameters
00294      */
00295 
00296     int xlow;
00297     int ylow;
00298     int xhig;
00299     int yhig;
00300 
00301     /*
00302      * CPL objects
00303      */
00304 
00305     cpl_image        *master_bias = NULL;
00306     cpl_image        *exposure    = NULL;
00307     cpl_image        *dummy       = NULL;
00308 
00309     cpl_table        *overscans   = NULL;
00310 
00311     cpl_propertylist *header      = NULL;
00312     cpl_propertylist *qclist      = NULL;
00313 
00314     /*
00315      * Auxiliary variables
00316      */
00317 
00318     const char   *arc_tag  = "FLUX_ARC_LSS";
00319     const char   *flat_tag = "FLUX_FLAT_LSS";
00320 
00321     char    version[80];
00322     char    lamp[20];
00323     const char   *exposure_tag;
00324     const char   *flux_tag = "FLUX_LAMP_LSS";
00325     double  time;
00326     double  norm_factor;
00327     int     nframes;
00328     int     rebin;
00329     int     nx, ny;
00330     double  gain;
00331     double  flux, flux_err;
00332     int     i;
00333 
00334     char   *instrume = NULL;
00335     char   *pipefile = NULL;
00336 
00337 
00338     snprintf(version, 80, "%s-%s", PACKAGE, PACKAGE_VERSION);
00339 
00340     cpl_msg_set_indentation(2);
00341 
00342     /* 
00343      * Get configuration parameters
00344      */
00345 
00346     cpl_msg_info(recipe, "Recipe %s configuration parameters:", recipe);
00347     cpl_msg_indent_more();
00348 
00349     xlow = dfs_get_parameter_int(parlist, "fors.fors_sumflux.xlow", NULL);
00350     ylow = dfs_get_parameter_int(parlist, "fors.fors_sumflux.ylow", NULL);
00351     xhig = dfs_get_parameter_int(parlist, "fors.fors_sumflux.xhigh", NULL);
00352     yhig = dfs_get_parameter_int(parlist, "fors.fors_sumflux.yhigh", NULL);
00353 
00354     if (cpl_error_get_code())
00355         fors_sumflux_exit("Failure getting the configuration parameters");
00356 
00357     if (xlow > xhig || ylow > yhig || xhig < 0 || yhig < 0)
00358         fors_sumflux_exit("Invalid integration region");
00359 
00360     
00361     /* 
00362      * Check input set-of-frames
00363      */
00364 
00365     cpl_msg_indent_less();
00366     cpl_msg_info(recipe, "Check input set-of-frames:");
00367     cpl_msg_indent_more();
00368 
00369     if (!dfs_equal_keyword(frameset, "ESO DET CHIP1 ID")) 
00370         cpl_msg_warning(cpl_func,"Input frames are not from the same chip");
00371 
00372     nframes = cpl_frameset_count_tags(frameset, arc_tag)
00373             + cpl_frameset_count_tags(frameset, flat_tag);
00374 
00375     if (nframes == 0)
00376         fors_sumflux_exit("Missing input LSS calibration exposures");
00377 
00378     if (nframes > 1) {
00379         cpl_msg_error(recipe, "Too many LSS calibration exposures found (%d). "
00380                       "Just one is required.", nframes);
00381         fors_sumflux_exit(NULL);
00382     }
00383 
00384     if (cpl_frameset_count_tags(frameset, arc_tag) > 0)
00385         exposure_tag = arc_tag;
00386     else
00387         exposure_tag = flat_tag;
00388 
00389 /*** MASTER BIAS
00390 
00391     if (cpl_frameset_count_tags(frameset, "MASTER_BIAS") == 0)
00392         fors_sumflux_exit("Missing required input: MASTER_BIAS");
00393 
00394     if (cpl_frameset_count_tags(frameset, "MASTER_BIAS") > 1)
00395         fors_sumflux_exit("Too many in input: MASTER_BIAS");
00396 
00397     cpl_msg_info(recipe, "Load master bias frame...");
00398     cpl_msg_indent_more();
00399 
00400     master_bias = dfs_load_image(frameset, "MASTER_BIAS", CPL_TYPE_FLOAT, 0, 1);
00401     if (master_bias == NULL)
00402         fors_sumflux_exit("Cannot load master bias");
00403 
00404 MASTER BIAS ***/
00405 
00406     cpl_msg_indent_less();
00407     cpl_msg_info(recipe, "Load %s frame...", exposure_tag);
00408     cpl_msg_indent_more();
00409 
00410     exposure = dfs_load_image(frameset, exposure_tag, CPL_TYPE_FLOAT, 0, 0);
00411     if (exposure == NULL)
00412         fors_sumflux_exit("Cannot load input frame");
00413 
00414     /*
00415      * Get exposure time, rebin factor, gain, etc.
00416      */
00417 
00418     header = dfs_load_header(frameset, exposure_tag, 0);
00419 
00420     if (header == NULL)
00421         fors_sumflux_exit("Cannot load input frame header");
00422 
00423     time = cpl_propertylist_get_double(header, "EXPTIME");
00424 
00425     if (cpl_error_get_code() != CPL_ERROR_NONE)
00426         fors_sumflux_exit("Missing keyword EXPTIME in input frame header");
00427 
00428     instrume = (char *)cpl_propertylist_get_string(header, "INSTRUME");
00429     if (instrume == NULL)
00430         fors_sumflux_exit("Missing keyword INSTRUME in input frame header");
00431     instrume = cpl_strdup(instrume);
00432 
00433     if (instrume[4] == '1')
00434         snprintf(version, 80, "%s/%s", "fors1", VERSION);
00435     if (instrume[4] == '2')
00436         snprintf(version, 80, "%s/%s", "fors2", VERSION);
00437 
00438     rebin = cpl_propertylist_get_int(header, "ESO DET WIN1 BINX");
00439 
00440     if (cpl_error_get_code() != CPL_ERROR_NONE)
00441         fors_sumflux_exit("Missing keyword ESO DET WIN1 BINX in input "
00442                           "frame header");
00443 
00444     rebin *= cpl_propertylist_get_int(header, "ESO DET WIN1 BINY");
00445 
00446     if (cpl_error_get_code() != CPL_ERROR_NONE)
00447         fors_sumflux_exit("Missing keyword ESO DET WIN1 BINY in input "
00448                           "frame header");
00449 
00450     if (rebin > 1) {
00451         cpl_msg_info(recipe, 
00452                      "One readout pixel corresponds to %d chip pixels", rebin);
00453     }
00454 
00455     gain = cpl_propertylist_get_double(header, "ESO DET OUT1 CONAD");
00456 
00457     if (cpl_error_get_code() != CPL_ERROR_NONE)
00458         fors_sumflux_exit("Missing keyword ESO DET OUT1 CONAD in arc lamp "
00459                         "frame header");
00460 
00461     cpl_msg_info(recipe, "The gain factor is: %.2f e-/ADU", gain);
00462 
00463     /* Leave the header on for the next step... */
00464 
00465 
00466     /*
00467      * Remove the bias if possible (FORS2), otherwise remove the flux from a 
00468      * presumably darker part of the image (FORS1).
00469      */
00470 
00471     switch (instrume[4]) {
00472     case '1':
00473 #ifdef OLD_FORS1
00474         cpl_msg_info(recipe, "Remove low-flux region level...");
00475         if (exposure_tag == flat_tag) {
00476             overscans = cpl_table_new(2);
00477             cpl_table_new_column(overscans, "xlow", CPL_TYPE_INT);
00478             cpl_table_new_column(overscans, "ylow", CPL_TYPE_INT);
00479             cpl_table_new_column(overscans, "xhig", CPL_TYPE_INT);
00480             cpl_table_new_column(overscans, "yhig", CPL_TYPE_INT);
00481     
00482             nx = cpl_image_get_size_x(exposure);
00483             ny = cpl_image_get_size_y(exposure);
00484     
00485             /* "Valid" region */
00486     
00487             cpl_table_set_int(overscans, "xlow", 0, 200);
00488             cpl_table_set_int(overscans, "ylow", 0, 0);
00489             cpl_table_set_int(overscans, "xhig", 0, nx);
00490             cpl_table_set_int(overscans, "yhig", 0, ny);
00491     
00492             /* "Overscan" (background) region */
00493     
00494             cpl_table_set_int(overscans, "xlow", 1, 0);
00495             cpl_table_set_int(overscans, "ylow", 1, 0);
00496             cpl_table_set_int(overscans, "xhig", 1, 200);
00497             cpl_table_set_int(overscans, "yhig", 1, ny);
00498         }
00499         else {
00500             background = mos_arc_background(exposure, 15, 15);
00501             cpl_image_subtract(exposure, background);
00502             cpl_image_delete(background);
00503         }
00504 #else
00505         cpl_msg_info(recipe, "Remove bias, evaluated on overscan regions...");
00506         overscans = mos_load_overscans_vimos(header, 1);
00507 #endif
00508         break;
00509     case '2':
00510         cpl_msg_info(recipe, "Remove bias, evaluated on overscan regions...");
00511         overscans = mos_load_overscans_vimos(header, 1);
00512         break;
00513     default:
00514         cpl_msg_error(recipe, "Invalid instrument name: %s", instrume);
00515         fors_sumflux_exit(NULL);
00516     }
00517 
00518     if (overscans) {
00519         dummy = mos_remove_bias(exposure, NULL, overscans);
00520         cpl_table_delete(overscans); overscans = NULL;
00521         cpl_image_delete(exposure); exposure = dummy;
00522     
00523         if (exposure == NULL)
00524             fors_sumflux_exit("Cannot remove bias from input frame");
00525     }
00526 
00527     nx = cpl_image_get_size_x(exposure);
00528     ny = cpl_image_get_size_y(exposure);
00529 
00530     if (xhig == 0)
00531         xhig = nx;
00532 
00533     if (yhig == 0)
00534         yhig = ny;
00535 
00536     if (xlow > nx || ylow > ny || xhig < 0 || yhig < 0)
00537         fors_sumflux_exit("The integration region lays outside the CCD");
00538 
00539     if (xlow == xhig || ylow == yhig)
00540         fors_sumflux_exit("The integration area is zero");
00541 
00542     norm_factor = rebin * time * (xhig - xlow) * (yhig - ylow);
00543 
00544     flux = cpl_image_get_flux(exposure);
00545     if (flux > 0.0) {
00546         flux_err = sqrt(flux/gain);
00547     }
00548     else {
00549         flux = 0.0;
00550         flux_err = 0.0;
00551     }
00552 
00553     flux /= norm_factor;
00554     flux_err /= norm_factor;
00555 
00556     cpl_msg_info(recipe, "Flux: %.4f +/- %.4f (ADU/s*pixel)", flux, flux_err);
00557 
00558     cpl_image_divide_scalar(exposure, norm_factor);
00559 
00560     /* Leave the header on for the next step... */
00561 
00562 
00563     /*
00564      * QC1 group header
00565      */
00566 
00567     qclist = cpl_propertylist_new();
00568     
00569     fors_qc_start_group(qclist, "2.0", instrume);
00570 
00571     if (fors_qc_write_string("PRO.CATG", flux_tag,
00572                             "Product category", instrume))
00573         fors_sumflux_exit("Cannot write product category to QC log file");
00574 
00575     if (fors_qc_keyword_to_paf(header, "ESO DPR TYPE", NULL,
00576                               "DPR type", instrume))
00577         fors_sumflux_exit("Missing keyword DPR TYPE in frame header");
00578 
00579     if (fors_qc_keyword_to_paf(header, "ESO TPL ID", NULL,
00580                               "Template", instrume))
00581         fors_sumflux_exit("Missing keyword TPL ID in frame header");
00582 
00583     if (fors_qc_keyword_to_paf(header, "ESO INS GRIS1 NAME", NULL,
00584                               "Grism name", instrume))
00585         fors_sumflux_exit("Missing keyword INS GRIS1 NAME in frame header");
00586 
00587     if (fors_qc_keyword_to_paf(header, "ESO INS GRIS1 ID", NULL,
00588                               "Grim identifier", instrume))
00589         fors_sumflux_exit("Missing keyword INS GRIS1 ID in frame header");
00590 
00591     if (cpl_propertylist_has(header, "ESO INS FILT1 NAME"))
00592         fors_qc_keyword_to_paf(header, "ESO INS FILT1 NAME", NULL,
00593                               "Filter name", instrume);
00594 
00595     if (fors_qc_keyword_to_paf(header, "ESO INS COLL NAME", NULL,
00596                               "Collimator name", instrume))
00597         fors_sumflux_exit("Missing keyword INS COLL NAME in frame header");
00598 
00599     if (fors_qc_keyword_to_paf(header, "ESO DET CHIP1 ID", NULL,
00600                               "Chip identifier", instrume))
00601         fors_sumflux_exit("Missing keyword DET CHIP1 ID in frame header");
00602 
00603     if (fors_qc_keyword_to_paf(header, "ESO INS SLIT WID",
00604                               "arcsec", "Slit width", instrume))
00605         fors_sumflux_exit("Missing keyword ESO INS SLIT WID in frame header");
00606 
00607     if (fors_qc_keyword_to_paf(header, "ESO DET OUT1 CONAD", "e-/ADU", 
00608                               "Conversion from ADUs to electrons", instrume))
00609         fors_sumflux_exit("Missing keyword ESO DET OUT1 CONAD in frame header");
00610 
00611     if (fors_qc_keyword_to_paf(header, "ESO DET WIN1 BINX", NULL, 
00612                               "Binning factor along X", instrume))
00613         fors_sumflux_exit("Missing keyword ESO DET WIN1 BINX in frame header");
00614 
00615     if (fors_qc_keyword_to_paf(header, "ESO DET WIN1 BINY", NULL, 
00616                               "Binning factor along Y", instrume))
00617         fors_sumflux_exit("Missing keyword ESO DET WIN1 BINY in frame header");
00618 
00619     for (i = 1; i < 7; i++) {
00620        snprintf(lamp, 20, "ESO INS LAMP%d NAME", i);
00621        if (cpl_propertylist_has(header, lamp))
00622             fors_qc_keyword_to_paf(header, lamp, NULL,
00623                                   "Name of lamp on", instrume);
00624     }
00625 
00626     if (fors_qc_keyword_to_paf(header, "ARCFILE", NULL,
00627                               "Archive name of input data", instrume))
00628         fors_sumflux_exit("Missing keyword ARCFILE in frame header");
00629 
00630     cpl_propertylist_delete(header); header = NULL;
00631 
00632     pipefile = dfs_generate_filename(flux_tag);
00633     if (fors_qc_write_string("PIPEFILE", pipefile,
00634                             "Pipeline product name", instrume))
00635         fors_sumflux_exit("Cannot write PIPEFILE to QC log file");
00636     cpl_free(pipefile); pipefile = NULL;
00637 
00638 
00639     /*
00640      * QC1 parameters
00641      */
00642 
00643     if (fors_qc_write_qc_double(qclist, flux, "QC.LAMP.FLUX", "ADU/s*pixel", 
00644                                "Total lamp flux", instrume)) {
00645         fors_sumflux_exit("Cannot write total lamp flux to QC log file");
00646     }
00647     
00648     if (fors_qc_write_qc_double(qclist, flux_err, "QC.LAMP.FLUXERR", 
00649                                "ADU/s*pixel", 
00650                                "Error on lamp flux", instrume)) {
00651         fors_sumflux_exit("Cannot write error on lamp flux to QC log file");
00652     }
00653 
00654     fors_qc_end_group();
00655 
00656     cpl_free(instrume); instrume = NULL;
00657 
00658     if (dfs_save_image(frameset, exposure, flux_tag, qclist,
00659                        parlist, recipe, version))
00660         fors_sumflux_exit(NULL);
00661 
00662     cpl_image_delete(exposure); exposure = NULL;
00663     cpl_propertylist_delete(qclist); qclist = NULL;
00664 
00665     return 0;
00666 
00667 } 

Generated on 12 Feb 2016 for FORS Pipeline Reference Manual by  doxygen 1.6.1