66 lb = (*b)->wavelength;
89 lb = (*b)->wavelength;
94 sa = (*a)->slit_position;
95 sb = (*b)->slit_position;
301 assure(the != NULL,CPL_ERROR_NULL_INPUT,
"Null the map");
304 for(i=0; i< the->
size; i++) {
305 xsh_msg(
" Wavelength %f order %d slit_position %f detector_x %f \
317 int order,
int slit_index,
float slit_position,
double detx,
double dety)
360 for( i=0; i<
size; i++){
365 if ( cpl_error_get_code() != CPL_ERROR_NONE){
387 cpl_table* table = NULL;
388 const char* tablename = NULL;
391 cpl_propertylist * header = NULL ;
399 check( tablename = cpl_frame_get_filename(frame));
403 check_msg( header = cpl_propertylist_load( tablename, 1 ),
404 "Can't load header from %s", tablename ) ;
414 check (full_size = cpl_table_get_nrow( table));
418 for( i = 0; i<full_size ; i++) {
422 CPL_TYPE_FLOAT, i, &lambda));
428 assure(real_size > 0, CPL_ERROR_ILLEGAL_INPUT,
429 "no valid lambda found in the_map");
432 result->
size = real_size ;
436 for(i=0, k = 0 ; i<full_size; i++) {
441 CPL_TYPE_FLOAT, i, &lambda ));
447 CPL_TYPE_INT, i, &(arc->
order)));
456 result->
list[k] = arc;
459 check( result->
header = cpl_propertylist_duplicate( header ) ) ;
492 for(i=0; i < (*list)->size; i++) {
496 cpl_free((*list)->list);
498 (*list)->list = NULL;
515 cpl_table* table = NULL;
516 cpl_frame * result = NULL ;
559 check(cpl_table_set_size(table,list->
size));
562 for(i=0;i<list->
size;i++){
578 check(cpl_table_save(table, NULL,NULL,filename, CPL_IO_DEFAULT));
583 CPL_FRAME_TYPE_TABLE,
584 CPL_FRAME_GROUP_PRODUCT,
585 CPL_FRAME_LEVEL_TEMPORARY));
void xsh_the_map_free(xsh_the_map **list)
free memory associated to a the_map
double xsh_the_map_get_detx(xsh_the_map *list, int idx)
get detx of the map list
float xsh_the_map_get_slit_position(xsh_the_map *list, int idx)
get slit position of the map list
static int xsh_the_map_lambda_compare(const void *one, const void *two)
int xsh_the_map_get_slit_index(xsh_the_map *list, int idx)
get slit position of the map list
void xsh_dump_the_map(xsh_the_map *the)
Dump main info about the_map.
double xsh_the_map_get_dety(xsh_the_map *list, int idx)
get dety of the map list
void xsh_the_map_set_arcline(xsh_the_map *list, int idx, float wavelength, int order, int slit_index, float slit_position, double detx, double dety)
void xsh_the_map_lambda_sort(xsh_the_map *list)
sort the_map arcline list by increasing lambda
int xsh_the_map_get_order(xsh_the_map *list, int idx)
get order of the map list
int xsh_the_map_get_size(xsh_the_map *list)
get size of the map list
static int xsh_the_map_lambda_order_slit_compare(const void *one, const void *two)
void xsh_the_arcline_free(xsh_the_arcline **arc)
free memory associated to a the_arcline
void xsh_the_map_lambda_order_slit_sort(xsh_the_map *list)
xsh_the_map * xsh_the_map_create(int size)
Create an empty theoretical map.
float xsh_the_map_get_wavelength(xsh_the_map *list, int idx)
get wavelength of the map list
xsh_the_map * xsh_the_map_load(cpl_frame *frame)
load a theoretical map frame in the_map structure. Suppress spurious entries in the THE MAP (marked w...
cpl_frame * xsh_the_map_save(xsh_the_map *list, const char *filename)
save a the_map to a frame
#define XSH_ASSURE_NOT_ILLEGAL(cond)
#define assure(CONDITION, ERROR_CODE,...)
#define check_msg(COMMAND,...)
#define XSH_ASSURE_NOT_NULL(pointer)
#define xsh_msg_dbg_medium(...)
#define xsh_msg(...)
Print a message on info level.
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
cpl_error_code xsh_get_table_value(const cpl_table *table, const char *colname, cpl_type coltype, int i, void *result)
Read a table value from a fits table.
cpl_propertylist * header
#define XSH_THE_MAP_TABLE_NB_COL
#define XSH_THE_MAP_TABLE_UNIT_SLITPOSITION
#define XSH_THE_MAP_TABLE_COLNAME_SLITINDEX
#define XSH_THE_MAP_TABLE_UNIT_WAVELENGTH
#define XSH_THE_MAP_TABLE_COLNAME_WAVELENGTH
#define XSH_THE_MAP_TABLE_UNIT_DETECTORX
#define XSH_THE_MAP_TABLE_UNIT_DETECTORY
#define XSH_THE_MAP_TABLE_COLNAME_DETECTORX
#define XSH_THE_MAP_TABLE_COLNAME_SLITPOSITION
#define XSH_THE_MAP_TABLE_COLNAME_ORDER
#define XSH_THE_MAP_TABLE_UNIT_ORDER
#define XSH_THE_MAP_TABLE_COLNAME_DETECTORY
cpl_frame * xsh_frame_product(const char *fname, const char *tag, cpl_frame_type type, cpl_frame_group group, cpl_frame_level level)
Creates a frame with given characteristics.
#define WAVELENGTH_PRECISION
#define XSH_CALLOC(POINTER, TYPE, SIZE)
#define XSH_TABLE_LOAD(TABLE, NAME)
#define XSH_TABLE_FREE(TABLE)