naco_pfits.c

00001 /* $Id: naco_pfits.c,v 1.14 2008/11/05 09:59:59 llundin Exp $
00002  *
00003  * This file is part of the NACO Pipeline
00004  * Copyright (C) 2002,2003 European Southern Observatory
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., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: llundin $
00023  * $Date: 2008/11/05 09:59:59 $
00024  * $Revision: 1.14 $
00025  * $Name: naco-4_3_3 $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 /*-----------------------------------------------------------------------------
00033                                    Includes
00034  -----------------------------------------------------------------------------*/
00035 
00036 #include <string.h>
00037 #include <cpl.h>
00038 
00039 #include "naco_pfits.h"
00040 
00041 /*-----------------------------------------------------------------------------
00042                                    Define
00043  -----------------------------------------------------------------------------*/
00044 
00045 #define naco_pfits_get_bool(KEY)   irplib_pfits_get_bool(self, KEY)
00046 #define naco_pfits_get_double(KEY) irplib_pfits_get_double(self, KEY)
00047 #define naco_pfits_get_int(KEY)    irplib_pfits_get_int(self, KEY)
00048 #define naco_pfits_get_string(KEY) irplib_pfits_get_string(self, KEY)
00049 
00050 
00051 /*----------------------------------------------------------------------------*/
00056 /*----------------------------------------------------------------------------*/
00057 
00060 /*-----------------------------------------------------------------------------
00061                               Function codes
00062  -----------------------------------------------------------------------------*/
00063 
00064 /*----------------------------------------------------------------------------*/
00070 /*----------------------------------------------------------------------------*/
00071 double naco_pfits_get_airmass_start(const cpl_propertylist * self)
00072 {
00073     return naco_pfits_get_double("ESO TEL AIRM START");
00074 }
00075 
00076 /*----------------------------------------------------------------------------*/
00082 /*----------------------------------------------------------------------------*/
00083 double naco_pfits_get_airmass_end(const cpl_propertylist * self)
00084 {
00085     return naco_pfits_get_double("ESO TEL AIRM END");
00086 }
00087 
00088 /*----------------------------------------------------------------------------*/
00094 /*----------------------------------------------------------------------------*/
00095 double naco_pfits_get_cumoffsetx(const cpl_propertylist * self)
00096 {
00097     return naco_pfits_get_double("ESO SEQ CUMOFFSETX");
00098 }
00099 
00100 /*----------------------------------------------------------------------------*/
00106 /*----------------------------------------------------------------------------*/
00107 double naco_pfits_get_cumoffsety(const cpl_propertylist * self)
00108 {
00109     return naco_pfits_get_double("ESO SEQ CUMOFFSETY");
00110 }
00111 
00112 /*----------------------------------------------------------------------------*/
00118 /*----------------------------------------------------------------------------*/
00119 double naco_pfits_get_dec(const cpl_propertylist * self)
00120 {
00121     return naco_pfits_get_double("DEC");
00122 }
00123 
00124 /*----------------------------------------------------------------------------*/
00130 /*----------------------------------------------------------------------------*/
00131 double naco_pfits_get_dit(const cpl_propertylist * self)
00132 {
00133     return naco_pfits_get_double("ESO DET DIT");
00134 }
00135 
00136 /*----------------------------------------------------------------------------*/
00142 /*----------------------------------------------------------------------------*/
00143 double naco_pfits_get_ecmean(const cpl_propertylist * self)
00144 {
00145     return naco_pfits_get_double("ESO AOS RTC DET DST ECMEAN");
00146 }
00147 
00148 /*----------------------------------------------------------------------------*/
00154 /*----------------------------------------------------------------------------*/
00155 double naco_pfits_get_exptime(const cpl_propertylist * self)
00156 {
00157     return naco_pfits_get_double("EXPTIME");
00158 }
00159 
00160 /*----------------------------------------------------------------------------*/
00166 /*----------------------------------------------------------------------------*/
00167 const char * naco_pfits_get_filter(const cpl_propertylist * self)
00168 {
00169     const char    *    val;
00170     cpl_errorstate prestate = cpl_errorstate_get();
00171 
00172     /* Get value for OPTI5.ID */
00173     val = naco_pfits_get_string("ESO INS OPTI5 ID");
00174 
00175     if (val == NULL) {
00176         irplib_error_recover(prestate, "Could not get FITS key:");
00177     } else if (strcmp(val, "empty")) {
00178         /* OPTI5.ID is non-empty */
00179         return val;
00180     }
00181 
00182     /* Get value for OPTI6.ID */
00183     val = naco_pfits_get_string("ESO INS OPTI6 ID");
00184 
00185     if (val == NULL) {
00186         irplib_error_recover(prestate, "Could not get FITS key:");
00187     } else if (strcmp(val, "empty")) {
00188         /* OPTI6.ID is non-empty */
00189         return val;
00190     }
00191 
00192     /* Get value for OPTI4.ID */
00193     val = naco_pfits_get_string("ESO INS OPTI4 ID");
00194     cpl_ensure(val != NULL, cpl_error_get_code(), NULL);
00195     cpl_ensure(strcmp(val, "empty"), CPL_ERROR_ILLEGAL_OUTPUT, NULL);
00196 
00197     /* OPTI4.ID is non-empty */
00198     return val;
00199 }
00200 
00201 /*----------------------------------------------------------------------------*/
00207 /*----------------------------------------------------------------------------*/
00208 double naco_pfits_get_fluxmean(const cpl_propertylist * self)
00209 {
00210     return naco_pfits_get_double("ESO AOS RTC DET DST FLUXMEAN");
00211 }
00212 
00213 /*----------------------------------------------------------------------------*/
00219 /*----------------------------------------------------------------------------*/
00220 double naco_pfits_get_focus(const cpl_propertylist * self)
00221 {
00222     return naco_pfits_get_double("ESO AOS INS FOCU ABSPOS");
00223 }
00224 
00225 /*----------------------------------------------------------------------------*/
00231 /*----------------------------------------------------------------------------*/
00232 double naco_pfits_get_humidity_level(const cpl_propertylist * self)
00233 {
00234     return naco_pfits_get_double("ESO TEL AMBI RHUM");
00235 }
00236 
00237 /*----------------------------------------------------------------------------*/
00243 /*----------------------------------------------------------------------------*/
00244 double naco_pfits_get_l0mean(const cpl_propertylist * self)
00245 {
00246     return naco_pfits_get_double("ESO AOS RTC DET DST L0MEAN");
00247 }
00248 
00249 /*----------------------------------------------------------------------------*/
00255 /*----------------------------------------------------------------------------*/
00256 int naco_pfits_get_lamp2(const cpl_propertylist * self)
00257 {
00258     return naco_pfits_get_int("ESO INS LAMP2 SET");
00259 }
00260 
00261 /*----------------------------------------------------------------------------*/
00267 /*----------------------------------------------------------------------------*/
00268 const char * naco_pfits_get_mode(const cpl_propertylist * self)
00269 {
00270     return naco_pfits_get_string("ESO DET MODE NAME");
00271 }
00272 
00273 /*----------------------------------------------------------------------------*/
00279 /*----------------------------------------------------------------------------*/
00280 const char * naco_pfits_get_object(const cpl_propertylist * self)
00281 {
00282     return naco_pfits_get_string(NACO_PFITS_STRING_OBJECT);
00283 }
00284 
00285 /*----------------------------------------------------------------------------*/
00291 /*----------------------------------------------------------------------------*/
00292 int naco_pfits_get_ndit(const cpl_propertylist * self)
00293 {
00294     return naco_pfits_get_int("ESO DET NDIT");
00295 }
00296 
00297 /*----------------------------------------------------------------------------*/
00303 /*----------------------------------------------------------------------------*/
00304 const char * naco_pfits_get_opti3_name(const cpl_propertylist * self)
00305 {
00306     return naco_pfits_get_string("ESO INS OPTI3 NAME");
00307 }
00308 
00309 /*----------------------------------------------------------------------------*/
00315 /*----------------------------------------------------------------------------*/
00316 const char * naco_pfits_get_opti4_name(const cpl_propertylist * self)
00317 {
00318     return naco_pfits_get_string("ESO INS OPTI4 NAME");
00319 }
00320 
00321 
00322 /*----------------------------------------------------------------------------*/
00328 /*----------------------------------------------------------------------------*/
00329 const char * naco_pfits_get_opti7_name(const cpl_propertylist * self)
00330 {
00331     return naco_pfits_get_string("ESO INS OPTI7 NAME");
00332 }
00333 
00334 /*----------------------------------------------------------------------------*/
00340 /*----------------------------------------------------------------------------*/
00341 double naco_pfits_get_pixscale(const cpl_propertylist * self)
00342 {
00343     return naco_pfits_get_double("ESO INS PIXSCALE");
00344 }
00345 
00346 /*----------------------------------------------------------------------------*/
00352 /*----------------------------------------------------------------------------*/
00353 double naco_pfits_get_r0mean(const cpl_propertylist * self)
00354 {
00355     return naco_pfits_get_double("ESO AOS RTC DET DST R0MEAN");
00356 }
00357 
00358 /*----------------------------------------------------------------------------*/
00364 /*----------------------------------------------------------------------------*/
00365 double naco_pfits_get_ra(const cpl_propertylist * self)
00366 {
00367     return naco_pfits_get_double("RA");
00368 }
00369 
00370 /*----------------------------------------------------------------------------*/
00376 /*----------------------------------------------------------------------------*/
00377 int naco_pfits_get_rom(const cpl_propertylist * self)
00378 {
00379     return naco_pfits_get_int("ESO DET NCORRS");
00380 }
00381 
00382 /*----------------------------------------------------------------------------*/
00388 /*----------------------------------------------------------------------------*/
00389 const char * naco_pfits_get_rom_name(const cpl_propertylist * self)
00390 {
00391     return naco_pfits_get_string("ESO DET NCORRS NAME");
00392 }
00393 
00394 /*----------------------------------------------------------------------------*/
00400 /*----------------------------------------------------------------------------*/
00401 double naco_pfits_get_t0mean(const cpl_propertylist * self)
00402 {
00403     return naco_pfits_get_double("ESO AOS RTC DET DST T0MEAN");
00404 }
00405 
00406 /*----------------------------------------------------------------------------*/
00412 /*----------------------------------------------------------------------------*/
00413 const char * naco_pfits_get_templateid(const cpl_propertylist * self)
00414 {
00415     return naco_pfits_get_string("ESO TPL ID");
00416 }
00417 

Generated on Tue Mar 12 15:19:53 2013 for NACO Pipeline Reference Manual by  doxygen 1.4.7