66#define MODULE_ID "XSH_EXTRACT_CLEAN"
75 {
"debug", required_argument, 0,
DEBUG_OPT},
82 puts(
"Unitary test of xsh_extract_clean");
83 puts(
"Usage: test_xsh_extract_clean [options] <input_files>");
86 puts(
" --decode-bp=<n> : Integer representation of the bits to be considered bad when decoding the bad pixel mask pixel values.");
87 puts(
" --method=<n> : method for extraction CLEAN | LOCALIZATION | FULL | NOD");
88 puts(
" --debug=<n> : Level of debug LOW | MEDIUM | HIGH [MEDIUM]" );
89 puts(
" --help : What you see" ) ;
90 puts(
"\nInput Files" ) ;
91 puts(
"The input files argument MUST be in this order:" ) ;
92 puts(
" 1. Rectified frame 2D" ) ;
93 puts(
" 2. Localization table");
102 int option_index = 0;
104 while (( opt = getopt_long (argc, argv,
"slit_position:slit_height:method",
122 xsh_msg(
"WRONG method %s", optarg);
127 if ( strcmp( optarg,
"LOW")==0){
130 else if ( strcmp( optarg,
"HIGH")==0){
135 *decode_bp=atoi(optarg);
158 const char* rec_name = NULL;
164 check( rec_name = cpl_frame_get_filename( rec_frame));
166 printf(
"RECTIFY frame : %s\n", rec_name);
169 for(iorder=0; iorder< rec_list->
size; iorder++){
170 int order = 0, ilambda = 0;
174 double *lambda = NULL;
176 FILE* datfile = NULL;
184 sprintf( name,
"extract_order%d.dat",
order);
186 datfile = fopen( name,
"w");
188 for(ilambda=0; ilambda < nlambda; ilambda++){
189 fprintf( datfile,
"%f %f\n",lambda[ilambda],flux[ilambda]);
193 sprintf( name,
"extract_err_order%d.dat",
order);
195 datfile = fopen( name,
"w");
197 for(ilambda=0; ilambda < nlambda; ilambda++){
198 fprintf( datfile,
"%f %f\n",lambda[ilambda],err[ilambda]);
214int main(
int argc,
char **argv)
220 cpl_propertylist *header= NULL;
221 const char *tag = NULL;
222 cpl_frame* result = NULL;
223 cpl_frame* result_eso = NULL;
225 char* rec_name = NULL;
226 cpl_frame* rec_frame = NULL;
227 char* loc_name = NULL;
228 cpl_frame* loc_frame = NULL;
236 cpl_msg_set_level(CPL_MSG_DEBUG);
242 xsh_msg(
"argc=%d optind=%d",argc,optind);
243 if ( (argc - optind) > 0 ) {
244 rec_name = argv[optind];
245 if ( (argc - optind) > 1){
246 loc_name = argv[optind+1];
252 rec_frame = cpl_frame_new();
254 cpl_frame_set_filename( rec_frame, rec_name) ;
256 check( header = cpl_propertylist_load( rec_name, 0));
260 cpl_frame_set_level( rec_frame, CPL_FRAME_LEVEL_TEMPORARY);
261 cpl_frame_set_group( rec_frame, CPL_FRAME_GROUP_RAW ) ;
262 cpl_frame_set_tag( rec_frame, tag);
273 if ( loc_name != NULL){
274 loc_frame = cpl_frame_new();
275 cpl_frame_set_filename( loc_frame, loc_name);
276 cpl_frame_set_level( rec_frame, CPL_FRAME_LEVEL_TEMPORARY);
277 cpl_frame_set_group( rec_frame, CPL_FRAME_GROUP_RAW );
281 xsh_msg(
"Rectified frame : %s", rec_name);
282 if (loc_name != NULL){
283 xsh_msg(
"Localization table : %s", loc_name);
287 &extract_obj,&ipol_bp_par,&result_eso,
302 if (cpl_error_get_code() != CPL_ERROR_NONE) {
int main()
Unit test of xsh_bspline_interpol.
static xsh_instrument * instrument
double * xsh_rec_list_get_lambda(xsh_rec_list *list, int idx)
xsh_rec_list * xsh_rec_list_load(cpl_frame *frame, xsh_instrument *instrument)
load an rec list from a frame
float * xsh_rec_list_get_data1(xsh_rec_list *list, int idx)
float * xsh_rec_list_get_errs1(xsh_rec_list *list, int idx)
int xsh_rec_list_get_order(xsh_rec_list *list, int idx)
int xsh_rec_list_get_nlambda(xsh_rec_list *list, int idx)
void xsh_rec_list_free(xsh_rec_list **list)
free memory associated to a rec_list
#define xsh_error_dump(level)
#define XSH_ASSURE_NOT_NULL(pointer)
void xsh_instrument_set_mode(xsh_instrument *i, XSH_MODE mode)
Set a mode on instrument structure.
void xsh_instrument_set_arm(xsh_instrument *i, XSH_ARM arm)
Set an arm on instrument structure.
void xsh_instrument_set_lamp(xsh_instrument *i, XSH_LAMP lamp)
Set a lamp on instrument structure.
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
xsh_instrument * xsh_instrument_new(void)
create new instrument structure
void xsh_instrument_set_decode_bp(xsh_instrument *i, const int decode_bp)
Set bad pixel code.
#define xsh_msg(...)
Print a message on info level.
XSH_ARM xsh_pfits_get_arm(const cpl_propertylist *plist)
const char * xsh_pfits_get_pcatg(const cpl_propertylist *plist)
find out the pcatg
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
int xsh_debug_level_set(int level)
set debug level
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
#define TESTS_INIT(DRL_ID)
#define DECODE_BP_FLAG_DEF
#define EXTRACT_METHOD_PRINT(method)