vircam_gaincor.c

00001 /* $Id: vircam_gaincor.c,v 1.3 2009/05/20 12:18:42 jim Exp $
00002  *
00003  * This file is part of the VIRCAM Pipeline
00004  * Copyright (C) 2007 Cambridge Astronomy Survey Unit
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: jim $
00023  * $Date: 2009/05/20 12:18:42 $
00024  * $Revision: 1.3 $
00025  * $Name: vcam-1_3_0 $
00026  */
00027 
00028 /* Includes */
00029 
00030 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033 
00034 #include "vircam_mods.h"
00035 #include "vircam_utils.h"
00036 #include "vircam_fits.h"
00037 
00040 /*---------------------------------------------------------------------------*/
00075 /*---------------------------------------------------------------------------*/
00076 
00077 extern int vircam_gaincor(vir_fits *infile, float gainscl, int *status) {
00078     cpl_image *i;
00079     cpl_propertylist *oplist;
00080 
00081     /* Inherited status */
00082 
00083     if (*status != VIR_OK)
00084         return(*status);
00085 
00086     /* Do we need to be here? */
00087 
00088     if (cpl_propertylist_has(vircam_fits_get_ehu(infile),"ESO DRS GAINCOR"))
00089         return(*status);
00090 
00091     /* Get the images and check the dimensions of each */
00092 
00093     i = vircam_fits_get_image(infile);
00094 
00095     /* If the factor is zero, then send a warning out, but continue on. */
00096 
00097     if (gainscl <= 0.0) {
00098         WARN_CONTINUE
00099     } else {
00100         cpl_image_multiply_scalar(i,gainscl);
00101     }
00102 
00103     /* Now put some stuff in the DRS extension... */
00104 
00105     oplist = vircam_fits_get_ehu(infile);
00106     if (oplist != NULL) {
00107         cpl_propertylist_update_float(oplist,"ESO DRS GAINCOR",gainscl);
00108         cpl_propertylist_set_comment(oplist,"ESO DRS GAINCOR",
00109                                      "Gain correction factor");
00110     } else 
00111         WARN_CONTINUE
00112 
00113     /* Get out of here */
00114 
00115     GOOD_STATUS
00116 }
00117 
00120 /*
00121 
00122 $Log: vircam_gaincor.c,v $
00123 Revision 1.3  2009/05/20 12:18:42  jim
00124 Modified so that if the operation is already done, then it just returns
00125 
00126 Revision 1.2  2007/10/25 17:34:00  jim
00127 Modified to remove lint warnings
00128 
00129 Revision 1.1  2007/05/08 10:40:15  jim
00130 Initial entry
00131 
00132 
00133 */

Generated on 15 Mar 2012 for VIRCAM Pipeline by  doxygen 1.6.1