psf_ini_by_cpl.c

00001 /*----------------------------------------------------------------------------
00002    
00003    File name    :   psf_ini_by_cpl.c
00004    Author       :   Andrea Modigliani
00005    Created on   :   May 20, 2004
00006    Description  :   cpl input for psf step for SPIFFI
00007 
00008 
00009  ---------------------------------------------------------------------------*/
00010 
00011 
00012 
00013 /*---------------------------------------------------------------------------
00014                                 Includes
00015  ---------------------------------------------------------------------------*/
00016 
00017 #include "psf_ini_by_cpl.h"
00018 
00019 
00020 /*---------------------------------------------------------------------------
00021                     Functions private to this module
00022  ---------------------------------------------------------------------------*/
00023 static void      parse_section_frames(psf_config *, 
00024                    cpl_frameset* sof,cpl_frameset** stk,int* status);
00025 static void     parse_section_reconstruction(psf_config *);
00026 
00027 /* removed generatePsfFile() */
00028 
00029 
00030 /*-------------------------------------------------------------------------*/
00041 /*--------------------------------------------------------------------------*/
00042 
00043 psf_config * parse_cpl_input_psf(cpl_parameterlist * cpl_cfg, cpl_frameset* sof, 
00044                  cpl_frameset** stk)
00045 {
00046   const char* _id = "parse_cpl_input_psf";
00047         psf_config  *       cfg =NULL;
00048         int status=0;
00049         /*
00050          * Perform sanity checks, fill up the structure with what was
00051          * found in the ini file
00052          */
00053 
00054         cfg = psf_cfg_create();
00055         parse_section_reconstruction   (cfg);
00056          parse_section_frames       (cfg, sof,stk,&status);
00057         if (status > 0) {
00058                 cpl_msg_error(_id,"parsing cpl input");
00059                 psf_cfg_destroy(cfg);
00060                 cfg = NULL ;
00061                 return NULL ;
00062         }
00063         return cfg ;
00064 }
00065 
00066 static void
00067 parse_section_frames(psf_config * cfg, 
00068              cpl_frameset* sof,
00069                      cpl_frameset** stk,
00070                      int* status)
00071 {
00072   const char* _id = "parse_section_frames";
00073    cpl_frame* frame   = NULL;
00074 
00075    int                 npsf=0;
00076    int nraw=0;
00077    char spat_res[FILE_NAME_SZ];
00078    char lamp_status[FILE_NAME_SZ];
00079    char band[FILE_NAME_SZ];
00080    int ins_set=0;
00081 
00082   
00083   sinfoni_contains_frames_type(sof,stk,PRO_PSF_CALIBRATOR_STACKED);
00084    npsf = cpl_frameset_get_size(*stk);
00085 
00086      if (npsf < 1) {
00087          cpl_msg_error(_id,"Cannot find input stacked frames") ;
00088          (*status)++;
00089          return;
00090      }
00091 
00092 
00093     if(NULL != cpl_frameset_find(sof,PRO_COADD_PSF)) {
00094       frame = cpl_frameset_find(sof,PRO_COADD_PSF);
00095       strcpy(cfg -> inFrame,cpl_frame_get_filename(frame));
00096     } else if(NULL != cpl_frameset_find(sof,PRO_OBS_PSF)) {
00097       frame = cpl_frameset_find(sof,PRO_OBS_PSF);
00098       strcpy(cfg -> inFrame,cpl_frame_get_filename(frame));
00099     } else {
00100       cpl_msg_error(_id,"Frame %s  of %s not found!", PRO_COADD_PSF, PRO_OBS_PSF);
00101       (*status)++;
00102       return;
00103     }
00104 
00105    strcpy(cfg -> outName, PSF_OUT_FILENAME);
00106    nraw    = cpl_frameset_get_size(*stk);
00107    frame = cpl_frameset_get_frame(*stk,0);
00108 
00109    sinfoni_get_spatial_res(frame,spat_res);
00110    switch(sinfoni_frame_is_on(frame))
00111      {
00112 
00113     case 0: 
00114       strcpy(lamp_status,"on");
00115       break;
00116     case 1: 
00117       strcpy(lamp_status,"off");
00118       break;
00119     case -1:
00120       strcpy(lamp_status,"undefined");
00121       break;
00122     default: 
00123       strcpy(lamp_status,"undefined");
00124       break;
00125 
00126      }
00127    sinfoni_get_band(frame,band);
00128    cpl_msg_info(_id,"spatial resolution: %s lamp status: %s band: %s \n",
00129                      spat_res,    lamp_status,    band);
00130 
00131    sinfoni_get_ins_set(band,&ins_set);
00132 
00133    return;
00134 
00135 }
00136 
00137 static void     
00138 parse_section_reconstruction(psf_config * cfg)
00139 {
00140    cfg -> nslits = NSLITLETS;
00141    return;
00142 }
00143 
00144 void
00145 free_psf(psf_config * cfg) {
00146    psf_cfg_destroy (cfg);
00147   return;
00148 }

Generated on Wed Oct 26 13:08:54 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001