00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifdef HAVE_CONFIG_H
00027 # include <config.h>
00028 #endif
00029
00030
00035
00038
00039
00040
00041
00042 #include <tests.h>
00043 #include <xsh_data_pre.h>
00044 #include <xsh_error.h>
00045 #include <xsh_msg.h>
00046 #include <xsh_data_instrument.h>
00047 #include <xsh_data_rec.h>
00048 #include <xsh_data_localization.h>
00049 #include <xsh_drl.h>
00050 #include <xsh_pfits.h>
00051 #include <xsh_data_pre_3d.h>
00052 #include <xsh_badpixelmap.h>
00053
00054 #include <cpl.h>
00055 #include <math.h>
00056
00057 #include <getopt.h>
00058
00059
00060
00061
00062
00063 #define MODULE_ID "XSH_FORMAT"
00064
00065 enum {
00066 OVERSAMPLE_OPT, BOX_HSIZE_OPT, CHUNK_SIZE_OPT, LAMBDA_STEP_OPT,
00067 KAPPA_OPT, METHOD_OPT, MIN_ORDER_OPT, MAX_ORDER_OPT, HELP_OPT
00068 };
00069
00070 static struct option long_options[] = {
00071 {"oversample", required_argument, 0, OVERSAMPLE_OPT},
00072 {"box-hsize", required_argument, 0, BOX_HSIZE_OPT},
00073 {"chunk-size", required_argument, 0, CHUNK_SIZE_OPT},
00074 {"lambda-step", required_argument, 0, LAMBDA_STEP_OPT},
00075 {"kappa", required_argument, 0, KAPPA_OPT},
00076 {"method", required_argument, 0, METHOD_OPT},
00077 {"order-min", required_argument, 0, MIN_ORDER_OPT},
00078 {"order-max", required_argument, 0, MAX_ORDER_OPT},
00079 {"help", 0, 0, HELP_OPT},
00080 {0, 0, 0, 0}
00081 };
00082
00083 static void Help( void )
00084 {
00085 puts( "Unitary test of a cube build");
00086 puts( "Usage: test_format [options] <input_files>");
00087
00088 puts( "Options" ) ;
00089 puts( "\nInput Files" ) ;
00090 puts( "The input files argument MUST be in this order:" ) ;
00091 puts( " 1. ORDER2D_DOWN, ORDER2D_CEN, ORDER2D_UP" ) ;
00092 TEST_END();
00093 }
00094
00095
00096
00097
00098
00106 int main( int argc, char **argv)
00107 {
00108 int ret;
00109
00110 xsh_instrument* instrument = NULL;
00111 const char *sof_name = NULL;
00112 cpl_frameset *set = NULL;
00113 cpl_frame *cube = NULL;
00114
00115
00116 TESTS_INIT( MODULE_ID);
00117 cpl_msg_set_level( CPL_MSG_DEBUG);
00118 xsh_debug_level_set( XSH_DEBUG_LEVEL_MEDIUM);
00119
00120
00121 if (argc >= 2 ) {
00122 sof_name = argv[1];
00123 }
00124 else{
00125 Help();
00126 exit(0);
00127 }
00128
00129
00130 check( set = sof_to_frameset( sof_name));
00131 check( instrument = xsh_dfs_set_groups( set));
00132
00133 check( cube = xsh_format( set, "CUBE.fits", instrument,"test"));
00134
00135
00136
00137 cleanup:
00138 if (cpl_error_get_code() != CPL_ERROR_NONE) {
00139 xsh_error_dump(CPL_MSG_ERROR);
00140 ret = 1;
00141 }
00142 xsh_free_frameset( &set);
00143 xsh_instrument_free( &instrument);
00144 xsh_free_frame( &cube);
00145
00146 TEST_END();
00147 return ret;
00148 }
00149