/*--------------------------------------------------------------------------- File name : norm.c Author : Nicolas Devillard Created on : October 13, 1995 Description : Normalize a cube ---------------------------------------------------------------------------*/ /* $Id: norm.c,v 1.18 2002/01/29 13:05:25 ndevilla Exp $ $Author: ndevilla $ $Date: 2002/01/29 13:05:25 $ $Revision: 1.18 $ */ /*--------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include #include #include "eclipse.h" #define SCALE_FLUX 10 static void usage(char *pname) ; static char prog_desc[] = "cube normalisation" ; /*--------------------------------------------------------------------------- Main code ---------------------------------------------------------------------------*/ int main(int argc, char *argv[]) { cube_t * cube_in ; int status ; char * name_i ; char name_o[FILENAMESZ+1] ; int c ; int mode = NORM_MEAN ; double flux_scaling = 0.0 ; history * hs ; /* Command line parsing by getopt() */ while ((c = getopt(argc, argv, "f:m:L")) != EOF) { switch(c) { case 'L': eclipse_display_license() ; return 0 ; case 'm': if (strcmp(optarg, "scale") == 0) { mode = NORM_SCALE ; } else if (strcmp(optarg, "mean") == 0) { mode = NORM_MEAN ; } else if (strcmp(optarg, "flux") == 0) { mode = NORM_FLUX ; } else if (strcmp(optarg, "aflux") == 0) { mode = NORM_AFLUX ; } else if (strcmp(optarg, "scaleflux") == 0) { mode = SCALE_FLUX ; } else { e_error("illegal normalization mode") ; return -1 ; } break ; case 'f': flux_scaling = (double)atof(optarg) ; break ; default: usage(argv[0]) ; break ; } } /* Initialize eclipse environment */ eclipse_init(); /* get arguments */ if ((argc - optind) < 1) { e_error("missing arguments") ; return -1 ; } name_i = argv[optind++] ; if (optind] [options] [outcube]\n", pname) ; printf( "\ndefault output name for in.fits is in.norm.fits\n" "\nIndicate what shall be normalized in the output" "\nwith the -m option:\n" "\t[-m scale] to normalize pixel values to the [0..1] interval\n" "\t[-m mean] to normalize to a mean pixel value of 1.0 (default)\n" "\t[-m flux] to normalize to unity flux\n" "\t[-m aflux] to normalize to unity absolute flux\n" "\t[-m scaleflux [-f value]] to scale all fluxes to a value\n" "\n\n"); exit(0) ; }