sinfo_pfits.c

00001 /* $Id: sinfo_pfits.c,v 1.14 2012/05/04 08:11:07 amodigli Exp $
00002  *
00003  * This file is part of the SINFONI 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: amodigli $
00023  * $Date: 2012/05/04 08:11:07 $
00024  * $Revision: 1.14 $
00025  * $Name: HEAD $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #  include <config.h>
00030 #endif
00031 /*----------------------------------------------------------------------------
00032                                    Includes
00033  ----------------------------------------------------------------------------*/
00034 #include <ctype.h>
00035 #include <cpl.h>
00036 #include "sinfo_pfits.h"
00037 #include "sinfo_key_names.h"
00038 #include "sinfo_utils_wrappers.h"
00039 #include "sinfo_msg.h"
00040 #include <string.h>
00041 
00042 /*---------------------------------------------------------------------------*/
00043 #define ASCIILINESZ                         1024
00044 #define PAF_MAGIC_SZ               13
00045 #define PAF_MAGIC       "PAF.HDR.START"
00046 
00047 /*-----------------------------------------------------------------------------
00048                               Function codes
00049  ----------------------------------------------------------------------------*/
00050 char * sinfo_paf_query(
00051         char    *   filename,
00052         char    *   key) ;
00053 
00054 static int sinfo_is_paf_file(char * filename) ;
00055 
00056 static char * sinfo_strcrop(char * s);
00057 
00058 
00067 /*---------------------------------------------------------------------------*/
00080 /*---------------------------------------------------------------------------*/
00081 static char * sinfo_strcrop(char * s)
00082 {
00083     static char l[ASCIILINESZ+1];
00084     char * last ;
00085 
00086     if (s==NULL) return NULL ;
00087     memset(l, 0, ASCIILINESZ+1);
00088     strcpy(l, s);
00089     last = l + strlen(l);
00090     while (last > l) {
00091         if (!isspace((int)*(last-1)))
00092             break ;
00093         last -- ;
00094     }
00095     *last = (char)0;
00096     return l ;
00097 }
00098 
00099 
00100 /*---------------------------------------------------------------------------*/
00113 /*---------------------------------------------------------------------------*/
00114 char * sinfo_paf_query(
00115         char    *   filename, 
00116         char    *   key)
00117 {
00118     static char value[ASCIILINESZ];
00119     FILE    *    paf ;
00120     char        line[ASCIILINESZ+1];
00121     char        val[ASCIILINESZ+1];
00122     char        head[ASCIILINESZ+1];
00123     int            found ;
00124     int            len ;
00125 
00126     /* Check inputs */
00127     if (filename==NULL || key==NULL) return NULL ;
00128 
00129     /* Check PAF validity */
00130     if (sinfo_is_paf_file(filename)!=1) {
00131         sinfo_msg_error("not a PAF file: [%s]", filename);
00132         return NULL ;
00133     }
00134 
00135     /* Open file and read it */
00136     paf = fopen(filename, "r");
00137     if (paf==NULL) {
00138         sinfo_msg_error("opening [%s]", filename);
00139         return NULL ;
00140     }
00141     
00142     found = 0 ;
00143     while (fgets(line, ASCIILINESZ, paf)!=NULL) {
00144         sscanf(line, "%[^ ]", head);
00145         if (!strcmp(head, key)) {
00146             /* Get value */
00147             sscanf(line, "%*[^ ] %[^;]", value);
00148             found ++ ;
00149             break ;
00150         }
00151     }
00152     if (!found) {
00153       fclose(paf);
00154       return NULL ;
00155     }
00156     
00157     /* Remove trailing blanks */
00158     strcpy(val, sinfo_strcrop(value));
00159     /* Get rid of possible quotes */
00160     len = strlen(val);
00161     if (val[0]=='\"' && val[len-1]=='\"') {
00162         strncpy(value, val+1, len-2);
00163         value[len-2]=(char)0;
00164     } else {
00165         strcpy(value, val);
00166     }
00167     if(paf!=NULL){
00168        fclose(paf);
00169     }
00170     return value ;
00171 }
00172 
00173 /*---------------------------------------------------------------------------*/
00182 /*---------------------------------------------------------------------------*/
00183 static int sinfo_is_paf_file(char * filename)
00184 {
00185     FILE    *    fp ;
00186     int            is_paf ;
00187     char        line[ASCIILINESZ] ;
00188     
00189     if (filename==NULL) return -1 ;
00190 
00191     /* Initialize is_paf */
00192     is_paf = 0 ;
00193 
00194     /* Open file */
00195     if ((fp = fopen(filename, "r"))==NULL) {
00196         sinfo_msg_error("cannot open file [%s]", filename) ;
00197         return -1 ;
00198     }
00199 
00200     /* Parse file */
00201     while (fgets(line, ASCIILINESZ, fp) != NULL) {
00202         if (line[0] != '#') {
00203            if (!strncmp(line, PAF_MAGIC, PAF_MAGIC_SZ)) is_paf = 1 ;
00204              (void)fclose(fp) ;
00205             return is_paf ;
00206         }
00207     }
00208 
00209     (void)fclose(fp) ;
00210     return is_paf ;
00211 }
00212 
00213 /*---------------------------------------------------------------------------*/
00219 /*---------------------------------------------------------------------------*/
00220 char * sinfo_pfits_get_mode(const cpl_propertylist * plist)
00221 {
00222 
00223    return (char*) cpl_propertylist_get_string(plist,"ESO DET MODE NAME");
00224   
00225 }
00226 
00227 /*---------------------------------------------------------------------------*/
00233 /*---------------------------------------------------------------------------*/
00234 double sinfo_pfits_get_exp_time(const cpl_propertylist* plist)
00235 {
00236   
00237     return cpl_propertylist_get_double(plist,"EXPTIME");
00238 
00239 }
00240 
00241 
00242 
00243 
00244 
00245 /*----------------------------------------------------------------------------
00246    Function     :       sinfo_pfits_get_ditndit()
00247    In           :       fits file name
00248    Out          :       total integration time in sec
00249    Job          :       reads the product dit*ndit from the FITS-header 
00250  ---------------------------------------------------------------------------*/
00251 double sinfo_pfits_get_ditndit(const char* name)
00252 {
00253   double dit;
00254   int ndit=0;
00255   cpl_propertylist* plist=NULL;
00256   plist=cpl_propertylist_load(name,0);
00257 
00258   dit = cpl_propertylist_get_double(plist,"ESO DET DIT");
00259   ndit = cpl_propertylist_get_int(plist,"ESO DET NDIT");
00260   sinfo_free_propertylist(&plist);
00261   return dit*ndit ;
00262 
00263 }
00264 
00265 
00266 /*---------------------------------------------------------------------------*/
00272 /*---------------------------------------------------------------------------*/
00273 double sinfo_pfits_get_exptime(const char * filename)
00274 {
00275     double exptime ;
00276     cpl_propertylist* plist=NULL;
00277     plist=cpl_propertylist_load(filename,0);
00278     exptime = cpl_propertylist_get_double(plist,"EXPTIME");
00279     sinfo_free_propertylist(&plist);
00280     
00281     return exptime;
00282 }
00283 
00284 
00285 
00286 
00287 /*---------------------------------------------------------------------------*/
00293 /*---------------------------------------------------------------------------*/
00294 int sinfo_pfits_get_rom(const cpl_propertylist * plist)
00295 {
00296 
00297     return  cpl_propertylist_get_int(plist,"ESO DET NCORRS");
00298 
00299 }
00300 
00301 /*---------------------------------------------------------------------------*/
00307 /*---------------------------------------------------------------------------*/
00308 int sinfo_pfits_get_expno(const cpl_propertylist * plist)
00309 {
00310     
00311    return cpl_propertylist_get_int(plist,"ESO TPL EXPNO");
00312 
00313 }
00314 
00315 
00316 /*---------------------------------------------------------------------------*/
00322 /*---------------------------------------------------------------------------*/
00323 double sinfo_pfits_get_airmass_start(const cpl_propertylist * plist)
00324 {
00325 
00326     return cpl_propertylist_get_double(plist,"ESO TEL AIRM START");
00327 
00328 }
00329 
00330 /*---------------------------------------------------------------------------*/
00336 /*---------------------------------------------------------------------------*/
00337 double sinfo_pfits_get_airmass_end(const cpl_propertylist * plist)
00338 {
00339     return cpl_propertylist_get_double(plist,"ESO TEL AIRM END");
00340 
00341 }
00342 
00343 /*---------------------------------------------------------------------------*/
00349 /*---------------------------------------------------------------------------*/
00350 double sinfo_pfits_get_alpha(const cpl_propertylist * plist)
00351 {
00352   return cpl_propertylist_get_double(plist,"ESO TEL TARG OFFSETALPHA");
00353 }
00354 
00355 /*---------------------------------------------------------------------------*/
00361 /*---------------------------------------------------------------------------*/
00362 double sinfo_pfits_get_targ_alpha(const cpl_propertylist * plist)
00363 {
00364   return cpl_propertylist_get_double(plist,"ESO INS TARG ALPHA");
00365 }
00366 
00367 
00368 /*---------------------------------------------------------------------------*/
00374 /*---------------------------------------------------------------------------*/
00375 double sinfo_pfits_get_targ_delta(const cpl_propertylist * plist)
00376 {
00377   return cpl_propertylist_get_double(plist,"ESO INS TARG DELTA");
00378 }
00379 
00380 /*---------------------------------------------------------------------------*/
00386 /*---------------------------------------------------------------------------*/
00387 const char * sinfo_pfits_get_arcfile(const cpl_propertylist * plist)
00388 {
00389     return (const char*) cpl_propertylist_get_string(plist,KEY_NAME_ARCFILE);
00390 }
00391 
00392 /*---------------------------------------------------------------------------*/
00398 /*---------------------------------------------------------------------------*/
00399 const char * sinfo_pfits_get_rec1raw1name(const cpl_propertylist * plist)
00400 {
00401     return (const char*) cpl_propertylist_get_string(plist,
00402                                                   KEY_NAME_PRO_REC1_RAW1_NAME);
00403 }
00404 
00405 /*---------------------------------------------------------------------------*/
00411 /*---------------------------------------------------------------------------*/
00412 const char * sinfo_pfits_get_ins_setup(const cpl_propertylist * plist)
00413 {
00414   if(cpl_propertylist_get_string(plist,"ESO INS SETUP ID")) {
00415     return (const char*) cpl_propertylist_get_string(plist,"ESO INS SETUP ID");
00416   } else {
00417     cpl_error_reset();
00418     return "Dark";
00419   }
00420 
00421 }
00422 
00423 
00424 
00425 /*---------------------------------------------------------------------------*/
00431 /*---------------------------------------------------------------------------*/
00432 double sinfo_pfits_get_wlen(const cpl_propertylist * plist)
00433 {
00434 
00435     return cpl_propertylist_get_double(plist,"ESO INS GRAT1 WLEN");
00436 }
00437 
00438 /*---------------------------------------------------------------------------*/
00444 /*---------------------------------------------------------------------------*/
00445 int sinfo_pfits_get_chop_ncycles(const cpl_propertylist * plist)
00446 {
00447 
00448     return cpl_propertylist_get_int(plist,"ESO DET CHOP NCYCLES");
00449 
00450 }
00451 
00452 /*---------------------------------------------------------------------------*/
00458 /*---------------------------------------------------------------------------*/
00459 double sinfo_pfits_get_pixscale(const cpl_propertylist * plist)
00460 {
00461   const char* val=NULL;
00462   val=cpl_propertylist_get_string(plist,"ESO INS OPTI1 NAME");
00463   return atof(val);
00464 }
00465 
00466 /*---------------------------------------------------------------------------*/
00472 /*---------------------------------------------------------------------------*/
00473 double sinfo_pfits_get_posangle(const cpl_propertylist * plist)
00474 {
00475     return cpl_propertylist_get_double(plist,"ESO ADA POSANG");
00476 }
00477 
00478 /*---------------------------------------------------------------------------*/
00484 /*---------------------------------------------------------------------------*/
00485 double sinfo_pfits_get_DEC(const cpl_propertylist * plist)
00486 {
00487     return cpl_propertylist_get_double(plist,"DEC");
00488 }
00489 
00490 
00491 /*---------------------------------------------------------------------------*/
00497 /*---------------------------------------------------------------------------*/
00498 double sinfo_pfits_get_cumoffsetx(const cpl_propertylist * plist)
00499 {
00500     return cpl_propertylist_get_double(plist,"ESO SEQ CUMOFFSETX");
00501 }
00502 
00503 /*---------------------------------------------------------------------------*/
00509 /*---------------------------------------------------------------------------*/
00510 double sinfo_pfits_get_cumoffsety(const cpl_propertylist * plist)
00511 {
00512     return cpl_propertylist_get_double(plist,"ESO SEQ CUMOFFSETY");
00513 }
00514 
00515 /*---------------------------------------------------------------------------*/
00521 /*---------------------------------------------------------------------------*/
00522 const char * sinfo_pfits_get_date_obs(const cpl_propertylist * plist)
00523 {
00524 
00525     return (const char*) cpl_propertylist_get_string(plist,"DATE-OBS");
00526 
00527 }
00528         
00529 /*---------------------------------------------------------------------------*/
00535 /*---------------------------------------------------------------------------*/
00536 double  sinfo_pfits_get_delta(const cpl_propertylist * plist)
00537 {
00538 
00539     return cpl_propertylist_get_double(plist,"ESO TEL TARG OFFSETDELTA");
00540 
00541 }
00542 
00543 /*---------------------------------------------------------------------------*/
00549 /*---------------------------------------------------------------------------*/
00550 double  sinfo_pfits_get_dec(const cpl_propertylist * plist)
00551 {
00552     return cpl_propertylist_get_double(plist,"DEC");
00553 }
00554 
00555 /*---------------------------------------------------------------------------*/
00562 /*---------------------------------------------------------------------------*/
00563 double sinfo_pfits_get_dit(const cpl_propertylist * plist)
00564 {
00565     return cpl_propertylist_get_double(plist,"ESO DET DIT");
00566 }
00567 /*---------------------------------------------------------------------------*/
00573 /*---------------------------------------------------------------------------*/
00574 float sinfo_pfits_get_pixelscale(const char * name)
00575 {
00576   cpl_propertylist* plist=NULL;
00577   float pixscale=0;
00578   const char* scale=NULL;
00579   plist=cpl_propertylist_load(name,0);
00580   scale= cpl_propertylist_get_string(plist,"ESO INS OPTI1 NAME");
00581   pixscale=atof(scale);
00582   sinfo_free_propertylist(&plist);
00583   return pixscale;
00584 }
00585 
00586 
00587 /*---------------------------------------------------------------------------*/
00594 /*---------------------------------------------------------------------------*/
00595 const char * sinfo_pfits_get_ncorrs_name(const cpl_propertylist * plist)
00596 {
00597     return cpl_propertylist_get_string(plist,"ESO DET NCORRS NAME");
00598 }
00599 
00600 
00601 /*---------------------------------------------------------------------------*/
00608 /*---------------------------------------------------------------------------*/
00609 const char * sinfo_pfits_get_band(const cpl_propertylist * plist)
00610 {
00611     return cpl_propertylist_get_string(plist,"ESO INS FILT1 NAME");
00612 }
00613 
00614 /*---------------------------------------------------------------------------*/
00620 /*---------------------------------------------------------------------------*/
00621 const char * sinfo_pfits_get_dpr_catg(const cpl_propertylist * plist)
00622 {
00623     return cpl_propertylist_get_string(plist,"ESO DPR CATG");
00624 }
00625 
00626 /*---------------------------------------------------------------------------*/
00632 /*---------------------------------------------------------------------------*/
00633 const char * sinfo_pfits_get_dpr_tech(const cpl_propertylist * plist)
00634 {
00635     return cpl_propertylist_get_string(plist,"ESO DPR TECH");
00636 }
00637 
00638 /*---------------------------------------------------------------------------*/
00644 /*---------------------------------------------------------------------------*/
00645 const char * sinfo_pfits_get_dpr_type(const cpl_propertylist * plist)
00646 {
00647     return cpl_propertylist_get_string(plist,"ESO DPR TYPE");
00648 }
00649 
00650 
00651 /*---------------------------------------------------------------------------*/
00657 /*---------------------------------------------------------------------------*/
00658 const char * sinfo_pfits_get_filter_im(const cpl_propertylist * plist)
00659 {
00660   return cpl_propertylist_get_string(plist,"ESO INS FILT1 NAME");
00661 }
00662 
00663 /*---------------------------------------------------------------------------*/
00669 /*---------------------------------------------------------------------------*/
00670 const char * sinfo_pfits_get_filter_spec(const cpl_propertylist * plist)
00671 {
00672     return cpl_propertylist_get_string(plist,"ESO INS FILT2 NAME");
00673 }
00674 
00675 /*---------------------------------------------------------------------------*/
00681 /*---------------------------------------------------------------------------*/
00682 double sinfo_pfits_get_focus(const cpl_propertylist * plist)
00683 {
00684     return cpl_propertylist_get_double(plist,"ESO TEL FOCU LEN");
00685 }
00686 
00687 
00688 /*---------------------------------------------------------------------------*/
00694 /*---------------------------------------------------------------------------*/
00695 const char * sinfo_pfits_get_frame_type(const cpl_propertylist * plist)
00696 {
00697     return cpl_propertylist_get_string(plist,"ESO DET FRAM TYPE");
00698 }
00699 
00700 /*---------------------------------------------------------------------------*/
00706 /*---------------------------------------------------------------------------*/
00707 const char * sinfo_pfits_get_instrument(const cpl_propertylist * plist)
00708 {
00709     return cpl_propertylist_get_string(plist,"INSTRUME");
00710 }
00711 
00712 /*---------------------------------------------------------------------------*/
00718 /*---------------------------------------------------------------------------*/
00719 double sinfo_pfits_get_mjdobs(const cpl_propertylist * plist)
00720 {
00721     return cpl_propertylist_get_double(plist,"MJD-OBS");
00722 }
00723 
00724 
00725 /*---------------------------------------------------------------------------*/
00731 /*---------------------------------------------------------------------------*/
00732 double sinfo_pfits_get_monoc_pos(const cpl_propertylist * plist)
00733 {
00734     return cpl_propertylist_get_double(plist,"INS MONOC1 POS");
00735 }
00736 
00737 /*---------------------------------------------------------------------------*/
00743 /*---------------------------------------------------------------------------*/
00744 int sinfo_pfits_get_ndit(const cpl_propertylist * plist)
00745 {
00746     return cpl_propertylist_get_int(plist,"ESO DET NDIT");
00747 }
00748 
00749 /*---------------------------------------------------------------------------*/
00755 /*---------------------------------------------------------------------------*/
00756 int sinfo_pfits_get_naxis1(const cpl_propertylist * plist)
00757 {
00758     return cpl_propertylist_get_int(plist,"NAXIS1");
00759 }
00760 
00761 
00762 /*---------------------------------------------------------------------------*/
00768 /*---------------------------------------------------------------------------*/
00769 int sinfo_pfits_get_naxis2(const cpl_propertylist * plist)
00770 {
00771     return cpl_propertylist_get_int(plist,"NAXIS2");
00772 }
00773 
00774 
00775 /*---------------------------------------------------------------------------*/
00781 /*---------------------------------------------------------------------------*/
00782 int sinfo_pfits_get_naxis3(const cpl_propertylist * plist)
00783 {
00784     return cpl_propertylist_get_int(plist,"NAXIS3");
00785 }
00786 
00787 
00788 
00789 
00790 /*---------------------------------------------------------------------------*/
00796 /*---------------------------------------------------------------------------*/
00797 double sinfo_pfits_get_crpix1(const cpl_propertylist * plist)
00798 {
00799     return cpl_propertylist_get_double(plist,"CRPIX1");
00800 }
00801 
00802 
00803 
00804 /*---------------------------------------------------------------------------*/
00810 /*---------------------------------------------------------------------------*/
00811 double sinfo_pfits_get_crpix2(const cpl_propertylist * plist)
00812 {
00813     return cpl_propertylist_get_double(plist,"CRPIX2");
00814 }
00815 
00816 
00817 
00818 /*---------------------------------------------------------------------------*/
00824 /*---------------------------------------------------------------------------*/
00825 double sinfo_pfits_get_crpix3(const cpl_propertylist * plist)
00826 {
00827     return cpl_propertylist_get_double(plist,"CRPIX3");
00828 }
00829 
00830 
00831 /*---------------------------------------------------------------------------*/
00837 /*---------------------------------------------------------------------------*/
00838 double sinfo_pfits_get_cdelt1(const cpl_propertylist * plist)
00839 {
00840     return cpl_propertylist_get_double(plist,"CDELT1");
00841 }
00842 
00843 
00844 
00845 /*---------------------------------------------------------------------------*/
00851 /*---------------------------------------------------------------------------*/
00852 double sinfo_pfits_get_cdelt2(const cpl_propertylist * plist)
00853 {
00854     return cpl_propertylist_get_double(plist,"CDELT2");
00855 }
00856 
00857 
00858 
00859 /*---------------------------------------------------------------------------*/
00865 /*---------------------------------------------------------------------------*/
00866 double sinfo_pfits_get_cdelt3(const cpl_propertylist * plist)
00867 {
00868     return cpl_propertylist_get_double(plist,"CDELT3");
00869 }
00870 
00871 
00872 
00873 /*---------------------------------------------------------------------------*/
00879 /*---------------------------------------------------------------------------*/
00880 double sinfo_pfits_get_crval1(const cpl_propertylist * plist)
00881 {
00882     return cpl_propertylist_get_double(plist,"CRVAL1");
00883 }
00884 
00885 /*---------------------------------------------------------------------------*/
00891 /*---------------------------------------------------------------------------*/
00892 double sinfo_pfits_get_crval2(const cpl_propertylist * plist)
00893 {
00894     return cpl_propertylist_get_double(plist,"CRVAL2");
00895 }
00896 
00897 /*---------------------------------------------------------------------------*/
00903 /*---------------------------------------------------------------------------*/
00904 double sinfo_pfits_get_crval3(const cpl_propertylist * plist)
00905 {
00906     return cpl_propertylist_get_double(plist,"CRVAL3");
00907 }
00908 
00909 /*---------------------------------------------------------------------------*/
00915 /*---------------------------------------------------------------------------*/
00916 int sinfo_pfits_get_numbexp(const cpl_propertylist * plist)
00917 {
00918     return cpl_propertylist_get_int(plist,"ESO TPL NEXP");
00919 }
00920 
00921 /*---------------------------------------------------------------------------*/
00927 /*---------------------------------------------------------------------------*/
00928 const char * sinfo_pfits_get_obs_id(const cpl_propertylist * plist)
00929 {
00930     return cpl_propertylist_get_string(plist,"ESO OBS ID");
00931 }
00932 
00933 /*---------------------------------------------------------------------------*/
00939 /*---------------------------------------------------------------------------*/
00940 int sinfo_pfits_get_nodpos(const cpl_propertylist * plist)
00941 {
00942     return cpl_propertylist_get_int(plist,"ESO SEQ NODPOS");
00943 }
00944 
00945 
00946 
00947 /*---------------------------------------------------------------------------*/
00953 /*---------------------------------------------------------------------------*/
00954 double sinfo_pfits_get_ra(const cpl_propertylist * plist)
00955 {
00956     return cpl_propertylist_get_double(plist,"RA");
00957 }
00958 
00959 /*---------------------------------------------------------------------------*/
00965 /*---------------------------------------------------------------------------*/
00966 const char * sinfo_pfits_get_starname(const cpl_propertylist * plist)
00967 {
00968     return cpl_propertylist_get_string(plist,"ESO OBS TARG NAME");
00969 }
00970 
00971 /*---------------------------------------------------------------------------*/
00977 /*---------------------------------------------------------------------------*/
00978 double sinfo_pfits_get_resol(const cpl_propertylist * plist)
00979 {
00980     return cpl_propertylist_get_double(plist,"ESO INS RESOL");
00981 }
00982 
00983 /*---------------------------------------------------------------------------*/
00989 /*---------------------------------------------------------------------------*/
00990 const char * sinfo_pfits_get_templateid(const cpl_propertylist * plist)
00991 {
00992     return (const char*) cpl_propertylist_get_string(plist,"ESO TPL ID"); 
00993 }
01002 static cpl_error_code
01003 sinfo_plist_set_extra_common_keys(cpl_propertylist* plist)
01004 {
01005 
01006     cpl_propertylist_append_string(plist,"HDUCLASS", "ESO") ;
01007     cpl_propertylist_set_comment(plist,"HDUCLASS","hdu classification") ;
01008 
01009     cpl_propertylist_append_string(plist,"HDUDOC", "DICD") ;
01010     cpl_propertylist_set_comment(plist,"HDUDOC","hdu reference document") ;
01011 
01012     cpl_propertylist_append_string(plist,"HDUVERS", "DICD V6.0") ;
01013     cpl_propertylist_set_comment(plist,"HDUVERS","hdu reference document version") ;
01014 
01015     return cpl_error_get_code();
01016 }
01017 
01030 cpl_error_code
01031 sinfo_plist_set_extra_keys(cpl_propertylist* plist,
01032              const char* hduclas1,
01033              const char* hduclas2,
01034              const char* hduclas3,
01035              const char* scidata,
01036              const char* errdata,
01037              const char* qualdata,
01038                          const int type)
01039 {
01040 
01041   cpl_ensure_code(type<3,CPL_ERROR_ILLEGAL_INPUT);
01042   cpl_ensure_code(type>=0,CPL_ERROR_ILLEGAL_INPUT);
01043 
01044   sinfo_plist_set_extra_common_keys(plist);
01045 
01046   cpl_propertylist_append_string(plist,"HDUCLAS1",hduclas1) ;
01047   cpl_propertylist_set_comment(plist,"HDUCLAS1","hdu format classification") ;
01048 
01049   cpl_propertylist_append_string(plist,"HDUCLAS2",hduclas2) ;
01050   cpl_propertylist_set_comment(plist,"HDUCLAS2","hdu type classification") ;
01051 
01052   if(type!=0) {
01053     cpl_propertylist_append_string(plist,"HDUCLAS3",hduclas3) ;
01054     cpl_propertylist_set_comment(plist,"HDUCLAS3","hdu info classification") ;
01055     cpl_propertylist_append_string(plist,"SCIDATA",scidata) ;
01056     cpl_propertylist_set_comment(plist,"SCIDATA","name of data extension") ;
01057   }
01058 
01059   if(type!=1) {
01060 /* CASA prefers to have these not set if the extension actually does not exist
01061     cpl_propertylist_append_string(plist,"ERRDATA",errdata) ;
01062     cpl_propertylist_set_comment(plist,"ERRDATA","name of errs extension") ;
01063 */
01064   }
01065 
01066   if(type!=2) {
01067 /* CASA prefers to have these not set if the extension actually does not exist
01068     cpl_propertylist_append_string(plist,"QUALDATA",qualdata) ;
01069     cpl_propertylist_set_comment(plist,"QUALDATA","name of qual extension") ;
01070 */
01071   }
01072 
01073   return cpl_error_get_code();
01074 }
01075 

Generated on 3 Mar 2013 for SINFONI Pipeline Reference Manual by  doxygen 1.6.1