IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 28, 2006, 2:50:52 PM (20 years ago)
Author:
Paul Price
Message:

Adding work in progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeConfig.c

    r6824 r6998  
    1 # include "ppMerge.h"
     1#include <stdio.h>
     2#include <pslib.h>
     3#include <psmodules.h>
    24
    3 static void usage (void) {
    4     fprintf (stderr, "USAGE: ppMerge [-file INPUT.fits] [-list INPUT.txt] OUTPUT\n");
    5     exit (2);
     5#include "ppMergeConfig.h"
     6
     7// Output usage information
     8static void usage(const char *programName // Name of the program
     9    )
     10{
     11    printf("Merge multiple calibration frames into a master frame by stacking.\n\n"
     12           "Usage:\n"
     13           "\t%s OUTPUT.fits [-files FILES] [-list FILE_LIST]\n\n"
     14           "where:\n"
     15           "FILES       is a glob to be interpreted by the program.\n"
     16           "FILE_LIST   is a list of files (including a glob interpreted by the shell).\n"
     17           "\n", programName);
     18    exit(EXIT_FAILURE);
    619}
    720
    8 pmConfig *ppMergeConfig (int argc, char **argv)
     21pmConfig *ppMergeConfig(int *argc, char **argv)
    922{
    10     bool status;
     23    if (*argc == 1) {
     24        usage(argv[0]);
     25    }
    1126
    12     if (argc == 1) usage ();
    13 
    14     // load the site-wide configuration information
    15     pmConfig *config = pmConfigRead(&argc, argv);
     27    // Load the site-wide configuration information
     28    pmConfig *config = pmConfigRead(argc, argv);
    1629    if (! config) {
    1730        psErrorStackPrint(stderr, "Can't find site configuration!\n");
    18         exit(EXIT_FAILURE);
     31        usage(argv[0]);
    1932    }
    2033
    21     // Parse other command-line arguments
     34    // Parse other command-line arguments, save for future use
    2235    config->arguments = psMetadataAlloc(); // The arguments, with default values
     36    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "-type", 0, "Type of calibration frame", "");
     37    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "-zero", 0, "Subtract background?", false);
     38    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "-scale", 0, "Scale by background?", false);
     39    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "-exptime", 0, "Scale by the exposure time?", false);
     40    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-onoff", 0, "Number of on/off pairs", 0);
    2341
    24     // the input file is a required argument; if not found, we will exit
    25     status = pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
    26     if (!status) { usage ();}
     42    // We require an input file set
     43    bool status = pmConfigFileSetsMD(config->arguments, argc, argv, "INPUT", "-files", "-list");
     44    if (!status) {
     45        usage(argv[0]);
     46    }
    2747
    28     if (! psArgumentParse(config->arguments, &argc, argv) || argc != 2) {
    29         usage ();
     48    // Parse other arguments
     49    if (! psArgumentParse(config->arguments, argc, argv) || *argc != 2) {
     50        usage(argv[0]);
    3051    }
    3152
     
    3354    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[1]);
    3455
    35     // the input image(s) are required arguments
    36     // the first one defines the camera
     56    // The input images are required.  The first one defines the camera.
    3757    status = false;
    38     pmFPAfileFromArgs (&status, config, "PPIMAGE.INPUT", "INPUT");
     58    pmFPAfileFromArgs(&status, config, "PPMERGE.INPUT", "INPUT");
    3959    if (!status) {
    40         psAbort (__func__, "missing INPUT entry");
     60        usage(argv[0]);
    4161    }
    4262
    43 # if 0
    44     // define Database handle, if used
     63
     64#if 0
     65    // Define database handle, if required
    4566    config->database = pmConfigDB(config->site);
    46 # endif
     67#endif
    4768
    48     return true;
    49 }
    50 
    51 /* we require all information needed to determine the scaling
    52    to be written in the header.  is this reasonable?
    53 */
     69    return config;
     70}
Note: See TracChangeset for help on using the changeset viewer.