70 #define PRINT_USAGE(rc) \
71 fprintf(stderr, "Usage: %s [ -s slice ] [ -i iteration ] [ -c column ] [-r]" \
72 " WAVECAL_TABLE WAVECAL_RESIDUALS\n", argv[0]); \
73 cpl_end(); return (rc);
75 int main(
int argc,
char **argv)
77 cpl_init(CPL_INIT_DEFAULT);
86 unsigned short slice = 24;
87 unsigned int iteration = 0,
89 cpl_boolean residuals = CPL_FALSE;
93 for (i = 1; i < argc; i++) {
94 if (strncmp(argv[i],
"-s", 3) == 0) {
98 slice = atol(argv[i]);
102 }
else if (strncmp(argv[i],
"-i", 3) == 0) {
106 iteration = atol(argv[i]);
110 }
else if (strncmp(argv[i],
"-c", 3) == 0) {
114 column = atol(argv[i]);
118 }
else if (strncmp(argv[i],
"-r", 3) == 0) {
119 residuals = CPL_TRUE;
120 }
else if (strncmp(argv[i],
"-", 1) == 0) {
123 if (tcname && trname) {
134 cpl_table *ctable = cpl_table_load(tcname, 1, 0),
135 *rtable = cpl_table_load(trname, 1, 0);
136 if (!ctable || !rtable) {
137 cpl_table_delete(ctable);
138 cpl_table_delete(rtable);
142 printf(
"MUSE WAVECAL_TABLE table \"%s\", contains %"CPL_SIZE_FORMAT
" rows\n",
143 tcname, cpl_table_get_nrow(ctable));
144 printf(
"MUSE WAVECAL_RESIDUALS table \"%s\", contains %"CPL_SIZE_FORMAT
145 " rows\n", trname, cpl_table_get_nrow(rtable));
147 iteration, residuals);
152 case CPL_ERROR_ILLEGAL_INPUT:
153 fprintf(stderr,
"%s: one of the tables \"%s\"/\"%s\" does not seem to "
154 "contain valid MUSE information!\n", argv[0], tcname, trname);
157 case CPL_ERROR_DATA_NOT_FOUND:
159 fprintf(stderr,
"%s: \"%s\" does not seem to contain data for slice %d "
160 "and iteration %d!\n", argv[0], trname, slice, iteration);
162 fprintf(stderr,
"%s: \"%s\" does not seem to contain data for slice %d "
163 "and the last iteration!\n", argv[0], trname, slice);
167 case CPL_ERROR_ACCESS_OUT_OF_RANGE:
168 fprintf(stderr,
"%s: the requested slice number (%d) is invalid!\n",
172 case CPL_ERROR_UNSUPPORTED_MODE:
173 fprintf(stderr,
"%s: your platform does not seem to support pipes "
174 "[popen()/pclose()]!\n", argv[0]);
177 case CPL_ERROR_ASSIGNING_STREAM:
178 fprintf(stderr,
"%s: could not open gnuplot (this tool uses it for "
179 "plotting)!\n", argv[0]);
186 cpl_table_delete(ctable);
187 cpl_table_delete(rtable);
cpl_error_code muse_wave_plot_column(cpl_table *aCTable, cpl_table *aRTable, const unsigned short aSlice, unsigned int aColumn, unsigned int aIter, cpl_boolean aPlotRes)
Plot wavelength calibration polynomial and data or residuals using gnuplot.