IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 7, 2006, 5:57:23 PM (20 years ago)
Author:
eugene
Message:

substantial upgrade to work with the pmFPAfile paradigm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageConfig.c

    r6747 r6817  
    1 #include <stdio.h>
    2 #include "pslib.h"
    3 #include "psmodules.h"
    41#include "ppImage.h"
     2
     3static void usage (void) {
     4    fprintf (stderr, "USAGE: ppImage [-file INPUT.fits] [-list INPUT.txt] OUTPUT\n");
     5    exit (2);
     6}
    57
    68pmConfig *ppImageConfig(int argc, char **argv)
    79{
     10
     11    bool status;
     12
     13    if (argc == 1) usage ();
     14
     15    // load the site-wide configuration information
    816    pmConfig *config = pmConfigRead(&argc, argv);
    917    if (! config) {
     
    1220    }
    1321
    14     // Parse other command-line arguments
     22    // Parse other command-line arguments, save for future use
    1523    config->arguments = psMetadataAlloc(); // The arguments, with default values
    16     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-key", 0, "exposure ID", "");
    17     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-bias", 0, "Name of the bias image", "");
    18     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-dark", 0, "Name of the dark image", "");
    19     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-flat", 0, "Name of the flat-field image", "");
    20     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-mask", 0, "Name of the mask image", "");
    21     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-fringe", 0, "Name of the fringe image", "");
    22     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-chip", 0, "Chip number to process (if positive)", -1);
    2324
    24     if (! psArgumentParse(config->arguments, &argc, argv) || argc != 3) {
    25         printf("\nPan-STARRS Phase 2 processing\n\n");
    26         printf("Usage: %s INPUT.fits OUTPUT.fits\n\n", argv[0]);
    27         psArgumentHelp(config->arguments);
    28         psFree(config->arguments);
    29         exit(EXIT_FAILURE);
     25    // if these command-line options are supplied, load the file name lists into config->arguments
     26    // override any configuration-specified source for these files
     27    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "BIAS", "-bias", "-biaslist");
     28    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "DARK", "-dark", "-darklist");
     29    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "FLAT", "-flat", "-flatlist");
     30    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist");
     31    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "FRINGE", "-fringe", "-fringelist");
     32
     33    // other command-line options
     34    // XXX not sure how these are to be used at the moment
     35    // psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-key", 0, "exposure ID", "");
     36    // psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-chip", 0, "Chip number to process (if positive)", -1);
     37
     38    // the input file is a required argument; if not found, we will exit
     39    status = pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
     40    if (!status) { usage ();}
     41
     42    if (! psArgumentParse(config->arguments, &argc, argv) || argc != 2) {
     43        usage ();
    3044    }
    3145
    3246    // Add the input and output images (which remain on the command-line) to the arguments list
    33     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-input",  0, "Name of the input image",  argv[1]);
    34     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-output", 0, "Name of the output image", argv[2]);
     47    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[1]);
     48
     49    // the input image(s) are required arguments
     50    // the first one defines the camera
     51    status = false;
     52    pmFPAfileFromArgs (&status, config, "PPIMAGE.INPUT", "INPUT");
     53    if (!status) {
     54        psAbort (__func__, "missing INPUT entry");
     55    }
    3556
    3657    // Define database handle, if used
Note: See TracChangeset for help on using the changeset viewer.