59#define MODULE_ID "XSH_DATA_ORDER"
61#define SYNTAX "Test the order table\n"\
62 "usage : ./the_xsh_data_order [options] ORDER_TAB \n"\
63 "ORDER_TAB => the order table\n"\
65 " --binx=<n> : binning in X (default 1)\n"\
66 " --biny=<n> : binning in Y (default 1)\n"\
67 " --point=<str> : Point Type (cross, x, diamond, ...)\n"\
68 " Default is 'cross'\n"\
69 " --size=<n> : Point size (pixels). Default is default DS9 value\n"\
70 " --step=<nn> : Step in pixels. Default '8'\n"
80 {
"point", required_argument, 0,
POINT_OPT},
81 {
"size", required_argument, 0,
SIZE_OPT},
82 {
"step", required_argument, 0,
STEP_OPT},
84 {
"binx", required_argument, 0,
BINX_OPT},
85 {
"biny", required_argument, 0,
BINY_OPT},
102 int option_index = 0;
109 while( (opt = getopt_long( argc, argv,
Options,
150 char* order_tab_name = NULL;
151 cpl_frame* order_tab_frame = NULL;
152 cpl_table* table = NULL;
155 int order_tab_size = 0;
158 FILE* order_tab_file = NULL;
159 cpl_propertylist *header = NULL;
160 const char* pro_catg = NULL;
164 cpl_msg_set_level(CPL_MSG_DEBUG);
170 if ( optind < argc ) {
171 order_tab_name = argv[optind] ;
181 order_tab_frame = cpl_frame_new();
182 cpl_frame_set_filename( order_tab_frame, order_tab_name) ;
183 cpl_frame_set_level( order_tab_frame, CPL_FRAME_LEVEL_TEMPORARY);
184 cpl_frame_set_group( order_tab_frame, CPL_FRAME_GROUP_RAW );
187 check( nbcol = cpl_table_get_nrow(table));
198 order_tab_size = order_tab->
size;
201 check ( header = cpl_propertylist_load( order_tab_name, 0));
206 xsh_msg(
"Save order tab in ORDER_TAB.reg");
207 order_tab_file = fopen(
"ORDER_TAB.reg",
"w");
208 fprintf( order_tab_file,
"# Region file format: DS9 version 4.0\n"\
209 "global color=red font=\"helvetica 10 normal\""\
210 "select=1 highlite=1 edit=1 move=1 delete=1 include=1 fixed=0 "\
212 fprintf( order_tab_file,
213 "# GREEN center_x center_y (pixels)\n"\
214 "# RED low_x low_y (pixels)\n"\
215 "# BLUE up_x up_y (pixels)\n");
218 for( iorder=0; iorder< order_tab_size; iorder++){
227 xsh_msg(
"Warning starty and endy equal zero, put endy to %d",
ny);
238 fprintf( order_tab_file,
"point(%f,%d) #point=%s %s color=%s font="\
239 "\"helvetica 10 normal\" text={absorder %d}\n", dx, iy,
PointType,
241 }
else if (iy==
endy){
242 fprintf( order_tab_file,
"point(%f,%d) #point=%s %s color=%s font="\
243 "\"helvetica 10 normal\" text={absorder %d}\n", dx, iy,
PointType,
247 fprintf( order_tab_file,
"point(%f,%d) #point=%s %s color=%s font="\
255 fprintf( order_tab_file,
"point(%f,%d) #point=cross color=red font="\
256 "\"helvetica 10 normal\"\n", dx, iy);
259 fprintf( order_tab_file,
"point(%f,%d) #point=cross color=blue font="\
260 "\"helvetica 10 normal\"\n", dx, iy);
265 fprintf( order_tab_file,
266 "point(%f,%d) #point=diamond color=blue font=" \
267 "\"helvetica 10 normal\"\n", dx, iy);
272 fprintf( order_tab_file,
273 "point(%f,%d) #point=diamond color=red font=" \
274 "\"helvetica 10 normal\"\n", dx, iy);
286 if (cpl_error_get_code() != CPL_ERROR_NONE) {
290 if ( NULL != order_tab_file ) {
291 fclose( order_tab_file);
int main()
Unit test of xsh_bspline_interpol.
static xsh_instrument * instrument
static void HandleOptions(int argc, char **argv)
static const char * Options
static char CentralColor[32]
static struct option LongOptions[]
static char PointType[16]
void xsh_order_list_set_bin_y(xsh_order_list *list, int bin)
Set the bin of image in y.
void xsh_order_list_set_bin_x(xsh_order_list *list, int bin)
Set the bin of image in x.
xsh_order_list * xsh_order_list_load(cpl_frame *frame, xsh_instrument *instr)
load an order list from a frame
int xsh_order_list_get_starty(xsh_order_list *list, int i)
get position on Y axis of first pixel detected on order
int xsh_order_list_get_endy(xsh_order_list *list, int i)
get position on Y axis of last pixel detected on order
void xsh_order_list_free(xsh_order_list **list)
free memory associated to an order_list
double xsh_order_list_eval(xsh_order_list *list, cpl_polynomial *poly, double y)
Evaluate an order list poly.
#define xsh_error_dump(level)
#define XSH_ASSURE_NOT_NULL(pointer)
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.
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
xsh_instrument * xsh_instrument_new(void)
create new instrument structure
#define xsh_msg(...)
Print a message on info level.
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.
cpl_polynomial * edguppoly
cpl_polynomial * edglopoly
cpl_polynomial * slicuppoly
cpl_polynomial * sliclopoly
#define TESTS_INIT(DRL_ID)
#define XSH_ORDER_TAB_EDGES
#define XSH_CMP_TAG_MODE(tag_in, TAG)
#define XSH_ORDER_TAB_AFC
#define XSH_CMP_TAG_LAMP(tag_in, TAG)
#define XSH_TABLE_LOAD(TABLE, NAME)
#define XSH_TABLE_FREE(TABLE)