HAWKI Pipeline Reference Manual  1.8.12
hawki_pfits.c
1 /* $Id: hawki_pfits.c,v 1.19 2013/01/15 09:57:13 cgarcia Exp $
2  *
3  * This file is part of the HAWKI Pipeline
4  * Copyright (C) 2002,2003 European Southern Observatory
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: cgarcia $
23  * $Date: 2013/01/15 09:57:13 $
24  * $Revision: 1.19 $
25  * $Name: hawki-1_8_12 $
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 
32 /*-----------------------------------------------------------------------------
33  Includes
34  -----------------------------------------------------------------------------*/
35 
36 #include <string.h>
37 #include <cpl.h>
38 
39 #include "hawki_pfits.h"
40 
41 /*----------------------------------------------------------------------------*/
46 /*----------------------------------------------------------------------------*/
47 
50 /*-----------------------------------------------------------------------------
51  Function codes
52  -----------------------------------------------------------------------------*/
53 
54 /*----------------------------------------------------------------------------*/
60 /*----------------------------------------------------------------------------*/
61 double hawki_pfits_get_airmass_start(const cpl_propertylist * plist)
62 {
63  return cpl_propertylist_get_double(plist, "ESO TEL AIRM START") ;
64 }
65 
66 /*----------------------------------------------------------------------------*/
72 /*----------------------------------------------------------------------------*/
73 double hawki_pfits_get_airmass_end(const cpl_propertylist * plist)
74 {
75  return cpl_propertylist_get_double(plist, "ESO TEL AIRM END") ;
76 }
77 
78 /*----------------------------------------------------------------------------*/
84 /*----------------------------------------------------------------------------*/
85 double hawki_pfits_get_humidity_level(const cpl_propertylist * plist)
86 {
87  return cpl_propertylist_get_double(plist, "ESO TEL AMBI RHUM") ;
88 }
89 
90 /*----------------------------------------------------------------------------*/
96 /*----------------------------------------------------------------------------*/
97 const char * hawki_pfits_get_procatg(const cpl_propertylist * plist)
98 {
99  return (const char *) cpl_propertylist_get_string(plist, "ESO PRO CATG");
100 }
101 
102 /*----------------------------------------------------------------------------*/
110 /*----------------------------------------------------------------------------*/
111 double hawki_pfits_get_targ_alpha(const cpl_propertylist * plist)
112 {
113  double alpha_coded;
114  double ra_hh, ra_mm, ra_ss;
115  double ra_deg;
116  alpha_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG ALPHA");
117  ra_hh = (int)(alpha_coded / 10000);
118  ra_mm = (int)((alpha_coded - ra_hh * 10000) / 100);
119  ra_ss = alpha_coded - ra_hh * 10000 - ra_mm * 100;
120  ra_deg = ra_hh * 15. + ra_mm / 4. + ra_ss / 240.;
121  return ra_deg;
122 }
123 
124 /*----------------------------------------------------------------------------*/
132 /*----------------------------------------------------------------------------*/
133 double hawki_pfits_get_targ_alpha_hhmmss(const cpl_propertylist * plist)
134 {
135  double alpha_coded;
136  alpha_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG ALPHA");
137  return alpha_coded;
138 }
139 
140 /*----------------------------------------------------------------------------*/
148 /*----------------------------------------------------------------------------*/
149 double hawki_pfits_get_targ_delta(const cpl_propertylist * plist)
150 {
151  double delta_coded;
152  double dec_dd, dec_mm, dec_ss;
153  double dec_deg;
154  delta_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG DELTA");
155  dec_dd = (int)(delta_coded / 10000);
156  dec_mm = (int)((delta_coded - dec_dd * 10000) / 100);
157  dec_ss = delta_coded - dec_dd * 10000 - dec_mm * 100;
158  dec_deg = dec_dd + dec_mm / 60. + dec_ss / 3600.;
159  return dec_deg;
160 }
161 
162 /*----------------------------------------------------------------------------*/
170 /*----------------------------------------------------------------------------*/
171 double hawki_pfits_get_targ_delta_ddmmss(const cpl_propertylist * plist)
172 {
173  double delta_coded;
174  delta_coded = cpl_propertylist_get_double(plist, "ESO TEL TARG DELTA");
175  return delta_coded;
176 }
177 
178 /*----------------------------------------------------------------------------*/
185 /*----------------------------------------------------------------------------*/
186 double hawki_pfits_get_targ_equinox(const cpl_propertylist * plist)
187 {
188  return cpl_propertylist_get_double(plist, "ESO TEL TARG EQUINOX") ;
189 }
190 
191 /*----------------------------------------------------------------------------*/
198 /*----------------------------------------------------------------------------*/
199 double hawki_pfits_get_targ_epoch(const cpl_propertylist * plist)
200 {
201  return cpl_propertylist_get_double(plist, "ESO TEL TARG EPOCH") ;
202 }
203 
204 /*----------------------------------------------------------------------------*/
210 /*----------------------------------------------------------------------------*/
211 double hawki_pfits_get_ra(const cpl_propertylist * plist)
212 {
213  return cpl_propertylist_get_double(plist, "RA") ;
214 }
215 
216 /*----------------------------------------------------------------------------*/
222 /*----------------------------------------------------------------------------*/
223 double hawki_pfits_get_dec(const cpl_propertylist * plist)
224 {
225  return cpl_propertylist_get_double(plist, "DEC") ;
226 }
227 
228 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 const char * hawki_pfits_get_extname(const cpl_propertylist * plist)
236 {
237  return (const char *) cpl_propertylist_get_string(plist, "EXTNAME");
238 }
239 
240 /*----------------------------------------------------------------------------*/
246 /*----------------------------------------------------------------------------*/
247 const char * hawki_pfits_get_arcfile(const cpl_propertylist * plist)
248 {
249  return (const char *) cpl_propertylist_get_string(plist, "ARCFILE");
250 }
251 
252 /*----------------------------------------------------------------------------*/
258 /*----------------------------------------------------------------------------*/
259 const char * hawki_pfits_get_date_obs(const cpl_propertylist * plist)
260 {
261  return (const char *) cpl_propertylist_get_string(plist, "DATE-OBS") ;
262 }
263 
264 /*----------------------------------------------------------------------------*/
270 /*----------------------------------------------------------------------------*/
271 int hawki_pfits_get_nexp(const cpl_propertylist * plist)
272 {
273  return cpl_propertylist_get_int(plist, "ESO TPL NEXP") ;
274 }
275 
276 /*----------------------------------------------------------------------------*/
282 /*----------------------------------------------------------------------------*/
283 double hawki_pfits_get_dit(const cpl_propertylist * plist)
284 {
285  return cpl_propertylist_get_double(plist, "ESO DET DIT") ;
286 }
287 
288 /*----------------------------------------------------------------------------*/
294 /*----------------------------------------------------------------------------*/
295 int hawki_pfits_get_ndit(const cpl_propertylist * plist)
296 {
297  return cpl_propertylist_get_int(plist, "ESO DET NDIT") ;
298 }
299 
300 /*----------------------------------------------------------------------------*/
306 /*----------------------------------------------------------------------------*/
307 int hawki_pfits_get_ndsamples(const cpl_propertylist * plist)
308 {
309  return cpl_propertylist_get_int(plist, "ESO DET NDSAMPLES") ;
310 }
311 
312 /*----------------------------------------------------------------------------*/
318 /*----------------------------------------------------------------------------*/
319 double hawki_pfits_get_pixscale(const cpl_propertylist * plist)
320 {
321  return cpl_propertylist_get_double(plist, "ESO INS PIXSCALE") ;
322 }
323 
324 /*----------------------------------------------------------------------------*/
330 /*----------------------------------------------------------------------------*/
331 int hawki_pfits_get_naxis1(const cpl_propertylist * plist)
332 {
333  return cpl_propertylist_get_int(plist, "NAXIS1") ;
334 }
335 
336 /*----------------------------------------------------------------------------*/
342 /*----------------------------------------------------------------------------*/
343 int hawki_pfits_get_naxis2(const cpl_propertylist * plist)
344 {
345  return cpl_propertylist_get_int(plist, "NAXIS2") ;
346 }
347 
348 /*----------------------------------------------------------------------------*/
354 /*----------------------------------------------------------------------------*/
355 double hawki_pfits_get_crval1(const cpl_propertylist * plist)
356 {
357  return cpl_propertylist_get_double(plist, "CRVAL1") ;
358 }
359 
360 /*----------------------------------------------------------------------------*/
366 /*----------------------------------------------------------------------------*/
367 double hawki_pfits_get_crval2(const cpl_propertylist * plist)
368 {
369  return cpl_propertylist_get_double(plist, "CRVAL2") ;
370 }
371 
372 /*----------------------------------------------------------------------------*/
378 /*----------------------------------------------------------------------------*/
379 double hawki_pfits_get_crpix1(const cpl_propertylist * plist)
380 {
381  return cpl_propertylist_get_double(plist, "CRPIX1") ;
382 }
383 
384 /*----------------------------------------------------------------------------*/
390 /*----------------------------------------------------------------------------*/
391 double hawki_pfits_get_crpix2(const cpl_propertylist * plist)
392 {
393  return cpl_propertylist_get_double(plist, "CRPIX2") ;
394 }
395 
396 /*----------------------------------------------------------------------------*/
402 /*----------------------------------------------------------------------------*/
403 double hawki_pfits_get_cdelta1(const cpl_propertylist * plist)
404 {
405  return cpl_propertylist_get_double(plist, "CDELTA1") ;
406 }
407 
408 /*----------------------------------------------------------------------------*/
414 /*----------------------------------------------------------------------------*/
415 double hawki_pfits_get_cdelta2(const cpl_propertylist * plist)
416 {
417  return cpl_propertylist_get_double(plist, "CDELTA2") ;
418 }
419 
420 /*----------------------------------------------------------------------------*/
426 /*----------------------------------------------------------------------------*/
427 double hawki_pfits_get_cumoffseta(const cpl_propertylist * plist)
428 {
429  return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETA") ;
430 }
431 
432 /*----------------------------------------------------------------------------*/
438 /*----------------------------------------------------------------------------*/
439 double hawki_pfits_get_cumoffsetd(const cpl_propertylist * plist)
440 {
441  return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETD") ;
442 }
443 
444 /*----------------------------------------------------------------------------*/
450 /*----------------------------------------------------------------------------*/
451 double hawki_pfits_get_cumoffsetx(const cpl_propertylist * plist)
452 {
453  return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETX") ;
454 }
455 
456 /*----------------------------------------------------------------------------*/
462 /*----------------------------------------------------------------------------*/
463 double hawki_pfits_get_cumoffsety(const cpl_propertylist * plist)
464 {
465  return cpl_propertylist_get_double(plist, "ESO SEQ CUMOFFSETY") ;
466 }
467 
468 /*----------------------------------------------------------------------------*/
474 /*----------------------------------------------------------------------------*/
475 double hawki_pfits_get_posangle(const cpl_propertylist * plist)
476 {
477  return cpl_propertylist_get_double(plist, "ESO ADA POSANG") ;
478 }
479 
480 /*----------------------------------------------------------------------------*/
486 /*----------------------------------------------------------------------------*/
487 const char * hawki_pfits_get_filter(const cpl_propertylist * plist)
488 {
489  const char * val ;
490 
491  val = cpl_propertylist_get_string(plist, "ESO INS FILT1 NAME") ;
492  if (val == NULL) return NULL ;
493  /* If FILT1 is not open, return its value */
494  if (strcmp(val, "open") && strcmp(val, "OPEN")) return val ;
495  /* FILT1 is open, return value from FILT2 */
496  val = cpl_propertylist_get_string(plist, "ESO INS FILT2 NAME") ;
497  if (val == NULL) return NULL ;
498  if (strcmp(val, "open") && strcmp(val, "OPEN")) return val ;
499  return NULL ;
500 }
501 
502 /*----------------------------------------------------------------------------*/
508 /*----------------------------------------------------------------------------*/
509 double hawki_pfits_get_focus(const cpl_propertylist * plist)
510 {
511  return cpl_propertylist_get_double(plist, "ESO TEL FOCU VALUE") ;
512 }
513 
514 /*----------------------------------------------------------------------------*/
520 /*----------------------------------------------------------------------------*/
521 double hawki_pfits_get_elevation(const cpl_propertylist * plist)
522 {
523  return cpl_propertylist_get_double(plist, "ESO TEL ALT") ;
524 }
525 
526 /*----------------------------------------------------------------------------*/
532 /*----------------------------------------------------------------------------*/
533 double hawki_pfits_get_azimut(const cpl_propertylist * plist)
534 {
535  return cpl_propertylist_get_double(plist, "ESO TEL AZ") ;
536 }
537 
538 /*----------------------------------------------------------------------------*/
544 /*----------------------------------------------------------------------------*/
545 double hawki_pfits_get_relhum(const cpl_propertylist * plist)
546 {
547  return cpl_propertylist_get_double(plist, "ESO TEL AMBI RHUM") ;
548 }
549 
550 /*----------------------------------------------------------------------------*/
556 /*----------------------------------------------------------------------------*/
557 double hawki_pfits_get_tau0(const cpl_propertylist * plist)
558 {
559  return cpl_propertylist_get_double(plist, "ESO TEL AMBI TAU0") ;
560 }
561 
562 /*----------------------------------------------------------------------------*/
568 /*----------------------------------------------------------------------------*/
569 double hawki_pfits_get_obs_temp(const cpl_propertylist * plist)
570 {
571  return cpl_propertylist_get_double(plist, "ESO TEL AMBI TEMP") ;
572 }
573 
574 /*----------------------------------------------------------------------------*/
580 /*----------------------------------------------------------------------------*/
581 double hawki_pfits_get_wind_dir(const cpl_propertylist * plist)
582 {
583  return cpl_propertylist_get_double(plist, "ESO TEL AMBI WINDDIR") ;
584 }
585 
586 /*----------------------------------------------------------------------------*/
592 /*----------------------------------------------------------------------------*/
593 double hawki_pfits_get_wind_speed(const cpl_propertylist * plist)
594 {
595  return cpl_propertylist_get_double(plist, "ESO TEL AMBI WINDSP") ;
596 }
597 
598 /*----------------------------------------------------------------------------*/
604 /*----------------------------------------------------------------------------*/
605 double hawki_pfits_get_ao_fwhm(const cpl_propertylist * plist)
606 {
607  return cpl_propertylist_get_double(plist, "ESO TEL IA FWHM") ;
608 }
609 
610 /*----------------------------------------------------------------------------*/
616 /*----------------------------------------------------------------------------*/
617 double hawki_pfits_get_rotator_start(const cpl_propertylist * plist)
618 {
619  return cpl_propertylist_get_double(plist, "ESO ADA ABSROT START") ;
620 }
621 
622 /*----------------------------------------------------------------------------*/
628 /*----------------------------------------------------------------------------*/
629 double hawki_pfits_get_rotator_end(const cpl_propertylist * plist)
630 {
631  return cpl_propertylist_get_double(plist, "ESO ADA ABSROT END") ;
632 }
633 
634 /*----------------------------------------------------------------------------*/
640 /*----------------------------------------------------------------------------*/
641 double hawki_pfits_get_obs_seeing_start(const cpl_propertylist * plist)
642 {
643  return cpl_propertylist_get_double(plist, "ESO TEL AMBI FWHM START") ;
644 }
645 
646 /*----------------------------------------------------------------------------*/
652 /*----------------------------------------------------------------------------*/
653 double hawki_pfits_get_obs_seeing_end(const cpl_propertylist * plist)
654 {
655  return cpl_propertylist_get_double(plist, "ESO TEL AMBI FWHM END") ;
656 }
657 
658 /*----------------------------------------------------------------------------*/
664 /*----------------------------------------------------------------------------*/
665 double hawki_pfits_get_pressure_start(const cpl_propertylist * plist)
666 {
667  return cpl_propertylist_get_double(plist, "ESO TEL AMBI PRES START") ;
668 }
669 
670 /*----------------------------------------------------------------------------*/
676 /*----------------------------------------------------------------------------*/
677 double hawki_pfits_get_pressure_end(const cpl_propertylist * plist)
678 {
679  return cpl_propertylist_get_double(plist, "ESO TEL AMBI PRES END") ;
680 }
681 
682 /*----------------------------------------------------------------------------*/
688 /*----------------------------------------------------------------------------*/
689 double hawki_pfits_get_parangle_start(const cpl_propertylist * plist)
690 {
691  return cpl_propertylist_get_double(plist, "ESO TEL PARANG START") ;
692 }
693 
694 /*----------------------------------------------------------------------------*/
700 /*----------------------------------------------------------------------------*/
701 double hawki_pfits_get_parangle_end(const cpl_propertylist * plist)
702 {
703  return cpl_propertylist_get_double(plist, "ESO TEL PARANG END") ;
704 }
705 
706 /*----------------------------------------------------------------------------*/
712 /*----------------------------------------------------------------------------*/
713 
714 double hawki_pfits_get_comb_cumoffsetx(const cpl_propertylist * plist)
715 {
716  return cpl_propertylist_get_double(plist, "ESO QC COMBINED CUMOFFSETX");
717 }
718 
719 /*----------------------------------------------------------------------------*/
725 /*----------------------------------------------------------------------------*/
726 double hawki_pfits_get_comb_cumoffsety(const cpl_propertylist * plist)
727 {
728  return cpl_propertylist_get_double(plist, "ESO QC COMBINED CUMOFFSETY");
729 }
730 
731 /*----------------------------------------------------------------------------*/
737 /*----------------------------------------------------------------------------*/
738 double hawki_pfits_get_comb_posx(const cpl_propertylist * plist)
739 {
740  return cpl_propertylist_get_double(plist, "ESO QC COMBINED POSX");
741 }
742 
743 /*----------------------------------------------------------------------------*/
749 /*----------------------------------------------------------------------------*/
750 double hawki_pfits_get_comb_posy(const cpl_propertylist * plist)
751 {
752  return cpl_propertylist_get_double(plist, "ESO QC COMBINED POSY");
753 }
754