HAWKI Pipeline Reference Manual 1.8.12
hawki_pfits.c
00001 /* $Id: hawki_pfits.c,v 1.19 2013/01/15 09:57:13 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: 2013/01/15 09:57:13 $
00024  * $Revision: 1.19 $
00025  * $Name: hawki-1_8_12 $
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_alpha_hhmmss(const cpl_propertylist * plist)
00134 {
00135     double alpha_coded;
00136     alpha_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG ALPHA");
00137     return alpha_coded;
00138 }
00139 
00140 /*----------------------------------------------------------------------------*/
00148 /*----------------------------------------------------------------------------*/
00149 double hawki_pfits_get_targ_delta(const cpl_propertylist * plist)
00150 {
00151     double delta_coded;
00152     double dec_dd, dec_mm, dec_ss;
00153     double dec_deg;
00154     delta_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG DELTA");
00155     dec_dd = (int)(delta_coded / 10000);
00156     dec_mm = (int)((delta_coded - dec_dd * 10000) / 100);
00157     dec_ss = delta_coded - dec_dd * 10000 - dec_mm * 100;
00158     dec_deg = dec_dd + dec_mm / 60. + dec_ss / 3600.;
00159     return dec_deg;
00160 }
00161 
00162 /*----------------------------------------------------------------------------*/
00170 /*----------------------------------------------------------------------------*/
00171 double hawki_pfits_get_targ_delta_ddmmss(const cpl_propertylist * plist)
00172 {
00173     double delta_coded;
00174     delta_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG DELTA");
00175     return delta_coded;
00176 }
00177 
00178 /*----------------------------------------------------------------------------*/
00185 /*----------------------------------------------------------------------------*/
00186 double hawki_pfits_get_targ_equinox(const cpl_propertylist * plist)
00187 {
00188     return cpl_propertylist_get_double(plist, "ESO TEL TARG EQUINOX") ;
00189 }
00190 
00191 /*----------------------------------------------------------------------------*/
00198 /*----------------------------------------------------------------------------*/
00199 double hawki_pfits_get_targ_epoch(const cpl_propertylist * plist)
00200 {
00201     return cpl_propertylist_get_double(plist, "ESO TEL TARG EPOCH") ;
00202 }
00203 
00204 /*----------------------------------------------------------------------------*/
00210 /*----------------------------------------------------------------------------*/
00211 double hawki_pfits_get_ra(const cpl_propertylist * plist)
00212 {
00213     return cpl_propertylist_get_double(plist, "RA") ;
00214 }
00215 
00216 /*----------------------------------------------------------------------------*/
00222 /*----------------------------------------------------------------------------*/
00223 double hawki_pfits_get_dec(const cpl_propertylist * plist)
00224 {
00225     return cpl_propertylist_get_double(plist, "DEC") ;
00226 }
00227 
00228 /*----------------------------------------------------------------------------*/
00234 /*----------------------------------------------------------------------------*/
00235 const char * hawki_pfits_get_extname(const cpl_propertylist * plist)
00236 {
00237     return (const char *) cpl_propertylist_get_string(plist, "EXTNAME");
00238 }
00239 
00240 /*----------------------------------------------------------------------------*/
00246 /*----------------------------------------------------------------------------*/
00247 const char * hawki_pfits_get_arcfile(const cpl_propertylist * plist)
00248 {
00249     return (const char *) cpl_propertylist_get_string(plist, "ARCFILE");
00250 }
00251 
00252 /*----------------------------------------------------------------------------*/
00258 /*----------------------------------------------------------------------------*/
00259 const char * hawki_pfits_get_date_obs(const cpl_propertylist * plist)
00260 {
00261     return (const char *) cpl_propertylist_get_string(plist, "DATE-OBS") ;
00262 }
00263 
00264 /*----------------------------------------------------------------------------*/
00270 /*----------------------------------------------------------------------------*/
00271 int hawki_pfits_get_nexp(const cpl_propertylist * plist)
00272 {
00273     return cpl_propertylist_get_int(plist, "ESO TPL NEXP")  ;
00274 }
00275 
00276 /*----------------------------------------------------------------------------*/
00282 /*----------------------------------------------------------------------------*/
00283 double hawki_pfits_get_dit(const cpl_propertylist * plist)
00284 {
00285     return cpl_propertylist_get_double(plist, "ESO DET DIT")  ;
00286 }
00287 
00288 /*----------------------------------------------------------------------------*/
00294 /*----------------------------------------------------------------------------*/
00295 int hawki_pfits_get_ndit(const cpl_propertylist * plist)
00296 {
00297     return cpl_propertylist_get_int(plist, "ESO DET NDIT")  ;
00298 }
00299 
00300 /*----------------------------------------------------------------------------*/
00306 /*----------------------------------------------------------------------------*/
00307 int hawki_pfits_get_ndsamples(const cpl_propertylist * plist)
00308 {
00309     return cpl_propertylist_get_int(plist, "ESO DET NDSAMPLES")  ;
00310 }
00311 
00312 /*----------------------------------------------------------------------------*/
00318 /*----------------------------------------------------------------------------*/
00319 double hawki_pfits_get_pixscale(const cpl_propertylist * plist)
00320 {
00321     return cpl_propertylist_get_double(plist, "ESO INS PIXSCALE") ;
00322 }
00323 
00324 /*----------------------------------------------------------------------------*/
00330 /*----------------------------------------------------------------------------*/
00331 int hawki_pfits_get_naxis1(const cpl_propertylist * plist)
00332 {
00333     return cpl_propertylist_get_int(plist, "NAXIS1") ;
00334 }
00335 
00336 /*----------------------------------------------------------------------------*/
00342 /*----------------------------------------------------------------------------*/
00343 int hawki_pfits_get_naxis2(const cpl_propertylist * plist)
00344 {
00345     return cpl_propertylist_get_int(plist, "NAXIS2") ;
00346 }
00347 
00348 /*----------------------------------------------------------------------------*/
00354 /*----------------------------------------------------------------------------*/
00355 double hawki_pfits_get_crval1(const cpl_propertylist * plist)
00356 {
00357     return cpl_propertylist_get_double(plist, "CRVAL1") ;
00358 }
00359 
00360 /*----------------------------------------------------------------------------*/
00366 /*----------------------------------------------------------------------------*/
00367 double hawki_pfits_get_crval2(const cpl_propertylist * plist)
00368 {
00369     return cpl_propertylist_get_double(plist, "CRVAL2") ;
00370 }
00371 
00372 /*----------------------------------------------------------------------------*/
00378 /*----------------------------------------------------------------------------*/
00379 double hawki_pfits_get_crpix1(const cpl_propertylist * plist)
00380 {
00381     return cpl_propertylist_get_double(plist, "CRPIX1") ;
00382 }
00383 
00384 /*----------------------------------------------------------------------------*/
00390 /*----------------------------------------------------------------------------*/
00391 double hawki_pfits_get_crpix2(const cpl_propertylist * plist)
00392 {
00393     return cpl_propertylist_get_double(plist, "CRPIX2") ;
00394 }
00395 
00396 /*----------------------------------------------------------------------------*/
00402 /*----------------------------------------------------------------------------*/
00403 double hawki_pfits_get_cdelta1(const cpl_propertylist * plist)
00404 {
00405     return cpl_propertylist_get_double(plist, "CDELTA1") ;
00406 }
00407 
00408 /*----------------------------------------------------------------------------*/
00414 /*----------------------------------------------------------------------------*/
00415 double hawki_pfits_get_cdelta2(const cpl_propertylist * plist)
00416 {
00417     return cpl_propertylist_get_double(plist, "CDELTA2") ;
00418 }
00419 
00420 /*----------------------------------------------------------------------------*/
00426 /*----------------------------------------------------------------------------*/
00427 double hawki_pfits_get_cumoffseta(const cpl_propertylist * plist)
00428 {
00429     return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETA") ;
00430 }
00431 
00432 /*----------------------------------------------------------------------------*/
00438 /*----------------------------------------------------------------------------*/
00439 double hawki_pfits_get_cumoffsetd(const cpl_propertylist * plist)
00440 {
00441     return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETD") ;
00442 }
00443 
00444 /*----------------------------------------------------------------------------*/
00450 /*----------------------------------------------------------------------------*/
00451 double hawki_pfits_get_cumoffsetx(const cpl_propertylist * plist)
00452 {
00453     return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETX") ;
00454 }
00455 
00456 /*----------------------------------------------------------------------------*/
00462 /*----------------------------------------------------------------------------*/
00463 double hawki_pfits_get_cumoffsety(const cpl_propertylist * plist)
00464 {
00465     return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETY") ;
00466 }
00467 
00468 /*----------------------------------------------------------------------------*/
00474 /*----------------------------------------------------------------------------*/
00475 double hawki_pfits_get_posangle(const cpl_propertylist * plist)
00476 {
00477     return cpl_propertylist_get_double(plist, "ESO ADA POSANG") ;
00478 }
00479 
00480 /*----------------------------------------------------------------------------*/
00486 /*----------------------------------------------------------------------------*/
00487 const char * hawki_pfits_get_filter(const cpl_propertylist * plist)
00488 {
00489     const char  *   val ;
00490 
00491     val = cpl_propertylist_get_string(plist, "ESO INS FILT1 NAME") ;
00492     if (val == NULL) return NULL ;
00493     /* If FILT1 is not open, return its value */
00494     if (strcmp(val, "open") && strcmp(val, "OPEN")) return val ;
00495     /* FILT1 is open, return value from FILT2 */
00496     val = cpl_propertylist_get_string(plist, "ESO INS FILT2 NAME") ;
00497     if (val == NULL) return NULL ;
00498     if (strcmp(val, "open") && strcmp(val, "OPEN")) return val ;
00499     return NULL ;
00500 }
00501 
00502 /*----------------------------------------------------------------------------*/
00508 /*----------------------------------------------------------------------------*/
00509 double hawki_pfits_get_focus(const cpl_propertylist * plist)
00510 {
00511     return cpl_propertylist_get_double(plist, "ESO TEL FOCU VALUE") ;
00512 }
00513 
00514 /*----------------------------------------------------------------------------*/
00520 /*----------------------------------------------------------------------------*/
00521 double hawki_pfits_get_elevation(const cpl_propertylist * plist)
00522 {
00523     return cpl_propertylist_get_double(plist, "ESO TEL ALT") ;
00524 }
00525 
00526 /*----------------------------------------------------------------------------*/
00532 /*----------------------------------------------------------------------------*/
00533 double hawki_pfits_get_azimut(const cpl_propertylist * plist)
00534 {
00535     return cpl_propertylist_get_double(plist, "ESO TEL AZ") ;
00536 }
00537 
00538 /*----------------------------------------------------------------------------*/
00544 /*----------------------------------------------------------------------------*/
00545 double hawki_pfits_get_relhum(const cpl_propertylist * plist)
00546 {
00547     return cpl_propertylist_get_double(plist, "ESO TEL AMBI RHUM") ;
00548 }
00549 
00550 /*----------------------------------------------------------------------------*/
00556 /*----------------------------------------------------------------------------*/
00557 double hawki_pfits_get_tau0(const cpl_propertylist * plist)
00558 {
00559     return cpl_propertylist_get_double(plist, "ESO TEL AMBI TAU0") ;
00560 }
00561 
00562 /*----------------------------------------------------------------------------*/
00568 /*----------------------------------------------------------------------------*/
00569 double hawki_pfits_get_obs_temp(const cpl_propertylist * plist)
00570 {
00571     return cpl_propertylist_get_double(plist, "ESO TEL AMBI TEMP") ;
00572 }
00573 
00574 /*----------------------------------------------------------------------------*/
00580 /*----------------------------------------------------------------------------*/
00581 double hawki_pfits_get_wind_dir(const cpl_propertylist * plist)
00582 {
00583     return cpl_propertylist_get_double(plist, "ESO TEL AMBI WINDDIR") ;
00584 }
00585 
00586 /*----------------------------------------------------------------------------*/
00592 /*----------------------------------------------------------------------------*/
00593 double hawki_pfits_get_wind_speed(const cpl_propertylist * plist)
00594 {
00595     return cpl_propertylist_get_double(plist, "ESO TEL AMBI WINDSP") ;
00596 }
00597 
00598 /*----------------------------------------------------------------------------*/
00604 /*----------------------------------------------------------------------------*/
00605 double hawki_pfits_get_ao_fwhm(const cpl_propertylist * plist)
00606 {
00607     return cpl_propertylist_get_double(plist, "ESO TEL IA FWHM") ;
00608 }
00609 
00610 /*----------------------------------------------------------------------------*/
00616 /*----------------------------------------------------------------------------*/
00617 double hawki_pfits_get_rotator_start(const cpl_propertylist * plist)
00618 {
00619     return cpl_propertylist_get_double(plist, "ESO ADA ABSROT START") ;
00620 }
00621 
00622 /*----------------------------------------------------------------------------*/
00628 /*----------------------------------------------------------------------------*/
00629 double hawki_pfits_get_rotator_end(const cpl_propertylist * plist)
00630 {
00631     return cpl_propertylist_get_double(plist, "ESO ADA ABSROT END") ;
00632 }
00633 
00634 /*----------------------------------------------------------------------------*/
00640 /*----------------------------------------------------------------------------*/
00641 double hawki_pfits_get_obs_seeing_start(const cpl_propertylist * plist)
00642 {
00643     return cpl_propertylist_get_double(plist, "ESO TEL AMBI FWHM START") ;
00644 }
00645 
00646 /*----------------------------------------------------------------------------*/
00652 /*----------------------------------------------------------------------------*/
00653 double hawki_pfits_get_obs_seeing_end(const cpl_propertylist * plist)
00654 {
00655     return cpl_propertylist_get_double(plist, "ESO TEL AMBI FWHM END") ;
00656 }
00657 
00658 /*----------------------------------------------------------------------------*/
00664 /*----------------------------------------------------------------------------*/
00665 double hawki_pfits_get_pressure_start(const cpl_propertylist * plist)
00666 {
00667     return cpl_propertylist_get_double(plist, "ESO TEL AMBI PRES START") ;
00668 }
00669 
00670 /*----------------------------------------------------------------------------*/
00676 /*----------------------------------------------------------------------------*/
00677 double hawki_pfits_get_pressure_end(const cpl_propertylist * plist)
00678 {
00679     return cpl_propertylist_get_double(plist, "ESO TEL AMBI PRES END") ;
00680 }
00681 
00682 /*----------------------------------------------------------------------------*/
00688 /*----------------------------------------------------------------------------*/
00689 double hawki_pfits_get_parangle_start(const cpl_propertylist * plist)
00690 {
00691     return cpl_propertylist_get_double(plist, "ESO TEL PARANG START") ;
00692 }
00693 
00694 /*----------------------------------------------------------------------------*/
00700 /*----------------------------------------------------------------------------*/
00701 double hawki_pfits_get_parangle_end(const cpl_propertylist * plist)
00702 {
00703     return cpl_propertylist_get_double(plist, "ESO TEL PARANG END") ;
00704 }
00705 
00706 /*----------------------------------------------------------------------------*/
00712 /*----------------------------------------------------------------------------*/
00713 
00714 double hawki_pfits_get_comb_cumoffsetx(const cpl_propertylist * plist)
00715 {
00716     return cpl_propertylist_get_double(plist, "ESO QC COMBINED CUMOFFSETX");
00717 }
00718 
00719 /*----------------------------------------------------------------------------*/
00725 /*----------------------------------------------------------------------------*/
00726 double hawki_pfits_get_comb_cumoffsety(const cpl_propertylist * plist)
00727 {
00728     return cpl_propertylist_get_double(plist, "ESO QC COMBINED CUMOFFSETY");
00729 }
00730 
00731 /*----------------------------------------------------------------------------*/
00737 /*----------------------------------------------------------------------------*/
00738 double hawki_pfits_get_comb_posx(const cpl_propertylist * plist)
00739 {
00740     return cpl_propertylist_get_double(plist, "ESO QC COMBINED POSX");
00741 }
00742 
00743 /*----------------------------------------------------------------------------*/
00749 /*----------------------------------------------------------------------------*/
00750 double hawki_pfits_get_comb_posy(const cpl_propertylist * plist)
00751 {
00752     return cpl_propertylist_get_double(plist, "ESO QC COMBINED POSY");
00753 }
00754