IIINSTRUMENT Pipeline Reference Manual 6.2.5
isaac_img_lingain.c
1/* $Id: isaac_img_lingain.c,v 1.5 2013-03-12 08:06:48 llundin 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: llundin $
23 * $Date: 2013-03-12 08:06:48 $
24 * $Revision: 1.5 $
25 * $Name: not supported by cvs2svn $
26 */
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32/*----------------------------------------------------------------------------
33 Includes and Defines
34 ----------------------------------------------------------------------------*/
35
36#include <cpl.h>
37
38#include "irplib_detmon.h"
39#include "irplib_detmon_lg.h"
40#include "irplib_plugin.h"
41
42/* Define here the DO.CATG keywords */
43#define ISAAC_IMG_LINGAIN_ON_RAW "CAL_LINGAIN_LAMP"
44#define ISAAC_IMG_LINGAIN_OFF_RAW "CAL_LINGAIN_DARK"
45
46#define RECIPE_NAME "isaac_img_lingain"
47
48/* Copy here instrument specific keywords which need to be in the PAF file */
49#define INSTREGEXP "ESO DET CHIP NAME|ESO DET MODE NAME"
50
51#define PAFREGEXP "^(" REGEXP "|" INSTREGEXP ")$"
52
53#define NIR TRUE
54
55/*----------------------------------------------------------------------------
56 Functions prototypes
57 ----------------------------------------------------------------------------*/
58
59cpl_recipe_define(isaac_img_lingain, ISAAC_BINARY_VERSION,
60 "Lars Lundin", PACKAGE_BUGREPORT, "2008",
61 "Linearity/Gain recipe for the IR domain",
62 irplib_detmon_lg_get_description(RECIPE_NAME, "ISAAC",
63 ISAAC_IMG_LINGAIN_ON_RAW,
64 ISAAC_IMG_LINGAIN_OFF_RAW));
65
66/*-----------------------------------------------------------------------------
67 Functions code
68 -----------------------------------------------------------------------------*/
69
70/*----------------------------------------------------------------------------*/
78/*----------------------------------------------------------------------------*/
79static
80cpl_error_code isaac_img_lingain_fill_parameterlist(cpl_parameterlist * self) {
81
82 return irplib_detmon_lg_fill_parlist_nir_default(self, RECIPE_NAME,
83 PACKAGE_TARNAME)
84 ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
85}
86
87/*---------------------------------------------------------------------------*/
88/*
89 @brief Interpret the command line options and execute the data processing
90 @param frameset the frames list
91 @param parlist the parameters list
92 @return 0 if everything is ok
93 */
94/*---------------------------------------------------------------------------*/
95
96static int isaac_img_lingain(cpl_frameset * frameset,
97 const cpl_parameterlist * parlist)
98{
99 cpl_propertylist * lintbl =
100 irplib_detmon_fill_prolist("DET_LIN_INFO", "TYPE", "TECH", CPL_TRUE);
101
102 cpl_propertylist * gaintbl =
103 irplib_detmon_fill_prolist("GAIN_INFO", "TYPE", "TECH", CPL_TRUE);
104
105 cpl_propertylist * coeffscube =
106 irplib_detmon_fill_prolist("COEFFS_CUBE", "TYPE", "TECH", CPL_TRUE);
107
108 cpl_propertylist * bpm =
109 irplib_detmon_fill_prolist("BP_MAP_NL", "TYPE", "TECH", CPL_TRUE);
110
111 cpl_propertylist * corr =
112 irplib_detmon_fill_prolist("AUTOCORR", "TYPE", "TECH", CPL_TRUE);
113
114 cpl_propertylist * diff_flat =
115 irplib_detmon_fill_prolist("DIFF_FLAT", "TYPE", "TECH", CPL_TRUE);
116
117 const cpl_error_code error = irplib_detmon_lg(frameset,
118 parlist,
119 ISAAC_IMG_LINGAIN_ON_RAW,
120 ISAAC_IMG_LINGAIN_OFF_RAW,
121 RECIPE_NAME,
122 PACKAGE_TARNAME,
123 PAFREGEXP,
124 lintbl, gaintbl, coeffscube,
125 bpm, corr, diff_flat,
126 PACKAGE "/" PACKAGE_VERSION,
127 NULL, NULL, NIR);
128
129 cpl_propertylist_delete(lintbl);
130 cpl_propertylist_delete(gaintbl);
131 cpl_propertylist_delete(coeffscube);
132 cpl_propertylist_delete(bpm);
133 cpl_propertylist_delete(corr);
134 cpl_propertylist_delete(diff_flat);
135
136 /* Propagate the error, if any */
137 cpl_ensure_code(!error, error);
138
139 return CPL_ERROR_NONE;
140}