VIRCAM Pipeline  1.3.3
vircam/vircam_gaincor.c
1 /* $Id: vircam_gaincor.c,v 1.3 2009-05-20 12:18:42 jim Exp $
2  *
3  * This file is part of the VIRCAM Pipeline
4  * Copyright (C) 2007 Cambridge Astronomy Survey Unit
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: 2009-05-20 12:18:42 $
24  * $Revision: 1.3 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 /* Includes */
29 
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33 
34 #include "vircam_mods.h"
35 #include "vircam_utils.h"
36 #include "vircam_fits.h"
37 
40 /*---------------------------------------------------------------------------*/
75 /*---------------------------------------------------------------------------*/
76 
77 extern int vircam_gaincor(vir_fits *infile, float gainscl, int *status) {
78  cpl_image *i;
79  cpl_propertylist *oplist;
80 
81  /* Inherited status */
82 
83  if (*status != VIR_OK)
84  return(*status);
85 
86  /* Do we need to be here? */
87 
88  if (cpl_propertylist_has(vircam_fits_get_ehu(infile),"ESO DRS GAINCOR"))
89  return(*status);
90 
91  /* Get the images and check the dimensions of each */
92 
93  i = vircam_fits_get_image(infile);
94 
95  /* If the factor is zero, then send a warning out, but continue on. */
96 
97  if (gainscl <= 0.0) {
98  WARN_CONTINUE
99  } else {
100  cpl_image_multiply_scalar(i,gainscl);
101  }
102 
103  /* Now put some stuff in the DRS extension... */
104 
105  oplist = vircam_fits_get_ehu(infile);
106  if (oplist != NULL) {
107  cpl_propertylist_update_float(oplist,"ESO DRS GAINCOR",gainscl);
108  cpl_propertylist_set_comment(oplist,"ESO DRS GAINCOR",
109  "Gain correction factor");
110  } else
111  WARN_CONTINUE
112 
113  /* Get out of here */
114 
115  GOOD_STATUS
116 }
117 
120 /*
121 
122 $Log: not supported by cvs2svn $
123 Revision 1.2 2007/10/25 17:34:00 jim
124 Modified to remove lint warnings
125 
126 Revision 1.1 2007/05/08 10:40:15 jim
127 Initial entry
128 
129 
130 */