75 #define PRINT_USAGE(rc) \ 76 fprintf(stderr, "Usage: %s [ -l1 lambda1 ] [ -l2 lambda2 ] [ -x1 xpos1 ] " \ 77 "[ -x2 xpos2 ] [ -y1 ypos1 ] [ -y2 ypos2 ] [ -i IFU ] [ -s slice ] " \ 78 "PIXTABLE_IN PIXTABLE_OUT\n", argv[0]); \ 79 cpl_end(); return (rc); 81 int main(
int argc,
char **argv)
83 cpl_init(CPL_INIT_DEFAULT);
94 double x1 = -FLT_MAX, x2 = FLT_MAX,
95 y1 = -FLT_MAX, y2 = FLT_MAX,
96 l1 = -FLT_MAX, l2 = FLT_MAX;
97 unsigned char ifu = 0;
98 unsigned short slice = 0;
102 for (i = 1; i < argc; i++) {
103 if (strncmp(argv[i],
"-x1", 4) == 0) {
111 }
else if (strncmp(argv[i],
"-x2", 4) == 0) {
118 }
else if (strncmp(argv[i],
"-y1", 4) == 0) {
125 }
else if (strncmp(argv[i],
"-y2", 4) == 0) {
132 }
else if (strncmp(argv[i],
"-l1", 4) == 0) {
140 }
else if (strncmp(argv[i],
"-l2", 4) == 0) {
147 }
else if (strncmp(argv[i],
"-i", 3) == 0) {
154 }
else if (strncmp(argv[i],
"-s", 3) == 0) {
157 slice = atoi(argv[i]);
161 }
else if (strncmp(argv[i],
"-", 1) == 0) {
164 if (tiname && toname) {
174 if (!tiname || !toname) {
178 cpl_msg_set_level(CPL_MSG_WARNING);
195 printf(
"MUSE pixel table \"%s\" (%"CPL_SIZE_FORMAT
" rows)\n" 196 " cropping to lambda = %.2f..%.2f Angstrom\n" 197 " xpos = %.3e..%.3e %s\n" 198 " ypos = %.3e..%.3e %s\n",
208 if (ifu >= 1 && ifu <= kMuseNumIFUs) {
209 printf(
" selecting pixels from IFU %02hhu ", ifu);
210 cpl_table_unselect_all(table->
table);
211 const int *origin = cpl_table_get_data_int_const(table->
table,
214 for (irow = 0; irow < nrow; irow++) {
216 cpl_table_select_row(table->
table, irow);
219 printf(
"(%d of %d)\n", (
int)cpl_table_count_selected(table->
table), (
int)nrow);
220 cpl_table_erase_selected(table->
table);
222 if (slice >= 1 && slice <= kMuseSlicesPerCCD) {
223 printf(
" selecting pixels from slice %02hu ", slice);
224 cpl_table_unselect_all(table->
table);
225 const int *origin = cpl_table_get_data_int_const(table->
table,
228 for (irow = 0; irow < nrow; irow++) {
230 cpl_table_select_row(table->
table, irow);
233 printf(
"(%d of %d)\n", (
int)cpl_table_count_selected(table->
table), (
int)nrow);
234 cpl_table_erase_selected(table->
table);
246 printf(
"MUSE pixel table \"%s\" (%"CPL_SIZE_FORMAT
" rows) saved\n",
#define MUSE_PIXTABLE_XPOS
muse_pixtable * muse_pixtable_load(const char *aFilename)
Load the table itself and the FITS headers of a MUSE pixel table from a file.
unsigned short muse_pixtable_origin_get_slice(uint32_t aOrigin)
Get the slice number from the encoded 32bit origin number.
#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_PIXTABLE_ORIGIN
#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.
unsigned short muse_pixtable_origin_get_ifu(uint32_t aOrigin)
Get the IFU number from the encoded 32bit origin number.
cpl_error_code muse_pixtable_restrict_xpos(muse_pixtable *aPixtable, double aLo, double aHi)
Restrict a pixel table to a certain x coordinate range.
#define MUSE_PIXTABLE_YPOS
void muse_pixtable_delete(muse_pixtable *aPixtable)
Deallocate memory associated to a pixel table object.
void muse_processing_recipeinfo(cpl_plugin *)
Output main pipeline configuration, inputs, and parameters.
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.