70 #define PRINT_USAGE(rc) \
71 fprintf(stderr, "Usage: %s [ -s1 first_slice ] [ -s2 last_slice ] " \
72 "TRACE_SAMPLES [ TRACE_TABLE ] [ MASTER_FLAT ]\n", argv[0]); \
73 cpl_end(); return (rc);
75 int main(
int argc,
char **argv)
77 cpl_init(CPL_INIT_DEFAULT);
92 for (i = 1; i < argc; i++) {
93 if (strncmp(argv[i],
"-s1", 4) == 0) {
97 slice1 = atoi(argv[i]);
101 }
else if (strncmp(argv[i],
"-s2", 4) == 0) {
105 slice2 = atoi(argv[i]);
109 }
else if (strncmp(argv[i],
"-", 1) == 0) {
112 if (tsname && ttname && iname) {
117 }
else if (!ttname) {
125 cpl_table *ts = cpl_table_load(tsname, 1, 0);
130 printf(
"MUSE TRACE_SAMPLES table \"%s\", contains %"CPL_SIZE_FORMAT
" rows\n",
131 tsname, cpl_table_get_nrow(ts));
133 cpl_table *tt = NULL;
135 tt = cpl_table_load(ttname, 1, 0);
139 fprintf(stderr,
"%s: loading the TRACE_TABLE \"%s\" failed: %s\n",
140 argv[0], ttname, cpl_error_get_message());
142 printf(
"MUSE TRACE table \"%s\", contains %"CPL_SIZE_FORMAT
" rows\n",
143 ttname, cpl_table_get_nrow(tt));
152 printf(
"MUSE MASTER_FLAT image \"%s\", has size "
153 "%"CPL_SIZE_FORMAT
"x%"CPL_SIZE_FORMAT
"\n", iname,
154 cpl_image_get_size_x(image->
data), cpl_image_get_size_y(image->
data));
163 case CPL_ERROR_ILLEGAL_INPUT:
164 fprintf(stderr,
"%s: \"%s\" does not seem to contain a MUSE tracing "
165 "samples table!\n", argv[0], tsname);
168 case CPL_ERROR_FILE_NOT_CREATED:
170 fprintf(stderr,
"%s: %s (temporary file for plotting)\n",
171 argv[0], cpl_error_get_message());
174 case CPL_ERROR_UNSUPPORTED_MODE:
175 fprintf(stderr,
"%s: your platform does not seem to support pipes "
176 "[popen()/pclose()]!\n", argv[0]);
179 case CPL_ERROR_ASSIGNING_STREAM:
180 fprintf(stderr,
"%s: could not open gnuplot (this tool uses it for "
181 "plotting)!\n", argv[0]);
188 cpl_table_delete(ts);
189 cpl_table_delete(tt);
void muse_image_delete(muse_image *aImage)
Deallocate memory associated to a muse_image object.
cpl_error_code muse_trace_plot_samples(cpl_table *aSamples, cpl_table *aTrace, unsigned short aSlice1, unsigned short aSlice2, muse_image *aImage)
Plotting of trace sample points and solution using gnuplot.
cpl_image * data
the data extension
Structure definition of MUSE three extension FITS file.
muse_image * muse_image_load(const char *aFilename)
Load the three extensions and the FITS headers of a MUSE image from a file.