IIINSTRUMENT Pipeline Reference Manual  1.3.12b
detmon_ir_lg.c
1 /* $Id: detmon_ir_lg.c,v 1.33 2013-01-29 08:56:40 jtaylor Exp $
2  *
3  * This file is part of the DETMON Pipeline
4  * Copyright (C) 2002,2003 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
19  */
20 
21 /*
22  * $Author: jtaylor $
23  * $Date: 2013-01-29 08:56:40 $
24  * $Revision: 1.33 $
25  * $Name: not supported by cvs2svn $
26  */
27 #ifdef HAVE_CONFIG_H
28 #include <config.h>
29 #endif
30 
31 /*----------------------------------------------------------------------------
32  Includes
33  ----------------------------------------------------------------------------*/
34 
35 #include "detmon.h"
36 #include "detmon_lg.h"
37 
38 #include "irplib_utils.h"
39 
40 /*----------------------------------------------------------------------------
41  Defines
42  ----------------------------------------------------------------------------*/
43 
44 #define RECIPE_NAME "detmon_ir_lg"
45 
46 #define NIR TRUE
47 
48 /*----------------------------------------------------------------------------
49  Functions prototypes
50  ----------------------------------------------------------------------------*/
51 
52 CPL_RECIPE_DEFINE(detmon_ir_lg, DETMON_BINARY_VERSION,
53  detmon_lg_fill_parlist_nir_default(recipe->parameters,
54  "detmon_ir_lg", "detmon"),
55  "Lander de Bilbao", PACKAGE_BUGREPORT, "2007",
56  "Linearity/Gain recipe for the IR domain",
57  detmon_lg_get_description("detmon_ir_lg", "DETMON",
58  DETMON_LG_ON_RAW_NEW,
59  DETMON_LG_OFF_RAW_NEW,
60  DETMON_LG_ON_RAW_OLD,
61  DETMON_LG_OFF_RAW_OLD));
63 /*---------------------------------------------------------------------------*/
64 /*
65  @brief Interpret the command line options and execute the data processing
66  @param frameset the frames list
67  @param parlist the parameters list
68  @return 0 if everything is ok
69  */
70 /*---------------------------------------------------------------------------*/
71 
72 static int detmon_ir_lg(cpl_frameset * frameset,
73  const cpl_parameterlist * parlist)
74 {
75 
76 
77  const char * tag_on=NULL;
78  const char * tag_off=NULL;
79  cpl_propertylist * lintbl =
80  detmon_fill_prolist("DET_LIN_INFO", "REDUCED", "TECH", CPL_FALSE);
81 
82  cpl_propertylist * gaintbl =
83  detmon_fill_prolist("GAIN_INFO", "REDUCED", "TECH", CPL_FALSE);
84 
85  cpl_propertylist * coeffscube =
86  detmon_fill_prolist("COEFFS_CUBE", "REDUCED", "TECH", CPL_FALSE);
87 
88  cpl_propertylist * bpm =
89  detmon_fill_prolist("BP_MAP_NL", "REDUCED", "TECH", CPL_FALSE);
90 
91  cpl_propertylist * corr =
92  detmon_fill_prolist("AUTOCORR", "REDUCED", "TECH", CPL_FALSE);
93 
94  cpl_propertylist * diff_flat =
95  detmon_fill_prolist("DIFF_FLAT", "REDUCED", "TECH", CPL_FALSE);
96 
97  cpl_error_code error=CPL_ERROR_NONE;
98  skip_if (detmon_lg_set_tag(frameset, &tag_on, &tag_off));
99 
100  error = detmon_lg(frameset,
101  parlist,
102  tag_on,
103  tag_off,
104  RECIPE_NAME,
105  PACKAGE_TARNAME,
106  REGEXP,
107  lintbl, gaintbl, coeffscube,
108  bpm, corr, diff_flat,
109  PACKAGE "/" PACKAGE_VERSION,
110  NULL, NULL, NIR);
111  end_skip;
112  cpl_propertylist_delete(lintbl);
113  cpl_propertylist_delete(gaintbl);
114  cpl_propertylist_delete(coeffscube);
115  cpl_propertylist_delete(bpm);
116  cpl_propertylist_delete(corr);
117  cpl_propertylist_delete(diff_flat);
118 
119  /* Propagate the error, if any */
120  cpl_ensure_code(!error, error);
121 
122  return cpl_error_get_code();
123 }