68 #define PRINT_USAGE(rc) \
69 fprintf(stderr, "Usage: %s [ -s slice ] [ -i iteration ] [ -l ] " \
70 "[ -c c1 c2 ] WAVECAL_RESIDUALS\n", argv[0]); \
71 cpl_end(); return (rc);
73 int main(
int argc,
char **argv)
75 cpl_init(CPL_INIT_DEFAULT);
83 unsigned short slice = 0;
84 unsigned int iteration = 0;
85 cpl_boolean lambda = CPL_FALSE;
86 cpl_vector *cuts = NULL;
90 for (i = 1; i < argc; i++) {
91 if (strncmp(argv[i],
"-s", 3) == 0) {
95 slice = atol(argv[i]);
99 }
else if (strncmp(argv[i],
"-i", 3) == 0) {
103 iteration = atol(argv[i]);
105 cpl_vector_delete(cuts);
108 }
else if (strncmp(argv[i],
"-c", 3) == 0) {
109 cuts = cpl_vector_new(2);
113 cpl_vector_set(cuts, 0, atof(argv[i++]));
114 cpl_vector_set(cuts, 1, atof(argv[i]));
118 }
else if (strncmp(argv[i],
"-l", 3) == 0) {
120 }
else if (strncmp(argv[i],
"-", 1) == 0) {
128 cpl_table *table = cpl_table_load(tname, 1, 0);
133 printf(
"MUSE WAVECAL_RESIDUALS table \"%s\", contains %"CPL_SIZE_FORMAT
134 " rows\n", tname, cpl_table_get_nrow(table));
137 cpl_vector_delete(cuts);
142 case CPL_ERROR_ILLEGAL_INPUT:
143 fprintf(stderr,
"%s: \"%s\" does not seem to contain a MUSE wavelength "
144 "calibration residuals table!\n", argv[0], tname);
147 case CPL_ERROR_DATA_NOT_FOUND:
149 fprintf(stderr,
"%s: \"%s\" does not seem to contain data for slice %d "
150 "and iteration %d!\n", argv[0], tname, slice, iteration);
152 fprintf(stderr,
"%s: \"%s\" does not seem to contain data for slice %d "
153 "and the last iteration!\n", argv[0], tname, slice);
157 case CPL_ERROR_UNSUPPORTED_MODE:
158 fprintf(stderr,
"%s: your platform does not seem to support pipes "
159 "[popen()/pclose()]!\n", argv[0]);
162 case CPL_ERROR_ASSIGNING_STREAM:
163 fprintf(stderr,
"%s: could not open gnuplot (this tool uses it for "
164 "plotting)!\n", argv[0]);
171 cpl_table_delete(table);
cpl_error_code muse_wave_plot_residuals(cpl_table *aTable, const unsigned short aSlice, unsigned int aIter, cpl_boolean aPlotLambda, cpl_vector *aCuts)
Fancy plotting of wavelength calibration residuals (color coded over x/y-position) using gnuplot...