69 #define PRINT_USAGE(rc) \
70 fprintf(stderr, "Usage: %s [ -l1 lambda1 ] [ -l2 lambda2 ] [ -x1 xpos1 ] " \
71 "[ -x2 xpos2 ] [ -y1 ypos1 ] [ -y2 ypos2 ] PIXTABLE_IN " \
72 "PIXTABLE_OUT\n", argv[0]); \
73 cpl_end(); return (rc);
75 int main(
int argc,
char **argv)
77 cpl_init(CPL_INIT_DEFAULT);
87 double x1 = -FLT_MAX, x2 = FLT_MAX,
88 y1 = -FLT_MAX, y2 = FLT_MAX,
89 l1 = -FLT_MAX, l2 = FLT_MAX;
93 for (i = 1; i < argc; i++) {
94 if (strncmp(argv[i],
"-x1", 4) == 0) {
102 }
else if (strncmp(argv[i],
"-x2", 4) == 0) {
109 }
else if (strncmp(argv[i],
"-y1", 4) == 0) {
116 }
else if (strncmp(argv[i],
"-y2", 4) == 0) {
123 }
else if (strncmp(argv[i],
"-l1", 4) == 0) {
131 }
else if (strncmp(argv[i],
"-l2", 4) == 0) {
138 }
else if (strncmp(argv[i],
"-", 1) == 0) {
141 if (tiname && toname) {
151 if (!tiname || !toname) {
155 cpl_msg_set_level(CPL_MSG_WARNING);
172 printf(
"MUSE pixel table \"%s\" (%"CPL_SIZE_FORMAT
" rows)\n"
173 " cropping to lambda = %.2f..%.2f Angstrom\n"
174 " xpos = %.3e..%.3e %s\n"
175 " ypos = %.3e..%.3e %s\n",
177 xl, xu, cpl_table_get_column_unit(table->
table, MUSE_PIXTABLE_XPOS),
178 yl, yu, cpl_table_get_column_unit(table->
table, MUSE_PIXTABLE_YPOS));
191 printf(
"MUSE pixel table \"%s\" (%"CPL_SIZE_FORMAT
" rows) saved\n",
muse_pixtable * muse_pixtable_load(const char *aFilename)
Load the table itself and the FITS headers of a MUSE pixel table from a file.
#define MUSE_HDR_PT_XLO
FITS header keyword contains the lower limit of the data in x-direction.
cpl_size muse_pixtable_get_nrow(const muse_pixtable *aPixtable)
get the number of rows within the pixel table
#define MUSE_HDR_PT_LHI
FITS header keyword contains the upper limit of the data in spectral direction.
cpl_table * table
The pixel table.
cpl_error_code muse_pixtable_restrict_wavelength(muse_pixtable *aPixtable, double aLow, double aHigh)
Restrict a pixel table to a certain wavelength range.
Structure definition of MUSE pixel table.
#define MUSE_HDR_PT_YLO
FITS header keyword contains the lower limit of the data in y-direction.
#define MUSE_HDR_PT_LLO
FITS header keyword contains the lower limit of the data in spectral direction.
cpl_error_code muse_pixtable_save(muse_pixtable *aPixtable, const char *aFilename)
Save a MUSE pixel table to a file on disk.
cpl_error_code muse_pixtable_restrict_xpos(muse_pixtable *aPixtable, double aLo, double aHi)
Restrict a pixel table to a certain x coordinate range.
void muse_pixtable_delete(muse_pixtable *aPixtable)
Deallocate memory associated to a pixel table object.
cpl_error_code muse_pixtable_restrict_ypos(muse_pixtable *aPixtable, double aLo, double aHi)
Restrict a pixel table to a certain y coordinate range.
#define MUSE_HDR_PT_YHI
FITS header keyword contains the upper limit of the data in y-direction.
cpl_propertylist * header
The FITS header.
#define MUSE_HDR_PT_XHI
FITS header keyword contains the upper limit of the data in x-ion.