fors_zeropoint-test.c

00001 /* $Id: fors_zeropoint-test.c,v 1.16 2009/02/02 10:04:08 hlorch Exp $
00002  *
00003  * This file is part of the FORS Library
00004  * Copyright (C) 2002-2006 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  */
00020 
00021 /*
00022  * $Author: hlorch $
00023  * $Date: 2009/02/02 10:04:08 $
00024  * $Revision: 1.16 $
00025  * $Name: fors-4_8_6 $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 #include <fors_zeropoint_impl.h>
00033 #include <fors_dfs.h>
00034 #include <fors_utils.h>
00035 
00036 #include <test_simulate.h>
00037 #include <test.h>
00038 
00046 #undef cleanup
00047 #define cleanup \
00048 do { \
00049     cpl_frameset_delete(frames); \
00050     cpl_parameterlist_delete(parameters); \
00051 } while(0)
00052 
00056 static void
00057 test_zeropoint(void)
00058 {
00059     /* Input */
00060     cpl_frameset      *frames     = cpl_frameset_new();
00061     cpl_parameterlist *parameters = cpl_parameterlist_new();
00062     double exptime = 1.0;
00063     /* Products */
00064     
00065     /* Simulate data */
00066     cpl_frameset_insert(frames, create_standard("zeropoint_standard_img.fits",
00067                                                 STANDARD_IMG,
00068                                                 CPL_FRAME_GROUP_RAW));
00069     cpl_frameset_insert(frames, create_bias("zeropoint_master_bias.fits",
00070                                             MASTER_BIAS,
00071                                             CPL_FRAME_GROUP_CALIB));
00072     cpl_frameset_insert(frames, create_sky_flat("zeropoint_master_sky_flat.fits",
00073                                                 MASTER_SKY_FLAT_IMG,
00074                                                 CPL_FRAME_GROUP_CALIB, exptime));
00075     cpl_frameset_insert(frames, create_std_cat("zeropoint_std_cat.fits",
00076                                                FLX_STD_IMG,
00077                                                CPL_FRAME_GROUP_CALIB));
00078     cpl_frameset_insert(frames, create_phot_table("zeropoint_phot_table.fits",
00079                                                   PHOT_TABLE,
00080                                                   CPL_FRAME_GROUP_CALIB));
00081     
00082     /* Set parameters */
00083     fors_zeropoint_define_parameters(parameters);
00084     assure( !cpl_error_get_code(), return, 
00085             "Create parameters failed");
00086     
00087     fors_parameterlist_set_defaults(parameters);
00088  
00089     /* Do not rely on SExtractor for this unit test */
00090     cpl_parameter_set_string(cpl_parameterlist_find(parameters,
00091                                                     "fors.fors_zeropoint.extract_method"),
00092                              "test");
00093 
00094     /* Note: the extracted source positions do not match the catalogue,
00095        but the recipe will find a solution anyway by increasing the
00096        search radius. Suppress warnings */
00097     cpl_msg_severity before = cpl_msg_get_level();
00098     cpl_msg_set_level(CPL_MSG_ERROR);
00099 
00100     fors_zeropoint(frames, parameters);
00101 
00102     cpl_msg_set_level(before);
00103 
00104 
00105 
00106     /* Test existence of QC + products */
00107     const char *const product_tags[] = {SOURCES_STD, 
00108                                         ALIGNED_PHOT, 
00109                                         STANDARD_REDUCED_IMG, 
00110                                         PHOT_BACKGROUND_STD_IMG};
00111     const char *const qc[] = 
00112         {"QC ZPOINT", "QC ZPOINTRMS", "QC ZPOINT NSTARS",
00113          "QC EXTCOEFF"};
00114     const char *main_product = ALIGNED_PHOT;
00115 
00116     test_recipe_output(frames, 
00117                        product_tags, sizeof product_tags / sizeof *product_tags,
00118                main_product,
00119                        qc, sizeof qc / sizeof *qc);
00120         
00121     cleanup;
00122     return;
00123 }
00124 
00125 
00129 int main(void)
00130 {
00131     TEST_INIT;
00132 
00133     /* cpl_msg_set_level(CPL_MSG_DEBUG); */
00134     test_zeropoint();
00135 
00136     TEST_END;
00137 }
00138 

Generated on Fri Mar 4 09:46:01 2011 for FORS Pipeline Reference Manual by  doxygen 1.4.7