74 #define PRINT_USAGE(rc) \ 75 fprintf(stderr, "Usage: %s [ -s1 first_slice ] [ -s2 last_slice ] " \ 76 "[ -n nifu ] TRACE_SAMPLES [ TRACE_TABLE ] [ MASTER_FLAT ]\n", \ 78 cpl_end(); return (rc); 80 int main(
int argc,
char **argv)
82 cpl_init(CPL_INIT_DEFAULT);
95 unsigned char nifu = 0;
99 for (i = 1; i < argc; i++) {
100 if (strncmp(argv[i],
"-s1", 4) == 0) {
104 slice1 = atoi(argv[i]);
108 }
else if (strncmp(argv[i],
"-s2", 4) == 0) {
112 slice2 = atoi(argv[i]);
116 }
else if (strncmp(argv[i],
"-n", 3) == 0) {
120 nifu = atoi(argv[i]);
121 if (nifu == 0 || nifu > kMuseNumIFUs) {
127 }
else if (strncmp(argv[i],
"-", 1) == 0) {
130 if (tsname && ttname && iname) {
135 }
else if (!ttname) {
147 cpl_table *ts = cpl_table_load(tsname, iext, 1);
152 cpl_propertylist *header = cpl_propertylist_load(tsname, iext);
153 char *extname = NULL;
154 if (cpl_propertylist_has(header,
"EXTNAME")) {
157 printf(
"MUSE TRACE_SAMPLES table \"%s%s\", contains %"CPL_SIZE_FORMAT
" rows\n",
158 tsname, extname ? extname :
"", cpl_table_get_nrow(ts));
161 cpl_propertylist_delete(header);
163 cpl_table *tt = NULL;
169 tt = cpl_table_load(ttname, iext, 1);
170 header = cpl_propertylist_load(ttname, iext);
171 if (cpl_propertylist_has(header,
"EXTNAME")) {
174 cpl_propertylist_delete(header);
178 fprintf(stderr,
"%s: loading the TRACE_TABLE \"%s%s\" failed: %s\n",
179 argv[0], ttname, extname ? extname :
"", cpl_error_get_message());
181 printf(
"MUSE TRACE table \"%s%s\", contains %"CPL_SIZE_FORMAT
" rows\n",
182 ttname, extname ? extname :
"", cpl_table_get_nrow(tt));
199 printf(
"MUSE MASTER_FLAT image \"%s%s\", has size " 200 "%"CPL_SIZE_FORMAT
"x%"CPL_SIZE_FORMAT
"\n", iname, extname,
201 cpl_image_get_size_x(image->
data), cpl_image_get_size_y(image->
data));
213 case CPL_ERROR_ILLEGAL_INPUT:
214 fprintf(stderr,
"%s: \"%s\" does not seem to contain a MUSE tracing " 215 "samples table!\n", argv[0], tsname);
218 case CPL_ERROR_FILE_NOT_CREATED:
220 fprintf(stderr,
"%s: %s (temporary file for plotting)\n",
221 argv[0], cpl_error_get_message());
224 case CPL_ERROR_UNSUPPORTED_MODE:
225 fprintf(stderr,
"%s: your platform does not seem to support pipes " 226 "[popen()/pclose()]!\n", argv[0]);
229 case CPL_ERROR_ASSIGNING_STREAM:
230 fprintf(stderr,
"%s: could not open gnuplot (this tool uses it for " 231 "plotting)!\n", argv[0]);
238 cpl_table_delete(ts);
239 cpl_table_delete(tt);
void muse_image_delete(muse_image *aImage)
Deallocate memory associated to a muse_image object.
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_image * data
the data extension
Structure definition of MUSE three extension FITS file.
cpl_propertylist * header
the FITS header
cpl_error_code muse_trace_plot_samples(cpl_table *aSamples, cpl_table *aTrace, unsigned short aSlice1, unsigned short aSlice2, unsigned char aIFU, muse_image *aImage)
Plotting of trace sample points and solution using gnuplot.
muse_image * muse_image_load(const char *aFilename)
Load the three extensions and the FITS headers of a MUSE image from a file.
muse_image * muse_image_load_from_extensions(const char *aFilename, unsigned char aIFU)
Load the three extensions and the FITS headers of a MUSE image from extensions of a merged file...
void muse_processing_recipeinfo(cpl_plugin *)
Output main pipeline configuration, inputs, and parameters.