/*---------------------------------------------------------------------------- File name : strehl.c Author : N. Devillard Created on : July 2001 Description : CONICA strehl ratio computation ---------------------------------------------------------------------------*/ /* $Id: strehl.c,v 1.7 2002/01/30 04:21:01 yjung Exp $ $Author: yjung $ $Date: 2002/01/30 04:21:01 $ $Revision: 1.7 $ */ /*---------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include #include #include #include "eclipse.h" #include "conicap_lib.h" /*---------------------------------------------------------------------------- Defines ---------------------------------------------------------------------------*/ #define STREHL_VLT_M1 8.0 /*#define STREHL_VLT_M2 1.1*/ #define STREHL_IMAGE_SIZE 64 #define STREHL_VLT_M2 0.0 /*---------------------------------------------------------------------------- Private functions ---------------------------------------------------------------------------*/ static int conica_strehl_engine( char * name_i, conica_filter_id f_id, double * bg_data, char * backg ); /*---------------------------------------------------------------------------- Main code ---------------------------------------------------------------------------*/ int conica_strehl_main(void * dict) { dictionary * d ; char * name_i ; int errors ; int i ; int nfiles ; char argname[10]; char * sval ; conica_filter_id f_id ; double bg_data[2] ; double * bg_ptr ; char * backg ; d = (dictionary*)dict ; backg = dictionary_get(d, "arg.back"); /* Get input/output file names */ nfiles = dictionary_getint(d, "arg.n", -1) ; if (nfiles<0) { e_error("missing input file name(s): aborting"); return -1 ; } /* Get reference filter ID if any */ f_id = conica_filter_invalid ; sval = dictionary_get(d, "arg.filter"); if (sval!=NULL) { f_id = conica_get_filterid(sval); if (f_id==conica_filter_invalid) { e_error("unknown filter ID: %s", sval); conica_filters_dump(stderr); return -1 ; } } /* Get background value if provided */ sval = dictionary_get(d, "arg.background"); if (sval!=NULL) { if (sscanf(sval, "%lg %lg", &bg_data[0], &bg_data[1])!=2) { e_error("expecting 2 values for -b/--background"); return -1 ; } bg_ptr = bg_data ; } else { bg_ptr = NULL ; } /* Loop on input file names */ errors = 0 ; for (i=1 ; inp ; i++) { input = image_sub(in->plane[i], backgr) ; image_save_fits(input, "diff.fits", BPP_DEFAULT) ; image_compute_strehl(input, &spar); printf("plane %d strehl %4.2f err=%g (%4.2f %4.2f) bg %g\n", i+1, spar.strehl, spar.strehl_err, spar.strehl - spar.strehl * spar.strehl_err, spar.strehl + spar.strehl * spar.strehl_err, spar.star_bg); image_del(input) ; } image_del(backgr) ; cube_del(in); return 0 ; }