HAWKI Pipeline Reference Manual 1.8.12
|
00001 /* $Id: hawki_cal_lingain.c,v 1.4 2010/09/28 14:13:48 cgarcia Exp $ 00002 * 00003 * This file is part of the CRIRES Pipeline 00004 * Copyright (C) 2002,2003 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 /* 00022 * $Author: cgarcia $ 00023 * $Date: 2010/09/28 14:13:48 $ 00024 * $Revision: 1.4 $ 00025 * $Name: hawki-1_8_12 $ 00026 */ 00027 00028 #ifdef HAVE_CONFIG_H 00029 #include <config.h> 00030 #endif 00031 00032 /*---------------------------------------------------------------------------- 00033 Includes and Defines 00034 ----------------------------------------------------------------------------*/ 00035 00036 #include <cpl.h> 00037 00038 #include "irplib_detmon_lg.h" 00039 #include "irplib_detmon.h" 00040 #include "irplib_plugin.h" 00041 00042 #include "hawki_dfs.h" 00043 00044 #define RECIPE_NAME "hawki_cal_lingain" 00045 00046 /* Copy here instrument specific keywords which need to be in the PAF file */ 00047 #define INSTREGEXP "ESO INS SETUP ID" 00048 #define PAFREGEXP "^(" REGEXP "|" INSTREGEXP ")$" 00049 00050 00051 /*---------------------------------------------------------------------------- 00052 Functions prototypes 00053 ----------------------------------------------------------------------------*/ 00054 00057 cpl_error_code hawki_cal_lingain_fill_parlist_default(cpl_parameterlist * parlist); 00058 00059 IRPLIB_RECIPE_DEFINE(hawki_cal_lingain, HAWKI_BINARY_VERSION, 00060 hawki_cal_lingain_fill_parlist_default(recipe->parameters), 00061 "Enrique Garcia", PACKAGE_BUGREPORT, "2009", 00062 "Linearity/Gain recipe for the IR domain", 00063 irplib_detmon_lg_get_description(RECIPE_NAME, "HAWKI", 00064 HAWKI_CAL_LINGAIN_LAMP_RAW, 00065 HAWKI_CAL_LINGAIN_DARK_RAW)); 00066 00067 /*---------------------------------------------------------------------------*/ 00068 /* 00069 @brief Interpret the command line options and execute the data processing 00070 @param frameset the frames list 00071 @param parlist the parameters list 00072 @return 0 if everything is ok 00073 */ 00074 /*---------------------------------------------------------------------------*/ 00075 static int hawki_cal_lingain(cpl_frameset * frameset, 00076 const cpl_parameterlist * parlist) 00077 { 00078 cpl_error_code error ; 00079 cpl_propertylist * pro_lintbl ; 00080 cpl_propertylist * pro_gaintbl ; 00081 cpl_propertylist * pro_coeffscube ; 00082 cpl_propertylist * pro_bpm ; 00083 cpl_propertylist * pro_corr ; 00084 cpl_propertylist * pro_diff ; 00085 00086 /* Create the PRO keys propertylist */ 00087 pro_lintbl = cpl_propertylist_new() ; 00088 cpl_propertylist_append_string(pro_lintbl, CPL_DFS_PRO_CATG, 00089 HAWKI_CALPRO_LINGAIN_LIN) ; 00090 cpl_propertylist_append_string(pro_lintbl, CPL_DFS_PRO_TYPE, 00091 HAWKI_PROTYPE_LIN_STATS) ; 00092 00093 pro_gaintbl = cpl_propertylist_new() ; 00094 cpl_propertylist_append_string(pro_gaintbl, CPL_DFS_PRO_CATG, 00095 HAWKI_CALPRO_LINGAIN_GAIN) ; 00096 cpl_propertylist_append_string(pro_gaintbl, CPL_DFS_PRO_TYPE, 00097 HAWKI_PROTYPE_GAIN_STATS) ; 00098 00099 pro_coeffscube = cpl_propertylist_new() ; 00100 cpl_propertylist_append_string(pro_coeffscube, CPL_DFS_PRO_CATG, 00101 HAWKI_CALPRO_LINGAIN_COEFFS) ; 00102 cpl_propertylist_append_string(pro_coeffscube, CPL_DFS_PRO_TYPE, 00103 HAWKI_PROTYPE_LIN_COEFFS) ; 00104 00105 pro_bpm = cpl_propertylist_new() ; 00106 cpl_propertylist_append_string(pro_bpm, CPL_DFS_PRO_CATG, 00107 HAWKI_CALPRO_LINGAIN_BPM) ; 00108 cpl_propertylist_append_string(pro_bpm, CPL_DFS_PRO_TYPE, 00109 HAWKI_PROTYPE_BPM_LEVELS) ; 00110 00111 pro_corr = cpl_propertylist_new() ; 00112 cpl_propertylist_append_string(pro_corr, CPL_DFS_PRO_CATG, 00113 HAWKI_CALPRO_LINGAIN_CORR) ; 00114 cpl_propertylist_append_string(pro_corr, CPL_DFS_PRO_TYPE, 00115 HAWKI_PROTYPE_LINGAIN_CORR) ; 00116 00117 pro_diff = cpl_propertylist_new() ; 00118 cpl_propertylist_append_string(pro_diff, CPL_DFS_PRO_CATG, 00119 HAWKI_CALPRO_LINGAIN_DIFF) ; 00120 cpl_propertylist_append_string(pro_diff, CPL_DFS_PRO_TYPE, 00121 HAWKI_PROTYPE_LINGAIN_DIFF) ; 00122 00123 /* Call the lingain function */ 00124 error = irplib_detmon_lg(frameset, 00125 parlist, 00126 HAWKI_CAL_LINGAIN_LAMP_RAW, 00127 HAWKI_CAL_LINGAIN_DARK_RAW, 00128 RECIPE_NAME, 00129 PACKAGE_TARNAME, 00130 PAFREGEXP, 00131 pro_lintbl, 00132 pro_gaintbl, 00133 pro_coeffscube, 00134 pro_bpm, 00135 pro_corr, 00136 pro_diff, 00137 PACKAGE "/" PACKAGE_VERSION, 00138 NULL, NULL, TRUE); 00139 00140 /* Delete the PRO keys propertylist */ 00141 cpl_propertylist_delete(pro_lintbl) ; 00142 cpl_propertylist_delete(pro_gaintbl) ; 00143 cpl_propertylist_delete(pro_coeffscube) ; 00144 cpl_propertylist_delete(pro_bpm) ; 00145 cpl_propertylist_delete(pro_corr) ; 00146 cpl_propertylist_delete(pro_diff) ; 00147 00148 /* Propagate the error, if any */ 00149 cpl_ensure_code(!error, error); 00150 00151 /* Return */ 00152 if (cpl_error_get_code()) 00153 { 00154 cpl_msg_error(__func__, 00155 "HAWK-I pipeline could not recover from previous errors"); 00156 return -1 ; 00157 } 00158 else return 0; 00159 } 00160 00161 cpl_error_code 00162 hawki_cal_lingain_fill_parlist_default(cpl_parameterlist * parlist) 00163 { 00164 cpl_parameter * p; 00165 cpl_error_code error ; 00166 00167 error=irplib_detmon_lg_fill_parlist_nir_default(parlist, 00168 RECIPE_NAME, PACKAGE_TARNAME); 00169 cpl_ensure_code(!error, error); 00170 00171 /* Set to reduce all extensions */ 00172 p = cpl_parameterlist_find(parlist, PACKAGE_TARNAME "." RECIPE_NAME 00173 ".exts"); 00174 cpl_ensure_code(p != NULL, CPL_ERROR_DATA_NOT_FOUND); 00175 error = cpl_parameter_set_default_int(p, -1); 00176 cpl_ensure_code(!error, error); 00177 00178 00179 return CPL_ERROR_NONE; 00180 }