X-shooter Pipeline Reference Manual 3.8.15
tests.c
Go to the documentation of this file.
1/* *
2 * This file is part of the ESO X-shooter Pipeline *
3 * Copyright (C) 2006 European Southern Observatory *
4 * *
5 * This library is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20/*
21 * $Author: amodigli $
22 * $Date: 2012-01-16 21:09:42 $
23 * $Revision: 1.14 $
24 * $Name: not supported by cvs2svn $
25 */
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30/*--------------------------------------------------------------------------*/
38/*--------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------
42 Includes
43 ---------------------------------------------------------------------------*/
44
45#include <xsh_data_pre.h>
46#include <xsh_error.h>
47#include <xsh_msg.h>
48#include <xsh_data_instrument.h>
49#include <xsh_drl.h>
50#include <xsh_pfits.h>
51#include <xsh_badpixelmap.h>
52#include <cpl.h>
53#include <stdbool.h>
54#include <xsh_data_order.h>
55#include <xsh_utils.h>
56#include <xsh_pfits.h>
57#include <string.h>
58#include <tests.h>
59#include <xsh_cpl_size.h>
60
61/*---------------------------------------------------------------------------
62 Defines
63 ---------------------------------------------------------------------------*/
64/*----------------------------------------------------------------------------*/
71/*----------------------------------------------------------------------------*/
72static int xsh_poisson_random(double expectedValue) {
73 int n = 0; //counter of iteration
74 double limit;
75 double x; //pseudo random number
76 limit = exp(-expectedValue);
77 x = (double)rand() / (double)INT_MAX;
78 while (x > limit) {
79 n++;
80 x *= (double)rand() / (double)INT_MAX;
81 }
82 return n;
83 }
84
85
86/*---------------------------------------------------------------------------
87 Functions implementation
88 ---------------------------------------------------------------------------*/
89cpl_image* xsh_test_create_bias_image( const char* name, int nx, int ny,
91{
92 cpl_image* res = NULL;
93 cpl_propertylist* header = NULL;
94 XSH_INSTRCONFIG * config = NULL;
95 double ron = 0.0;
96 double conad = 0.0;
97 double ron_adu = 0.0;
98 double medval = 85.0;
99
100 xsh_msg("config update %d", instrument->update);
102 ron = config->ron;
103 conad = config->conad;
104 ron_adu = ron / conad;
105 res = cpl_image_new( nx, ny, XSH_PRE_DATA_TYPE) ;
106
107 header = cpl_propertylist_new();
108 setHeader(header, config, nx, ny, 1. );
109 /* the parameters depends of the RON/CONAD KW for produce BIAS frame
110 dispersion around (Bgmin+Bgmax)/2 */
111 cpl_image_fill_noise_uniform ( res, medval-ron_adu, medval+ron_adu);
112 cpl_image_save( res, name, XSH_PRE_DATA_BPP, header, CPL_IO_DEFAULT);
113
114 xsh_free_propertylist(&header);
115 return res;
116
117}
118
119cpl_frame* xsh_test_create_frame(const char* name,int nx, int ny,
120 const char* tag, cpl_frame_group group, xsh_instrument* instrument)
121{
122
123 XSH_INSTRCONFIG *iconfig = NULL ;
124 cpl_propertylist *header = NULL;
125 cpl_image *data = NULL;
126 cpl_frame *frame = NULL;
127 float* pdata=NULL;
128 int size=nx*ny;
129 int i,j;
131 XSH_ASSURE_NOT_NULL( name);
132
134
135 header = cpl_propertylist_new();
136 setHeader(header, iconfig, nx, ny, 1.);
137
138 data = cpl_image_new(nx,ny,XSH_PRE_DATA_TYPE);
139 cpl_image_fill_gaussian(data,
140 nx / 3.0, ny / 3.0, /* center */
141 50, /* norm */
142 nx, ny / 8.0); /* sigma */
143
144 /* add random noise, centered at 100 */
145 pdata=cpl_image_get_data_float(data);
146 for(j=0;j<size;j++) {
147 pdata[j]+=xsh_poisson_random(100.);
148 }
149 check( cpl_image_save(data, name, XSH_PRE_DATA_BPP,header,
150 CPL_IO_DEFAULT));
151
152 /* Create test frame */
153 frame = cpl_frame_new();
154 cpl_frame_set_filename(frame,name);
155 cpl_frame_set_group(frame,group);
156 cpl_frame_set_tag(frame,tag);
157
158 cleanup:
159 xsh_free_propertylist(&header);
161 return frame;
162}
163/*--------------------------------------------------------------------------*/
172/*--------------------------------------------------------------------------*/
173void tests_set_defaults(cpl_parameterlist * parlist)
174{
175 cpl_parameter *p = NULL;
176
177 p = cpl_parameterlist_get_first(parlist);
178 while (p != NULL) {
179 bool parameter_is_set = cpl_parameter_get_default_flag(p);
180
181 if (!parameter_is_set) {
182 cpl_type ptype = cpl_parameter_get_type(p);
183 switch (ptype) {
184 case CPL_TYPE_BOOL:
185 cpl_parameter_set_bool(p, cpl_parameter_get_default_bool(p));
186 break;
187 case CPL_TYPE_INT:
188 cpl_parameter_set_int(p, cpl_parameter_get_default_int(p));
189 break;
190 case CPL_TYPE_DOUBLE:
191 cpl_parameter_set_double(p, cpl_parameter_get_default_double(p));
192 break;
193 case CPL_TYPE_STRING:
194 cpl_parameter_set_string(p, cpl_parameter_get_default_string(p));
195 break;
196 default:
197 assure(false, CPL_ERROR_ILLEGAL_INPUT,
198 "Unknown type of parameter '%s'", cpl_parameter_get_name(p));
199 }
200 }
201 p = cpl_parameterlist_get_next(parlist);
202 }
203
204 cleanup:
205 return;
206}
207
221cpl_propertylist * mkHeader( XSH_INSTRCONFIG *iconfig,
222 int nx, int ny, double exptime )
223{
224 cpl_propertylist * header = cpl_propertylist_new() ;
225
226 /* set a minimum of KW */
227 /* Note that NAXIS, NAXIS1 and NAXIS2 are automtically set */
228 check_msg( cpl_propertylist_append_double( header, XSH_CRPIX1, 1. ),
229 "Cant append CRPIX1" ) ;
230 check_msg( cpl_propertylist_append_double( header, XSH_CRPIX2, 1. ),
231 "Cant append CRPIX2" ) ;
232 check_msg( cpl_propertylist_append_double( header, XSH_CRVAL1, 1. ),
233 "Cant append CRVAL1" ) ;
234 check_msg( cpl_propertylist_append_double( header, XSH_CRVAL2, 1. ),
235 "Cant append CRVAL2" ) ;
236
237
238 check_msg( cpl_propertylist_append_int( header, XSH_OUT_NX, nx ),
239 "Cant append NX" ) ;
240 check_msg( cpl_propertylist_append_int( header, XSH_OUT_NY, ny ),
241 "Cant append NY" ) ;
242 check_msg( cpl_propertylist_append_int( header, XSH_OVSCX, iconfig->ovscx ),
243 "Cant append OVSCX" ) ;
244 check_msg( cpl_propertylist_append_int( header, XSH_OVSCY, iconfig->ovscy ),
245 "Cant append OVSCY" ) ;
246 check_msg( cpl_propertylist_append_int( header, XSH_PRSCX, iconfig->prscx ),
247 "Cant append PRSCX" ) ;
248 check_msg( cpl_propertylist_append_int( header, XSH_PRSCY, iconfig->prscy ),
249 "Cant append PRSCY" ) ;
250 check_msg( cpl_propertylist_append_double( header, XSH_RON, iconfig->ron ),
251 "Cant append RON" ) ;
252 check_msg( cpl_propertylist_append_double( header, XSH_CONAD,
253 iconfig->conad ) ,
254 "Cant append CONAD" ) ;
255 check_msg( cpl_propertylist_append_double( header, XSH_PSZX, 15. ),
256 "Cant append PSZX" ) ;
257 check_msg( cpl_propertylist_append_double( header, XSH_PSZY, 15. ),
258 "Cant append PSZY" ) ;
259 check_msg( cpl_propertylist_append_double( header, XSH_EXPTIME, exptime ),
260 "Cant append EXPTIME" ) ;
261 check_msg( cpl_propertylist_append_double( header, XSH_DET_GAIN,2.78 ),
262 "Cant append GAIN" ) ;
263 check_msg( cpl_propertylist_append_int( header, XSH_WIN_BINX,1 ),
264 "Cant append BINX" ) ;
265 check_msg( cpl_propertylist_append_int( header, XSH_WIN_BINY,1 ),
266 "Cant append BINY" ) ;
267 check_msg( cpl_propertylist_append_string( header, XSH_DPR_CATG, "CALIB" ),
268 "Cant append DPR CATG" ) ;
269 check_msg( cpl_propertylist_append_string( header, XSH_DPR_TYPE, "DUMMY" ),
270 "Cant append DPR TYPE" ) ;
271 return header ;
272 cleanup:
273 return NULL ;
274}
275
288void setHeader( cpl_propertylist * header, XSH_INSTRCONFIG *iconfig,
289 int nx, int ny, double exptime)
290{
291
292 XSH_ASSURE_NOT_NULL( header);
293 /* set a minimum of KW */
294 /* Note that NAXIS, NAXIS1 and NAXIS2 are automtically set */
295 check_msg( cpl_propertylist_append_int( header, XSH_OUT_NX, nx ),
296 "Cant append NX" ) ;
297 check_msg( cpl_propertylist_append_int( header, XSH_OUT_NY, ny ),
298 "Cant append NY" ) ;
299 check_msg( cpl_propertylist_append_int( header, XSH_WIN_BINX,1 ),
300 "Cant append BINX" ) ;
301 check_msg( cpl_propertylist_append_int( header, XSH_WIN_BINY,1 ),
302 "Cant append BINY" ) ;
303
304 check_msg( cpl_propertylist_append_int( header, XSH_CHIP_NX, nx ),
305 "Cant append NX" ) ;
306 check_msg( cpl_propertylist_append_int( header, XSH_CHIP_NY, ny ),
307 "Cant append NY" ) ;
308
309 check_msg( cpl_propertylist_append_double( header, XSH_PSZX, 15. ),
310 "Cant append PSZX" ) ;
311 check_msg( cpl_propertylist_append_double( header, XSH_PSZY, 15. ),
312 "Cant append PSZY" ) ;
313 check_msg( cpl_propertylist_append_double( header, XSH_EXPTIME, exptime ),
314 "Cant append EXPTIME" ) ;
315 check_msg( cpl_propertylist_append_double( header, XSH_DET_GAIN,2.78 ),
316 "Cant append GAIN" ) ;
317
318 check_msg( cpl_propertylist_append_int( header, XSH_OVSCX, iconfig->ovscx ),
319 "Cant append OVSCX" ) ;
320 check_msg( cpl_propertylist_append_int( header, XSH_OVSCY, iconfig->ovscy ),
321 "Cant append OVSCY" ) ;
322 check_msg( cpl_propertylist_append_int( header, XSH_PRSCX, iconfig->prscx ),
323 "Cant append PRSCX" ) ;
324 check_msg( cpl_propertylist_append_int( header, XSH_PRSCY, iconfig->prscy ),
325 "Cant append PRSCY" ) ;
326 check_msg( cpl_propertylist_append_double( header, XSH_RON, iconfig->ron ),
327 "Cant append RON" ) ;
328 check_msg( cpl_propertylist_append_double( header, XSH_CONAD,
329 iconfig->conad ) ,
330 "Cant append CONAD" ) ;
331 check_msg( cpl_propertylist_append_string( header, XSH_DPR_CATG, "CALIB" ),
332 "Cant append DPR CATG" ) ;
333 check_msg( cpl_propertylist_append_string( header, XSH_DPR_TYPE, "DUMMY" ),
334 "Cant append DPR TYPE" ) ;
335 /* Special NIR */
336 if ( iconfig->bitpix == 32){
337 check_msg( cpl_propertylist_append_double( header, XSH_DET_PXSPACE,
338 iconfig->pxspace),
339 "Cant append PXSPACE keyword" ) ;
340 }
341
342 cleanup:
343 return;
344}
345
346/*
347 @brief
348 Create an image with a (small) number of arclines.
349 @param list
350 order list
351 @param nx
352 image size in x
353 @param ny
354 image size in y
355
356 Calculer les pixels en fonction des polynomes upper et lower
357 avec une gaussienne de parametres fixes et bien connus.
358
359*/
360
362 int nx, int ny )
363{
364 int i ;
365 double pixmax = 100. ;
366 cpl_image * image = NULL ;
367
368 check( image = cpl_image_new( nx, ny, CPL_TYPE_DOUBLE ) ) ;
369
370 for( i = 0 ; i<list->size ; i++ ) {
371 /* Create line according to polynomial coeff */
372 int ixl, ixu, ixc, iy;
373 cpl_size zero = 0 ;
374 double cxl, cxu ;
375 double pixstep ;
376
377 cxl = cpl_polynomial_get_coeff( list->list[i].edglopoly, &zero ) ;
378 cxu = cpl_polynomial_get_coeff( list->list[i].edguppoly, &zero ) ;
379 pixstep = (2*pixmax)/(cxu-cxl) ;
380
381 //xsh_msg("starty=%d endy=%d",list->list[i].starty,list->list[i].endy);
382
383 for( iy = list->list[i].starty ; iy < list->list[i].endy ;
384 iy++ ) {
385 int k ;
386 double pixval ;
387
388 /* Calculate x = f(y) */
389 ixc = cpl_polynomial_eval_1d( list->list[i].cenpoly,
390 (double)iy, NULL ) ;
391 ixl = cpl_polynomial_eval_1d( list->list[i].edglopoly,
392 (double)iy, NULL ) ;
393 ixu = cpl_polynomial_eval_1d( list->list[i].edguppoly,
394 (double)iy, NULL ) ;
395 /* Set values (gaussian) around x (x-delta to x+delta) */
396 //xsh_msg("ixl=%d ixu=%d",ixl,ixu);
397 for( pixval = 0., k = ixl ; k<ixc ; k++, pixval += pixstep) {
398 cpl_image_set( image, k, iy, pixval ) ;
399 }
400 cpl_image_set( image, ixc+1, iy+1, pixmax ) ;
401 for( pixval = pixval, k = ixc ; k<=ixu ; k++, pixval -= pixstep) {
402 cpl_image_set( image, k, iy, pixval ) ;
403 }
404 }
405 }
406 cleanup:
407 return image ;
408}
409
411{
412 xsh_order_list* result = NULL ;
413
414 XSH_CALLOC(result, xsh_order_list, 1);
415 result->size = norder ;
416 result->instrument = instrument ;
417 XSH_CALLOC( result->list, xsh_order, result->size);
418 XSH_NEW_PROPERTYLIST( result->header );
419
420 cleanup:
421 if (cpl_error_get_code() != CPL_ERROR_NONE) {
422 xsh_order_list_free(&result);
423 }
424 return result;
425
426}
427
428/*
429 Calculer les polynomes upper/lower edge en fonction de delta
430*/
431
433 int absorder,
434 cpl_polynomial *poly, int xdelta,
435 int starty, int endy )
436{
437 cpl_size i = 0 ;
438 double coeff0 ;
439
440 coeff0 = cpl_polynomial_get_coeff( poly, &i ) ;
441
442 list->list[order].order = absorder ;
443 list->list[order].absorder = absorder ;
444 list->list[order].cenpoly = cpl_polynomial_duplicate( poly ) ;
445 list->list[order].edguppoly = cpl_polynomial_duplicate( poly ) ;
446 cpl_polynomial_set_coeff( list->list[order].edguppoly, &i,
447 coeff0 + (double)xdelta ) ;
448 list->list[order].edglopoly = cpl_polynomial_duplicate( poly ) ;
449 cpl_polynomial_set_coeff( list->list[order].edglopoly, &i,
450 coeff0 - (double)xdelta ) ;
451 list->list[order].starty = starty ;
452 list->list[order].endy = endy ;
453}
454
455/* Special creation of rectified frames */
456
457#define NB_LAMBDA 100
458#define FIRST_LAMBDA 500.0
459#define LAST_LAMBDA 510.0
460
461#define NB_SLIT 40
462#define FIRST_SLIT -5
463#define LAST_SLIT 5
464
465#define POS_PLUS 30
466#define COEFF0_PLUS 30.
467#define COEFF1_PLUS 0.03
468#define POS_CENTER 30
469#define POS_MINUS 5
470#define COEFF0_MINUS 10.
471#define COEFF1_MINUS 0.03
472
473#define WIDTH 5
474#define HALF_WIDTH 2
475
476static float Flux[WIDTH] = {
477 20., 40., 100., 40., 20. } ;
478
479static cpl_polynomial * poly_plus = NULL, * poly_minus = NULL ;
480
481cpl_frame * create_rectify_nod_list( int sign, const char * fname,
482 xsh_instrument * instr )
483{
484 xsh_rec_list* result = NULL;
485 int i, j, k, nb, order ;
486 double * plambda ;
487 float * pslit ;
488 double step ;
489 const char * tag = NULL ;
490 cpl_frame * res_frame = NULL ;
491
492 XSH_CALLOC(result, xsh_rec_list, 1 );
493 result->size = instr->config->orders ;
494 XSH_CALLOC(result->list, xsh_rec, result->size);
496
497 for( nb = 0, order = instr->config->order_min ;
498 order <= instr->config->order_max ;
499 order++, nb++ ) {
500 result->list[nb].order = order ;
501 result->list[nb].nlambda = NB_LAMBDA ;
502 result->list[nb].nslit = NB_SLIT ;
503 XSH_CALLOC( result->list[nb].slit, float, NB_SLIT ) ;
504 XSH_CALLOC( result->list[nb].lambda, double, NB_LAMBDA ) ;
505 XSH_CALLOC( result->list[nb].data1, float, NB_LAMBDA*NB_SLIT ) ;
506 XSH_CALLOC( result->list[nb].errs1, float, NB_LAMBDA*NB_SLIT ) ;
507 XSH_CALLOC( result->list[nb].qual1, int, NB_LAMBDA*NB_SLIT ) ;
508
509 xsh_msg_dbg_high( "Fill lambda" ) ;
510 // Now fill slits, lambda and data1
511 plambda = result->list[nb].lambda ;
512 step = (double)(LAST_LAMBDA-FIRST_LAMBDA)/(double)NB_LAMBDA ;
513 for ( i = 0 ; i<NB_LAMBDA ; i++, plambda++ )
514 *plambda = FIRST_LAMBDA + i*step ;
515
516 pslit = result->list[nb].slit ;
517 step = (double)(LAST_SLIT-FIRST_SLIT)/(double)NB_SLIT ;
518 xsh_msg_dbg_high( "Fill slit (%lf)", step ) ;
519 for ( i = 0 ; i<NB_SLIT ; i++, pslit++ )
520 *pslit = FIRST_SLIT + i*step ;
521 /* Create the 2 polynomials */
522 check( poly_plus = cpl_polynomial_new( 1 ) ) ;
523 check( poly_minus = cpl_polynomial_new( 1 ) ) ;
524 /* Set the coeff */
525 {
526 cpl_size kc ;
527 /* PLUS */
528 kc = 0 ;
529 cpl_polynomial_set_coeff( poly_plus, &kc, COEFF0_PLUS ) ;
530 kc = 1 ;
531 cpl_polynomial_set_coeff( poly_plus, &kc, COEFF1_PLUS ) ;
532 /* Minus */
533 kc = 0 ;
534 cpl_polynomial_set_coeff( poly_minus, &kc, COEFF0_MINUS ) ;
535 kc = 1 ;
536 cpl_polynomial_set_coeff( poly_minus, &kc, COEFF1_MINUS ) ;
537 }
538
539 plambda = result->list[nb].lambda ;
540 for( j = 0 ; j<NB_LAMBDA ; j++, plambda++ ) {
541 float datump, datumm ;
542 int ns ;
543
544 check( datump = cpl_polynomial_eval_1d( poly_plus, (double)j, NULL ) ) ;
545 check( datumm = cpl_polynomial_eval_1d( poly_minus, (double)j, NULL ) ) ;
546
547 for ( k = 0, ns = (int)datump - HALF_WIDTH ; k<WIDTH ; k++, ns++ ) {
548 float val ;
549 if ( sign > 0 ) val = Flux[k] ;
550 else val = -Flux[k] ;
551 result->list[nb].data1[j + (int)ns*NB_LAMBDA] = val ;
552 }
553 for ( k = 0, ns = (int)datumm - HALF_WIDTH ; k<WIDTH ; k++, ns++ ) {
554 float val ;
555 if ( sign > 0 ) val = -Flux[k] ;
556 else val = Flux[k] ;
557 result->list[nb].data1[j + (int)ns*NB_LAMBDA] = val ;
558 }
559 }
560 }
561 result->instrument = instr;
562
563 xsh_msg_dbg_high( "Save frame" ) ;
564 res_frame = xsh_rec_list_save( result, fname, "TAG", 1 ) ;
565 tag = XSH_GET_TAG_FROM_ARM( XSH_ORDER2D,instr);
566 check(cpl_frame_set_tag(res_frame, tag )) ;
567
568 cleanup:
569 if (cpl_error_get_code() != CPL_ERROR_NONE) {
570 xsh_rec_list_free(&result);
571 }
572 return res_frame;
573}
574
575
576cpl_frameset * sof_to_frameset( const char* sof_name)
577{
578 FILE *sof_file = NULL;
579 cpl_frameset *result = NULL;
580 char sof_line[200];
581
582 XSH_ASSURE_NOT_NULL( sof_name);
583
584 check( result = cpl_frameset_new());
585
586 sof_file = fopen( sof_name, "r");
587
588 if (sof_file != NULL){
589
590 while ( fgets( sof_line, 200, sof_file)){
591 char name[200];
592 char tag[200];
593 cpl_frame *frame = NULL;
594
595 if ( sof_line[0] == '#'){
596 xsh_msg("skip line %s", sof_line);
597 }
598 else{
599 /* Note: update the string format (the %__s) if name(tag) changes size.
600 * Remember: field width must equal 1 less than sizeof(name(tag)). */
601 sscanf( sof_line, "%199s %199s", name, tag);
602 check( frame = cpl_frame_new());
603 check( cpl_frame_set_filename( frame, name));
604 check( cpl_frame_set_tag( frame, tag));
605 check( cpl_frameset_insert( result, frame));
606 }
607 }
608 fclose( sof_file);
609 }
610 else{
611 xsh_msg("File %s not found", sof_name);
612 XSH_ASSURE_NOT_NULL( sof_file);
613 }
614
615 cleanup:
616 if (cpl_error_get_code() != CPL_ERROR_NONE) {
617 xsh_free_frameset( &result);
618 }
619 return result;
620}
621
622xsh_instrument * create_instrument( const char *filename)
623{
624 xsh_instrument *instr = NULL;
625 cpl_propertylist *header = NULL;
626 const char *catg = NULL;
627
628 check( header = cpl_propertylist_load( filename, 0));
629 check( catg = xsh_pfits_get_pcatg( header));
630
631 check( instr = xsh_instrument_new());
632
633 if (strstr( catg, "UVB") != NULL){
635 }
636 else {
637 if (strstr( catg, "VIS") != NULL){
639 }
640 else{
641 if (strstr( catg, "NIR") != NULL){
643 }
644 }
645 }
646
647 cleanup:
648 xsh_free_propertylist( &header);
649 return instr;
650}
static double exptime
static int starty
static int endy
static int norder
static const double step
static xsh_instrument * instrument
xsh_order_list * create_order_list(int norder, xsh_instrument *instrument)
Definition: tests.c:410
#define WIDTH
Definition: tests.c:473
static int xsh_poisson_random(double expectedValue)
generates random data with Poisson distribution
Definition: tests.c:72
#define COEFF0_PLUS
Definition: tests.c:466
#define FIRST_LAMBDA
Definition: tests.c:458
static cpl_polynomial * poly_minus
Definition: tests.c:479
#define LAST_LAMBDA
Definition: tests.c:459
void add_to_order_list(xsh_order_list *list, int order, int absorder, cpl_polynomial *poly, int xdelta, int starty, int endy)
Definition: tests.c:432
#define LAST_SLIT
Definition: tests.c:463
#define COEFF1_PLUS
Definition: tests.c:467
cpl_image * xsh_test_create_bias_image(const char *name, int nx, int ny, xsh_instrument *instrument)
Definition: tests.c:89
cpl_image * create_order_image(xsh_order_list *list, int nx, int ny)
Definition: tests.c:361
cpl_frameset * sof_to_frameset(const char *sof_name)
Definition: tests.c:576
cpl_propertylist * mkHeader(XSH_INSTRCONFIG *iconfig, int nx, int ny, double exptime)
Definition: tests.c:221
#define COEFF1_MINUS
Definition: tests.c:471
static cpl_polynomial * poly_plus
Definition: tests.c:479
#define FIRST_SLIT
Definition: tests.c:462
#define HALF_WIDTH
Definition: tests.c:474
xsh_instrument * create_instrument(const char *filename)
Definition: tests.c:622
void setHeader(cpl_propertylist *header, XSH_INSTRCONFIG *iconfig, int nx, int ny, double exptime)
Definition: tests.c:288
void tests_set_defaults(cpl_parameterlist *parlist)
Set unset parameters to default value.
Definition: tests.c:173
#define NB_SLIT
Definition: tests.c:461
#define COEFF0_MINUS
Definition: tests.c:470
static float Flux[WIDTH]
Definition: tests.c:476
cpl_frame * xsh_test_create_frame(const char *name, int nx, int ny, const char *tag, cpl_frame_group group, xsh_instrument *instrument)
Definition: tests.c:119
cpl_frame * create_rectify_nod_list(int sign, const char *fname, xsh_instrument *instr)
Definition: tests.c:481
#define NB_LAMBDA
Definition: tests.c:457
void xsh_order_list_free(xsh_order_list **list)
free memory associated to an order_list
cpl_frame * xsh_rec_list_save(xsh_rec_list *list, const char *filename, const char *tag, int is_temp)
Save a rec list in a frame.
void xsh_rec_list_free(xsh_rec_list **list)
free memory associated to a rec_list
Definition: xsh_data_rec.c:760
#define assure(CONDITION, ERROR_CODE,...)
Definition: xsh_error.h:54
#define check(COMMAND)
Definition: xsh_error.h:71
#define check_msg(COMMAND,...)
Definition: xsh_error.h:62
#define XSH_ASSURE_NOT_NULL(pointer)
Definition: xsh_error.h:99
void xsh_instrument_set_arm(xsh_instrument *i, XSH_ARM arm)
Set an arm on instrument structure.
XSH_INSTRCONFIG * xsh_instrument_get_config(xsh_instrument *i)
Get the instrument default set of keywords.
xsh_instrument * xsh_instrument_new(void)
create new instrument structure
int size
int * x
#define xsh_msg(...)
Print a message on info level.
Definition: xsh_msg.h:121
#define xsh_msg_dbg_high(...)
Definition: xsh_msg.h:40
const char * xsh_pfits_get_pcatg(const cpl_propertylist *plist)
find out the pcatg
Definition: xsh_pfits.c:1627
void xsh_free_image(cpl_image **i)
Deallocate an image and set the pointer to NULL.
Definition: xsh_utils.c:2116
void xsh_free_frameset(cpl_frameset **f)
Deallocate a frame set and set the pointer to NULL.
Definition: xsh_utils.c:2254
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
Definition: xsh_utils.c:2179
XSH_INSTRCONFIG * config
xsh_instrument * instrument
cpl_propertylist * header
xsh_order * list
cpl_polynomial * edguppoly
cpl_polynomial * edglopoly
cpl_polynomial * cenpoly
xsh_instrument * instrument
Definition: xsh_data_rec.h:88
cpl_propertylist * header
Definition: xsh_data_rec.h:89
xsh_rec * list
Definition: xsh_data_rec.h:87
float * errs1
Definition: xsh_data_rec.h:71
float * slit
Definition: xsh_data_rec.h:66
int nslit
Definition: xsh_data_rec.h:65
float * data1
Definition: xsh_data_rec.h:68
int * qual1
Definition: xsh_data_rec.h:75
int order
Definition: xsh_data_rec.h:63
int nlambda
Definition: xsh_data_rec.h:64
double * lambda
Definition: xsh_data_rec.h:67
@ XSH_ARM_UVB
@ XSH_ARM_NIR
@ XSH_ARM_VIS
#define XSH_PRE_DATA_TYPE
Definition: xsh_data_pre.h:42
#define XSH_PRE_DATA_BPP
Definition: xsh_data_pre.h:43
int nx
int n
Definition: xsh_detmon_lg.c:92
int ny
int order
Definition: xsh_detmon_lg.c:80
#define XSH_ORDER2D
Definition: xsh_dfs.h:588
#define XSH_GET_TAG_FROM_ARM(TAG, instr)
Definition: xsh_dfs.h:1548
#define XSH_PSZY
Definition: xsh_pfits.h:171
#define XSH_OVSCX
Definition: xsh_pfits.h:157
#define XSH_OUT_NX
Definition: xsh_pfits.h:149
#define XSH_CRVAL1
Definition: xsh_pfits.h:100
#define XSH_PRSCX
Definition: xsh_pfits.h:159
#define XSH_EXPTIME
Definition: xsh_pfits.h:125
#define XSH_CHIP_NY
Definition: xsh_pfits.h:152
#define XSH_PSZX
Definition: xsh_pfits.h:170
#define XSH_PRSCY
Definition: xsh_pfits.h:160
#define XSH_DET_PXSPACE
Definition: xsh_pfits.h:164
#define XSH_OUT_NY
Definition: xsh_pfits.h:150
#define XSH_DPR_CATG
Definition: xsh_pfits.h:148
#define XSH_OVSCY
Definition: xsh_pfits.h:158
#define XSH_WIN_BINY
Definition: xsh_pfits.h:156
#define XSH_CHIP_NX
Definition: xsh_pfits.h:151
#define XSH_WIN_BINX
Definition: xsh_pfits.h:155
#define XSH_RON
Definition: xsh_pfits.h:161
#define XSH_CRVAL2
Definition: xsh_pfits.h:101
#define XSH_DPR_TYPE
Definition: xsh_pfits.h:147
#define XSH_CRPIX2
Definition: xsh_pfits.h:92
#define XSH_DET_GAIN
Definition: xsh_pfits.h:165
#define XSH_CONAD
Definition: xsh_pfits.h:162
#define XSH_CRPIX1
Definition: xsh_pfits.h:91
#define XSH_NEW_PROPERTYLIST(POINTER)
Definition: xsh_utils.h:70
#define XSH_CALLOC(POINTER, TYPE, SIZE)
Definition: xsh_utils.h:56