71 #define PRINT_USAGE(rc) \
72 fprintf(stderr, "Usage: %s [ -s slice ] [ -i iteration ] [ -c column ] [-r]" \
73 " WAVECAL_TABLE WAVECAL_RESIDUALS\n", argv[0]); \
74 cpl_end(); return (rc);
76 int main(
int argc,
char **argv)
78 cpl_init(CPL_INIT_DEFAULT);
87 unsigned short slice = 24;
88 unsigned int iteration = 0,
90 cpl_boolean residuals = CPL_FALSE;
94 for (i = 1; i < argc; i++) {
95 if (strncmp(argv[i],
"-s", 3) == 0) {
99 slice = atol(argv[i]);
103 }
else if (strncmp(argv[i],
"-i", 3) == 0) {
107 iteration = atol(argv[i]);
111 }
else if (strncmp(argv[i],
"-c", 3) == 0) {
115 column = atol(argv[i]);
119 }
else if (strncmp(argv[i],
"-r", 3) == 0) {
120 residuals = CPL_TRUE;
121 }
else if (strncmp(argv[i],
"-", 1) == 0) {
124 if (tcname && trname) {
135 cpl_table *ctable = cpl_table_load(tcname, 1, 0),
136 *rtable = cpl_table_load(trname, 1, 0);
137 if (!ctable || !rtable) {
138 cpl_table_delete(ctable);
139 cpl_table_delete(rtable);
143 printf(
"MUSE WAVECAL_TABLE table \"%s\", contains %"CPL_SIZE_FORMAT
" rows\n",
144 tcname, cpl_table_get_nrow(ctable));
145 printf(
"MUSE WAVECAL_RESIDUALS table \"%s\", contains %"CPL_SIZE_FORMAT
146 " rows\n", trname, cpl_table_get_nrow(rtable));
148 iteration, residuals);
153 case CPL_ERROR_ILLEGAL_INPUT:
154 fprintf(stderr,
"%s: one of the tables \"%s\"/\"%s\" does not seem to "
155 "contain valid MUSE information!\n", argv[0], tcname, trname);
158 case CPL_ERROR_DATA_NOT_FOUND:
160 fprintf(stderr,
"%s: \"%s\" does not seem to contain data for slice %d "
161 "and iteration %d!\n", argv[0], trname, slice, iteration);
163 fprintf(stderr,
"%s: \"%s\" does not seem to contain data for slice %d "
164 "and the last iteration!\n", argv[0], trname, slice);
168 case CPL_ERROR_ACCESS_OUT_OF_RANGE:
169 fprintf(stderr,
"%s: the requested slice number (%d) is invalid!\n",
173 case CPL_ERROR_UNSUPPORTED_MODE:
174 fprintf(stderr,
"%s: your platform does not seem to support pipes "
175 "[popen()/pclose()]!\n", argv[0]);
178 case CPL_ERROR_ASSIGNING_STREAM:
179 fprintf(stderr,
"%s: could not open gnuplot (this tool uses it for "
180 "plotting)!\n", argv[0]);
187 cpl_table_delete(ctable);
188 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.