71 #define PRINT_USAGE(rc) \ 72 fprintf(stderr, "Usage: %s [ -n nifu ] [ -s slice ] [ -i iteration ] [ -l ] "\ 73 "[ -c c1 c2 ] 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 char nifu = 0;
88 unsigned short slice = 0;
89 unsigned int iteration = 0;
90 cpl_boolean lambda = CPL_FALSE;
91 cpl_vector *cuts = NULL;
95 for (i = 1; i < argc; i++) {
96 if (strncmp(argv[i],
"-s", 3) == 0) {
100 slice = atol(argv[i]);
104 }
else if (strncmp(argv[i],
"-i", 3) == 0) {
108 iteration = atol(argv[i]);
110 cpl_vector_delete(cuts);
113 }
else if (strncmp(argv[i],
"-c", 3) == 0) {
114 cuts = cpl_vector_new(2);
118 cpl_vector_set(cuts, 0, atof(argv[i++]));
119 cpl_vector_set(cuts, 1, atof(argv[i]));
123 }
else if (strncmp(argv[i],
"-n", 3) == 0) {
127 nifu = atoi(argv[i]);
128 if (nifu == 0 || nifu > kMuseNumIFUs) {
134 }
else if (strncmp(argv[i],
"-l", 3) == 0) {
136 }
else if (strncmp(argv[i],
"-", 1) == 0) {
148 cpl_table *table = cpl_table_load(tname, iext, 1);
153 char *extname = NULL;
154 cpl_propertylist *header = cpl_propertylist_load(tname, iext);
155 if (cpl_propertylist_has(header,
"EXTNAME")) {
158 cpl_propertylist_delete(header);
160 printf(
"MUSE WAVECAL_RESIDUALS table \"%s%s\", contains %"CPL_SIZE_FORMAT
161 " rows\n", tname, extname ? extname :
"", cpl_table_get_nrow(table));
164 cpl_vector_delete(cuts);
169 case CPL_ERROR_ILLEGAL_INPUT:
170 fprintf(stderr,
"%s: \"%s%s\" does not seem to contain a MUSE wavelength " 171 "calibration residuals table!\n", argv[0], tname,
172 extname ? extname :
"");
175 case CPL_ERROR_DATA_NOT_FOUND:
177 fprintf(stderr,
"%s: \"%s%s\" does not seem to contain data for slice %d " 178 "and iteration %d!\n", argv[0], tname, extname ? extname :
"",
181 fprintf(stderr,
"%s: \"%s%s\" does not seem to contain data for slice %d " 182 "and the last iteration!\n", argv[0], tname,
183 extname ? extname :
"", slice);
187 case CPL_ERROR_UNSUPPORTED_MODE:
188 fprintf(stderr,
"%s: your platform does not seem to support pipes " 189 "[popen()/pclose()]!\n", argv[0]);
192 case CPL_ERROR_ASSIGNING_STREAM:
193 fprintf(stderr,
"%s: could not open gnuplot (this tool uses it for " 194 "plotting)!\n", argv[0]);
202 cpl_table_delete(table);
cpl_error_code muse_wave_plot_residuals(cpl_table *aTable, unsigned char aIFU, 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...
const char * muse_pfits_get_extname(const cpl_propertylist *aHeaders)
find out the extension name
int muse_utils_get_extension_for_ifu(const char *aFilename, unsigned char aIFU)
Return extension number that corresponds to this IFU/channel number.
void muse_processing_recipeinfo(cpl_plugin *)
Output main pipeline configuration, inputs, and parameters.