73 if ( fname == NULL ) fout = stdout ;
74 else fout = fopen( fname,
"w" ) ;
76 for( i = 0 ; i<list->
size ; i++ ) {
77 fprintf( fout,
"Order: %d, Lambda Min: %f,Lambda Max: %f\n",
81 if ( fname != NULL ) fclose( fout ) ;
113 if (cpl_error_get_code() != CPL_ERROR_NONE) {
135 cpl_table* table = NULL;
136 cpl_propertylist* header = NULL;
137 const char* tablename = NULL;
148 check( tablename = cpl_frame_get_filename( frame));
152 check(
size = cpl_table_get_nrow( table));
155 check( header = cpl_propertylist_load(tablename,1));
156 check( cpl_propertylist_append(result->
header, header));
158 for(i=0;i<result->
size;i++){
165 check( lamp = cpl_table_get_string(table,
167 strcpy( result->
list[i].
lamp, lamp);
169 check( value = cpl_table_get( table,
173 check( value = cpl_table_get( table,
177 check( value = cpl_table_get( table,
181 check( value = cpl_table_get( table,
185 check( value = cpl_table_get( table,
187 result->
list[i].
flsr = (float)value;
189 check( value = cpl_table_get( table,
191 result->
list[i].
ufsr = (float)value;
195 check( value = cpl_table_get( table,
197 result->
list[i].
xmin = (float)value;
199 check( value = cpl_table_get( table,
201 result->
list[i].
xmax = (float)value;
204 check( value = cpl_table_get( table,
206 result->
list[i].
ymin = (float)value;
208 check( value = cpl_table_get( table,
210 result->
list[i].
ymax = (float)value;
215 if (cpl_error_get_code () != CPL_ERROR_NONE) {
216 xsh_error_msg(
"can't load frame %s",cpl_frame_get_filename(frame));
237 if ( ( *list)->list){
238 cpl_free( (*list)->list);
262 cpl_propertylist *res = NULL;
291 for( i = 0; i<list->
size; i++){
308 const char *res = NULL;
312 for( i = 0 ; i<list->
size ; i++ )
340 for( i = 0 ; i<list->
size ; i++ )
366 cpl_vector* result = NULL;
373 for( i = 0 ; i<list->
size ; i++ ){
374 float min=0.0,
max=0.0;
381 if (lambda >= min && lambda <=
max){
389 for( i=0; i<
size; i++){
390 check( cpl_vector_set( result, i, order_tab[i]));
394 if ( cpl_error_get_code() != CPL_ERROR_NONE){
409 for( iorder=0; iorder < spectralformat->
size; iorder++){
414 double y_wmin, y_wmax;
416 absorder = (double)spectralformat->
list[iorder].
absorder;
420 ymin = (
double)orderlist->
list[iorder].
starty;
421 ymax = (double)orderlist->
list[iorder].
endy;
423 if (wavesol != NULL){
437 if ( y_wmin < ymin || y_wmin > ymax){
439 absorder, wmin, y_wmin, ymin, ymax);
441 if ( y_wmax > ymax || y_wmax < ymin){
443 absorder, wmax, y_wmax, ymin, ymax);
double xsh_wavesol_eval_poly(xsh_wavesol *sol, double lambda, double order, double slit)
eval the polynomial solution in Y
#define XSH_ASSURE_NOT_ILLEGAL(cond)
#define xsh_error_msg(...)
#define XSH_ASSURE_NOT_NULL(pointer)
void xsh_model_get_xy(xsh_xs_3 *p_xs_3, xsh_instrument *instr, double lambda_nm, int morder, double ent_slit_pos, double *x, double *y)
Compute the detector location (floating point pixels) of a given wavelength/entrance slit position.
#define xsh_msg_warning(...)
Print an warning message.
#define xsh_msg_dbg_high(...)
void xsh_free_vector(cpl_vector **v)
Deallocate a vector 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.
#define XSH_NEW_PROPERTYLIST(POINTER)
#define XSH_CALLOC(POINTER, TYPE, SIZE)
#define XSH_TABLE_LOAD(TABLE, NAME)
#define XSH_TABLE_FREE(TABLE)