hawki_pfits.c

00001 /* $Id: hawki_pfits.c,v 1.18 2010/02/23 10:58:44 cgarcia Exp $
00002  *
00003  * This file is part of the HAWKI 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: cgarcia $
00023  * $Date: 2010/02/23 10:58:44 $
00024  * $Revision: 1.18 $
00025  * $Name: hawki-1_8_0 $
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 "hawki_pfits.h"
00040 
00041 /*----------------------------------------------------------------------------*/
00046 /*----------------------------------------------------------------------------*/
00047 
00050 /*-----------------------------------------------------------------------------
00051                             Function codes
00052  -----------------------------------------------------------------------------*/
00053 
00054 /*----------------------------------------------------------------------------*/
00060 /*----------------------------------------------------------------------------*/
00061 double hawki_pfits_get_airmass_start(const cpl_propertylist * plist)
00062 {
00063     return cpl_propertylist_get_double(plist, "ESO TEL AIRM START") ;
00064 }
00065 
00066 /*----------------------------------------------------------------------------*/
00072 /*----------------------------------------------------------------------------*/
00073 double hawki_pfits_get_airmass_end(const cpl_propertylist * plist)
00074 {
00075     return cpl_propertylist_get_double(plist, "ESO TEL AIRM END") ;
00076 }
00077 
00078 /*----------------------------------------------------------------------------*/
00084 /*----------------------------------------------------------------------------*/
00085 double hawki_pfits_get_humidity_level(const cpl_propertylist * plist)
00086 {
00087     return cpl_propertylist_get_double(plist, "ESO TEL AMBI RHUM") ;
00088 }
00089 
00090 /*----------------------------------------------------------------------------*/
00096 /*----------------------------------------------------------------------------*/
00097 const char * hawki_pfits_get_procatg(const cpl_propertylist * plist)
00098 {
00099     return (const char *) cpl_propertylist_get_string(plist, "ESO PRO CATG");
00100 }
00101 
00102 /*----------------------------------------------------------------------------*/
00110 /*----------------------------------------------------------------------------*/
00111 double hawki_pfits_get_targ_alpha(const cpl_propertylist * plist)
00112 {
00113     double alpha_coded;
00114     double ra_hh, ra_mm, ra_ss;
00115     double ra_deg;
00116     alpha_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG ALPHA");
00117     ra_hh = (int)(alpha_coded / 10000);
00118     ra_mm = (int)((alpha_coded - ra_hh * 10000) / 100);
00119     ra_ss = alpha_coded - ra_hh * 10000 - ra_mm * 100;
00120     ra_deg = ra_hh * 15. + ra_mm / 4. + ra_ss / 240.;
00121     return ra_deg;
00122 }
00123 
00124 /*----------------------------------------------------------------------------*/
00132 /*----------------------------------------------------------------------------*/
00133 double hawki_pfits_get_targ_delta(const cpl_propertylist * plist)
00134 {
00135     double delta_coded;
00136     double dec_dd, dec_mm, dec_ss;
00137     double dec_deg;
00138     delta_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG DELTA");
00139     dec_dd = (int)(delta_coded / 10000);
00140     dec_mm = (int)((delta_coded - dec_dd * 10000) / 100);
00141     dec_ss = delta_coded - dec_dd * 10000 - dec_mm * 100;
00142     dec_deg = dec_dd + dec_mm / 60. + dec_ss / 3600.;
00143     return dec_deg;
00144 }
00145 
00146 /*----------------------------------------------------------------------------*/
00153 /*----------------------------------------------------------------------------*/
00154 double hawki_pfits_get_targ_equinox(const cpl_propertylist * plist)
00155 {
00156     return cpl_propertylist_get_double(plist, "ESO TEL TARG EQUINOX") ;
00157 }
00158 
00159 /*----------------------------------------------------------------------------*/
00166 /*----------------------------------------------------------------------------*/
00167 double hawki_pfits_get_targ_epoch(const cpl_propertylist * plist)
00168 {
00169     return cpl_propertylist_get_double(plist, "ESO TEL TARG EPOCH") ;
00170 }
00171 
00172 /*----------------------------------------------------------------------------*/
00178 /*----------------------------------------------------------------------------*/
00179 double hawki_pfits_get_ra(const cpl_propertylist * plist)
00180 {
00181     return cpl_propertylist_get_double(plist, "RA") ;
00182 }
00183 
00184 /*----------------------------------------------------------------------------*/
00190 /*----------------------------------------------------------------------------*/
00191 double hawki_pfits_get_dec(const cpl_propertylist * plist)
00192 {
00193     return cpl_propertylist_get_double(plist, "DEC") ;
00194 }
00195 
00196 /*----------------------------------------------------------------------------*/
00202 /*----------------------------------------------------------------------------*/
00203 const char * hawki_pfits_get_extname(const cpl_propertylist * plist)
00204 {
00205     return (const char *) cpl_propertylist_get_string(plist, "EXTNAME");
00206 }
00207 
00208 /*----------------------------------------------------------------------------*/
00214 /*----------------------------------------------------------------------------*/
00215 const char * hawki_pfits_get_arcfile(const cpl_propertylist * plist)
00216 {
00217     return (const char *) cpl_propertylist_get_string(plist, "ARCFILE");
00218 }
00219 
00220 /*----------------------------------------------------------------------------*/
00226 /*----------------------------------------------------------------------------*/
00227 const char * hawki_pfits_get_date_obs(const cpl_propertylist * plist)
00228 {
00229     return (const char *) cpl_propertylist_get_string(plist, "DATE-OBS") ;
00230 }
00231 
00232 /*----------------------------------------------------------------------------*/
00238 /*----------------------------------------------------------------------------*/
00239 int hawki_pfits_get_nexp(const cpl_propertylist * plist)
00240 {
00241     return cpl_propertylist_get_int(plist, "ESO TPL NEXP")  ;
00242 }
00243 
00244 /*----------------------------------------------------------------------------*/
00250 /*----------------------------------------------------------------------------*/
00251 double hawki_pfits_get_dit(const cpl_propertylist * plist)
00252 {
00253     return cpl_propertylist_get_double(plist, "ESO DET DIT")  ;
00254 }
00255 
00256 /*----------------------------------------------------------------------------*/
00262 /*----------------------------------------------------------------------------*/
00263 int hawki_pfits_get_ndit(const cpl_propertylist * plist)
00264 {
00265     return cpl_propertylist_get_int(plist, "ESO DET NDIT")  ;
00266 }
00267 
00268 /*----------------------------------------------------------------------------*/
00274 /*----------------------------------------------------------------------------*/
00275 int hawki_pfits_get_ndsamples(const cpl_propertylist * plist)
00276 {
00277     return cpl_propertylist_get_int(plist, "ESO DET NDSAMPLES")  ;
00278 }
00279 
00280 /*----------------------------------------------------------------------------*/
00286 /*----------------------------------------------------------------------------*/
00287 double hawki_pfits_get_pixscale(const cpl_propertylist * plist)
00288 {
00289     return cpl_propertylist_get_double(plist, "ESO INS PIXSCALE") ;
00290 }
00291 
00292 /*----------------------------------------------------------------------------*/
00298 /*----------------------------------------------------------------------------*/
00299 int hawki_pfits_get_naxis1(const cpl_propertylist * plist)
00300 {
00301     return cpl_propertylist_get_int(plist, "NAXIS1") ;
00302 }
00303 
00304 /*----------------------------------------------------------------------------*/
00310 /*----------------------------------------------------------------------------*/
00311 int hawki_pfits_get_naxis2(const cpl_propertylist * plist)
00312 {
00313     return cpl_propertylist_get_int(plist, "NAXIS2") ;
00314 }
00315 
00316 /*----------------------------------------------------------------------------*/
00322 /*----------------------------------------------------------------------------*/
00323 double hawki_pfits_get_crval1(const cpl_propertylist * plist)
00324 {
00325     return cpl_propertylist_get_double(plist, "CRVAL1") ;
00326 }
00327 
00328 /*----------------------------------------------------------------------------*/
00334 /*----------------------------------------------------------------------------*/
00335 double hawki_pfits_get_crval2(const cpl_propertylist * plist)
00336 {
00337     return cpl_propertylist_get_double(plist, "CRVAL2") ;
00338 }
00339 
00340 /*----------------------------------------------------------------------------*/
00346 /*----------------------------------------------------------------------------*/
00347 double hawki_pfits_get_crpix1(const cpl_propertylist * plist)
00348 {
00349     return cpl_propertylist_get_double(plist, "CRPIX1") ;
00350 }
00351 
00352 /*----------------------------------------------------------------------------*/
00358 /*----------------------------------------------------------------------------*/
00359 double hawki_pfits_get_crpix2(const cpl_propertylist * plist)
00360 {
00361     return cpl_propertylist_get_double(plist, "CRPIX2") ;
00362 }
00363 
00364 /*----------------------------------------------------------------------------*/
00370 /*----------------------------------------------------------------------------*/
00371 double hawki_pfits_get_cdelta1(const cpl_propertylist * plist)
00372 {
00373     return cpl_propertylist_get_double(plist, "CDELTA1") ;
00374 }
00375 
00376 /*----------------------------------------------------------------------------*/
00382 /*----------------------------------------------------------------------------*/
00383 double hawki_pfits_get_cdelta2(const cpl_propertylist * plist)
00384 {
00385     return cpl_propertylist_get_double(plist, "CDELTA2") ;
00386 }
00387 
00388 /*----------------------------------------------------------------------------*/
00394 /*----------------------------------------------------------------------------*/
00395 double hawki_pfits_get_cumoffseta(const cpl_propertylist * plist)
00396 {
00397     return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETA") ;
00398 }
00399 
00400 /*----------------------------------------------------------------------------*/
00406 /*----------------------------------------------------------------------------*/
00407 double hawki_pfits_get_cumoffsetd(const cpl_propertylist * plist)
00408 {
00409     return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETD") ;
00410 }
00411 
00412 /*----------------------------------------------------------------------------*/
00418 /*----------------------------------------------------------------------------*/
00419 double hawki_pfits_get_cumoffsetx(const cpl_propertylist * plist)
00420 {
00421     return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETX") ;
00422 }
00423 
00424 /*----------------------------------------------------------------------------*/
00430 /*----------------------------------------------------------------------------*/
00431 double hawki_pfits_get_cumoffsety(const cpl_propertylist * plist)
00432 {
00433     return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETY") ;
00434 }
00435 
00436 /*----------------------------------------------------------------------------*/
00442 /*----------------------------------------------------------------------------*/
00443 double hawki_pfits_get_posangle(const cpl_propertylist * plist)
00444 {
00445     return cpl_propertylist_get_double(plist, "ESO ADA POSANG") ;
00446 }
00447 
00448 /*----------------------------------------------------------------------------*/
00454 /*----------------------------------------------------------------------------*/
00455 const char * hawki_pfits_get_filter(const cpl_propertylist * plist)
00456 {
00457     const char  *   val ;
00458 
00459     val = cpl_propertylist_get_string(plist, "ESO INS FILT1 NAME") ;
00460     if (val == NULL) return NULL ;
00461     /* If FILT1 is not open, return its value */
00462     if (strcmp(val, "open") && strcmp(val, "OPEN")) return val ;
00463     /* FILT1 is open, return value from FILT2 */
00464     val = cpl_propertylist_get_string(plist, "ESO INS FILT2 NAME") ;
00465     if (val == NULL) return NULL ;
00466     if (strcmp(val, "open") && strcmp(val, "OPEN")) return val ;
00467     return NULL ;
00468 }
00469 
00470 /*----------------------------------------------------------------------------*/
00476 /*----------------------------------------------------------------------------*/
00477 double hawki_pfits_get_focus(const cpl_propertylist * plist)
00478 {
00479     return cpl_propertylist_get_double(plist, "ESO TEL FOCU VALUE") ;
00480 }
00481 
00482 /*----------------------------------------------------------------------------*/
00488 /*----------------------------------------------------------------------------*/
00489 double hawki_pfits_get_elevation(const cpl_propertylist * plist)
00490 {
00491     return cpl_propertylist_get_double(plist, "ESO TEL ALT") ;
00492 }
00493 
00494 /*----------------------------------------------------------------------------*/
00500 /*----------------------------------------------------------------------------*/
00501 double hawki_pfits_get_azimut(const cpl_propertylist * plist)
00502 {
00503     return cpl_propertylist_get_double(plist, "ESO TEL AZ") ;
00504 }
00505 
00506 /*----------------------------------------------------------------------------*/
00512 /*----------------------------------------------------------------------------*/
00513 double hawki_pfits_get_relhum(const cpl_propertylist * plist)
00514 {
00515     return cpl_propertylist_get_double(plist, "ESO TEL AMBI RHUM") ;
00516 }
00517 
00518 /*----------------------------------------------------------------------------*/
00524 /*----------------------------------------------------------------------------*/
00525 double hawki_pfits_get_tau0(const cpl_propertylist * plist)
00526 {
00527     return cpl_propertylist_get_double(plist, "ESO TEL AMBI TAU0") ;
00528 }
00529 
00530 /*----------------------------------------------------------------------------*/
00536 /*----------------------------------------------------------------------------*/
00537 double hawki_pfits_get_obs_temp(const cpl_propertylist * plist)
00538 {
00539     return cpl_propertylist_get_double(plist, "ESO TEL AMBI TEMP") ;
00540 }
00541 
00542 /*----------------------------------------------------------------------------*/
00548 /*----------------------------------------------------------------------------*/
00549 double hawki_pfits_get_wind_dir(const cpl_propertylist * plist)
00550 {
00551     return cpl_propertylist_get_double(plist, "ESO TEL AMBI WINDDIR") ;
00552 }
00553 
00554 /*----------------------------------------------------------------------------*/
00560 /*----------------------------------------------------------------------------*/
00561 double hawki_pfits_get_wind_speed(const cpl_propertylist * plist)
00562 {
00563     return cpl_propertylist_get_double(plist, "ESO TEL AMBI WINDSP") ;
00564 }
00565 
00566 /*----------------------------------------------------------------------------*/
00572 /*----------------------------------------------------------------------------*/
00573 double hawki_pfits_get_ao_fwhm(const cpl_propertylist * plist)
00574 {
00575     return cpl_propertylist_get_double(plist, "ESO TEL IA FWHM") ;
00576 }
00577 
00578 /*----------------------------------------------------------------------------*/
00584 /*----------------------------------------------------------------------------*/
00585 double hawki_pfits_get_rotator_start(const cpl_propertylist * plist)
00586 {
00587     return cpl_propertylist_get_double(plist, "ESO ADA ABSROT START") ;
00588 }
00589 
00590 /*----------------------------------------------------------------------------*/
00596 /*----------------------------------------------------------------------------*/
00597 double hawki_pfits_get_rotator_end(const cpl_propertylist * plist)
00598 {
00599     return cpl_propertylist_get_double(plist, "ESO ADA ABSROT END") ;
00600 }
00601 
00602 /*----------------------------------------------------------------------------*/
00608 /*----------------------------------------------------------------------------*/
00609 double hawki_pfits_get_obs_seeing_start(const cpl_propertylist * plist)
00610 {
00611     return cpl_propertylist_get_double(plist, "ESO TEL AMBI FWHM START") ;
00612 }
00613 
00614 /*----------------------------------------------------------------------------*/
00620 /*----------------------------------------------------------------------------*/
00621 double hawki_pfits_get_obs_seeing_end(const cpl_propertylist * plist)
00622 {
00623     return cpl_propertylist_get_double(plist, "ESO TEL AMBI FWHM END") ;
00624 }
00625 
00626 /*----------------------------------------------------------------------------*/
00632 /*----------------------------------------------------------------------------*/
00633 double hawki_pfits_get_pressure_start(const cpl_propertylist * plist)
00634 {
00635     return cpl_propertylist_get_double(plist, "ESO TEL AMBI PRES START") ;
00636 }
00637 
00638 /*----------------------------------------------------------------------------*/
00644 /*----------------------------------------------------------------------------*/
00645 double hawki_pfits_get_pressure_end(const cpl_propertylist * plist)
00646 {
00647     return cpl_propertylist_get_double(plist, "ESO TEL AMBI PRES END") ;
00648 }
00649 
00650 /*----------------------------------------------------------------------------*/
00656 /*----------------------------------------------------------------------------*/
00657 double hawki_pfits_get_parangle_start(const cpl_propertylist * plist)
00658 {
00659     return cpl_propertylist_get_double(plist, "ESO TEL PARANG START") ;
00660 }
00661 
00662 /*----------------------------------------------------------------------------*/
00668 /*----------------------------------------------------------------------------*/
00669 double hawki_pfits_get_parangle_end(const cpl_propertylist * plist)
00670 {
00671     return cpl_propertylist_get_double(plist, "ESO TEL PARANG END") ;
00672 }
00673 
00674 /*----------------------------------------------------------------------------*/
00680 /*----------------------------------------------------------------------------*/
00681 
00682 double hawki_pfits_get_comb_cumoffsetx(const cpl_propertylist * plist)
00683 {
00684     return cpl_propertylist_get_double(plist, "ESO QC COMBINED CUMOFFSETX");
00685 }
00686 
00687 /*----------------------------------------------------------------------------*/
00693 /*----------------------------------------------------------------------------*/
00694 double hawki_pfits_get_comb_cumoffsety(const cpl_propertylist * plist)
00695 {
00696     return cpl_propertylist_get_double(plist, "ESO QC COMBINED CUMOFFSETY");
00697 }
00698 
00699 /*----------------------------------------------------------------------------*/
00705 /*----------------------------------------------------------------------------*/
00706 double hawki_pfits_get_comb_posx(const cpl_propertylist * plist)
00707 {
00708     return cpl_propertylist_get_double(plist, "ESO QC COMBINED POSX");
00709 }
00710 
00711 /*----------------------------------------------------------------------------*/
00717 /*----------------------------------------------------------------------------*/
00718 double hawki_pfits_get_comb_posy(const cpl_propertylist * plist)
00719 {
00720     return cpl_propertylist_get_double(plist, "ESO QC COMBINED POSY");
00721 }
00722 

Generated on Thu Feb 17 17:13:07 2011 for HAWKI Pipeline Reference Manual by  doxygen 1.4.7