VIRCAM Pipeline 2.3.15
casu_gaincor.c
1/* $Id: casu_gaincor.c,v 1.2 2015/08/07 13:06:54 jim Exp $
2 *
3 * This file is part of the CASU Pipeline utilities
4 * Copyright (C) 2015 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/*
22 * $Author: jim $
23 * $Date: 2015/08/07 13:06:54 $
24 * $Revision: 1.2 $
25 * $Name: $
26 */
27
28/* Includes */
29
30#ifdef HAVE_CONFIG_H
31#include <config.h>
32#endif
33
34#include "casu_mods.h"
35#include "catalogue/casu_utils.h"
36#include "catalogue/casu_fits.h"
37
40/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
76
77extern int casu_gaincor(casu_fits *infile, float gainscl, int *status) {
78 cpl_image *i;
79 cpl_propertylist *oplist;
80
81 /* Inherited status */
82
83 if (*status != CASU_OK)
84 return(*status);
85
86 /* Do we need to be here? */
87
88 if (cpl_propertylist_has(casu_fits_get_ehu(infile),"ESO DRS GAINCOR"))
89 return(*status);
90
91 /* Get the images and check the dimensions of each */
92
93 i = casu_fits_get_image(infile);
94
95 /* If the factor is zero or negative, then send a warning out and
96 don't do the scaling. Otherwise scale the image */
97
98 if (gainscl <= 0.0) {
99 WARN_CONTINUE
100 } else {
101 cpl_image_multiply_scalar(i,gainscl);
102 }
103
104 /* Now put some stuff in the DRS extension... */
105
106 oplist = casu_fits_get_ehu(infile);
107 if (oplist != NULL) {
108 cpl_propertylist_update_float(oplist,"ESO DRS GAINCOR",gainscl);
109 cpl_propertylist_set_comment(oplist,"ESO DRS GAINCOR",
110 "Gain correction factor");
111 } else
112 WARN_CONTINUE
113
114 /* Get out of here */
115
116 return(*status);
117}
118
121/*
122
123$Log: casu_gaincor.c,v $
124Revision 1.2 2015/08/07 13:06:54 jim
125Fixed copyright to ESO
126
127Revision 1.1.1.1 2015/06/12 10:44:32 jim
128Initial import
129
130Revision 1.4 2015/01/29 11:48:15 jim
131modified comments
132
133Revision 1.3 2014/03/26 15:42:10 jim
134Fixed minor bug
135
136Revision 1.2 2013/11/21 09:38:13 jim
137detabbed
138
139Revision 1.1.1.1 2013-08-27 12:07:48 jim
140Imported
141
142
143*/
cpl_image * casu_fits_get_image(casu_fits *p)
Definition: casu_fits.c:436
cpl_propertylist * casu_fits_get_ehu(casu_fits *p)
Definition: casu_fits.c:576
int casu_gaincor(casu_fits *infile, float gainscl, int *status)
Gain correct input data frame.
Definition: casu_gaincor.c:77