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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 #ifndef TESTS_H
00092 #define TESTS_H
00093
00094 #include <cpl.h>
00095 #include <xsh_drl.h>
00096 #include <stdbool.h>
00097 #include <xsh_data_order.h>
00098 #include <config.h>
00099
00100 #define TESTS_INIT(DRL_ID) do { \
00101 cpl_init(CPL_INIT_DEFAULT); \
00102 xsh_init(); \
00103 cpl_msg_set_domain("Test-" DRL_ID); \
00104 } while(false)
00105
00106 #define TEST_END()\
00107 xsh_free_temporary_files(); \
00108 cpl_end()
00109
00110 #define TESTS_XSH_INSTRUMENT_CREATE(instr, mode, arm, lamp, recipe)\
00111 instr = xsh_instrument_new() ;\
00112 xsh_instrument_set_mode( instr, mode) ;\
00113 xsh_instrument_set_arm( instr, arm) ;\
00114 xsh_instrument_set_lamp( instr, lamp) ;\
00115 xsh_instrument_set_recipe_id( instr, recipe) ;\
00116 xsh_msg( " recipe_id: %s", instr->recipe_id )
00117
00118 #define TESTS_XSH_FRAME_CREATE( frame, tag, name)\
00119 frame = cpl_frame_new();\
00120 cpl_frame_set_filename( frame, name);\
00121 cpl_frame_set_level( frame, CPL_FRAME_LEVEL_TEMPORARY);\
00122 cpl_frame_set_group( frame, CPL_FRAME_GROUP_RAW);\
00123 cpl_frame_set_tag( frame, tag)
00124
00125
00126 #define TESTS_DATA(file) XSH_TEST_DATA_PATH "/" file
00127
00128
00129
00130 #define XSH_DRL_FUNC_RMS 0.01
00131 #define XSH_FLOAT_PRECISION 0.000001
00132
00133 void
00134 tests_set_defaults(cpl_parameterlist *parlist);
00135
00136 cpl_image* xsh_test_create_bias_image(const char* name, int nx, int ny,
00137 xsh_instrument* instrument);
00138
00139 cpl_propertylist * mkHeader( XSH_INSTRCONFIG *iconfig,
00140 int nx, int ny, double exptime ) ;
00141 void setHeader( cpl_propertylist *header,
00142 XSH_INSTRCONFIG *iconfig,
00143 int nx, int ny, double exptime ) ;
00144 cpl_frame* xsh_test_create_frame( const char* name,int nx, int ny,
00145 const char* tag, cpl_frame_group group, xsh_instrument* instrument);
00146 void add_to_order_list( xsh_order_list * list, int order,
00147 int absorder,
00148 cpl_polynomial *poly, int xdelta,
00149 int starty, int endy ) ;
00150 xsh_order_list * create_order_list( int norder, xsh_instrument* instrument ) ;
00151
00152 cpl_image * create_order_image( xsh_order_list* list,
00153 int nx, int ny ) ;
00154
00155 cpl_frame * create_rectify_nod_list( int dual, const char * fname,
00156 xsh_instrument * instr ) ;
00157
00158 cpl_frameset* sof_to_frameset( const char* sof_name);
00159
00160 #endif