74 #define PRINT_USAGE(rc) \ 75 fprintf(stderr, "Usage: %s [ -n nifu ] [ -s slice ] [ -i iteration ] " \ 76 "[ -c column ] [ -r ] WAVECAL_TABLE WAVECAL_RESIDUALS\n", argv[0]); \ 77 cpl_end(); return (rc); 79 int main(
int argc,
char **argv)
81 cpl_init(CPL_INIT_DEFAULT);
91 unsigned short slice = 24;
92 unsigned char nifu = 0;
93 unsigned int iteration = 0,
95 cpl_boolean residuals = CPL_FALSE;
99 for (i = 1; i < argc; i++) {
100 if (strncmp(argv[i],
"-s", 3) == 0) {
104 slice = atol(argv[i]);
108 }
else if (strncmp(argv[i],
"-i", 3) == 0) {
112 iteration = atol(argv[i]);
116 }
else if (strncmp(argv[i],
"-c", 3) == 0) {
120 column = atol(argv[i]);
124 }
else if (strncmp(argv[i],
"-n", 3) == 0) {
128 nifu = atoi(argv[i]);
129 if (nifu == 0 || nifu > kMuseNumIFUs) {
135 }
else if (strncmp(argv[i],
"-r", 3) == 0) {
136 residuals = CPL_TRUE;
137 }
else if (strncmp(argv[i],
"-", 1) == 0) {
140 if (tcname && trname) {
157 cpl_table *ctable = cpl_table_load(tcname, iextc, 1),
158 *rtable = cpl_table_load(trname, iextr, 1);
159 if (!ctable || !rtable) {
160 cpl_table_delete(ctable);
161 cpl_table_delete(rtable);
166 char *extnamer = NULL,
168 cpl_propertylist *header = cpl_propertylist_load(tcname, iextc);
169 if (cpl_propertylist_has(header,
"EXTNAME")) {
172 cpl_propertylist_delete(header);
173 header = cpl_propertylist_load(trname, iextr);
174 if (cpl_propertylist_has(header,
"EXTNAME")) {
177 cpl_propertylist_delete(header);
180 printf(
"MUSE WAVECAL_TABLE table \"%s%s\", contains %"CPL_SIZE_FORMAT
" rows\n",
181 tcname, extnamec ? extnamec :
"", cpl_table_get_nrow(ctable));
182 printf(
"MUSE WAVECAL_RESIDUALS table \"%s%s\", contains %"CPL_SIZE_FORMAT
183 " rows\n", trname, extnamer ? extnamer :
"", cpl_table_get_nrow(rtable));
186 iteration, residuals);
191 case CPL_ERROR_ILLEGAL_INPUT:
192 fprintf(stderr,
"%s: one of the tables \"%s%s\"/\"%s%s\" does not seem to " 193 "contain valid MUSE information!\n", argv[0],
194 tcname, extnamec ? extnamec :
"", trname, extnamer ? extnamer :
"");
197 case CPL_ERROR_DATA_NOT_FOUND:
199 fprintf(stderr,
"%s: \"%s%s\" does not seem to contain data for slice %d " 200 "and iteration %d!\n", argv[0], trname, extnamer ? extnamer :
"",
203 fprintf(stderr,
"%s: \"%s%s\" does not seem to contain data for slice %d " 204 "and the last iteration!\n", argv[0], trname,
205 extnamer ? extnamer :
"", slice);
209 case CPL_ERROR_ACCESS_OUT_OF_RANGE:
210 fprintf(stderr,
"%s: the requested slice number (%d) is invalid!\n",
214 case CPL_ERROR_UNSUPPORTED_MODE:
215 fprintf(stderr,
"%s: your platform does not seem to support pipes " 216 "[popen()/pclose()]!\n", argv[0]);
219 case CPL_ERROR_ASSIGNING_STREAM:
220 fprintf(stderr,
"%s: could not open gnuplot (this tool uses it for " 221 "plotting)!\n", argv[0]);
230 cpl_table_delete(ctable);
231 cpl_table_delete(rtable);
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.
cpl_error_code muse_wave_plot_column(cpl_table *aCTable, cpl_table *aRTable, unsigned char aIFU, unsigned short aSlice, unsigned int aColumn, unsigned int aIter, cpl_boolean aPlotRes)
Plot wavelength calibration polynomial and data or residuals using gnuplot.
void muse_processing_recipeinfo(cpl_plugin *)
Output main pipeline configuration, inputs, and parameters.