73 if (cpl_error_get_code() != CPL_ERROR_NONE) {
92 cpl_table* table = NULL;
93 cpl_propertylist* header = NULL;
94 const char* tablename = NULL;
103 check( tablename = cpl_frame_get_filename( frame));
109 check( header = cpl_propertylist_load( tablename,0));
110 check(cpl_propertylist_append( result->
header, header));
114 CPL_TYPE_INT, 0, &pol_degree);
121 for( k = 0 ; k <= pol_degree ; k++ ) {
127 check( cpl_polynomial_set_coeff( result->
cenpoly, &k, coef));
139 if (cpl_error_get_code() != CPL_ERROR_NONE) {
140 xsh_error_msg(
"can't load frame %s",cpl_frame_get_filename(frame));
185 cpl_propertylist *res = NULL;
210 const char* filename,
213 cpl_table* table = NULL;
214 cpl_frame * result = NULL ;
218 const char * tag = NULL ;
229 check(table = cpl_table_new( 1));
232 for( k = 0 ; k<= pol_degree ; k++ ) {
236 cpl_table_new_column(table, colname, CPL_TYPE_FLOAT));
239 cpl_table_new_column(table, colname, CPL_TYPE_FLOAT));
242 cpl_table_new_column(table, colname, CPL_TYPE_FLOAT));
248 for( k = 0 ; k <= pol_degree ; k++ ) {
252 check(coef = cpl_polynomial_get_coeff( list->
cenpoly, &k));
254 check(cpl_table_set( table, colname, 0, coef));
259 check(cpl_table_set( table, colname, 0, coef));
264 check(cpl_table_set( table, colname, 0, coef));
270 check( cpl_table_save( table, list->
header, NULL, filename, CPL_IO_DEFAULT));
275 CPL_FRAME_TYPE_TABLE,
276 CPL_FRAME_GROUP_PRODUCT,
277 CPL_FRAME_LEVEL_TEMPORARY));
static xsh_instrument * instrument
xsh_localization * xsh_localization_load(cpl_frame *frame)
Load a localization list from a frame.
cpl_frame * xsh_localization_save(xsh_localization *list, const char *filename, xsh_instrument *instrument)
save a localization to a frame
void xsh_localization_free(xsh_localization **list)
free memory associated to a localization_list
cpl_propertylist * xsh_localization_get_header(xsh_localization *list)
get header of the table
xsh_localization * xsh_localization_create(void)
Create an empty localization list.
#define XSH_ASSURE_NOT_ILLEGAL(cond)
#define xsh_error_msg(...)
#define XSH_ASSURE_NOT_NULL(pointer)
void xsh_free_polynomial(cpl_polynomial **p)
Deallocate a polynomial and set the pointer to NULL.
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
cpl_polynomial * edguppoly
cpl_polynomial * edglopoly
#define XSH_LOCALIZATION_TABLE_DEGPOL
#define XSH_LOCALIZATION_TABLE_COLNAME_EDGLO
#define XSH_LOCALIZATION_TABLE_COLNAME_EDGUP
#define XSH_LOCALIZATION_TABLE_COLNAME_CENTER
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 XSH_GET_TAG_FROM_ARM(TAG, instr)
#define XSH_NEW_PROPERTYLIST(POINTER)
#define XSH_CALLOC(POINTER, TYPE, SIZE)
#define XSH_TABLE_LOAD(TABLE, NAME)
#define XSH_TABLE_FREE(TABLE)