IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14247


Ignore:
Timestamp:
Jul 16, 2007, 4:46:30 PM (19 years ago)
Author:
Paul Price
Message:

Putting back changes made a while ago that got clobbered.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubArguments.c

    r14245 r14247  
    1717{
    1818    fprintf(stderr, "\nPan-STARRS PSF-matched image subtraction\n\n");
    19     fprintf(stderr, "Usage: %s INPUT.fits REFERENCE.fits OUTPUT_ROOT\n", program);
     19    fprintf(stderr, "Usage: %s INPUT.fits REFERENCE.fits OUTPUT_ROOT \n"
     20            "\t[-psf REFERENCE.psf.fits|-psflist REFERENCE.list]\n",
     21            program);
    2022    fprintf(stderr, "\n");
    2123    psArgumentHelp(arguments);
     
    153155}
    154156
     157// Add a single filename to the arguments as an array, so that it can be used with pmFPAfileBindFromArgs, etc
     158static void fileList(const char *file, // The symbolic name for the file
     159                     const char *name, // The name of the file
     160                     const char *comment, // Description of the file
     161                     pmConfig *config // Configuration
     162    )
     163{
     164    psArray *files = psArrayAlloc(1); // Array with file names
     165    files->data[0] = psStringCopy(name);
     166    psMetadataAddArray(config->arguments, PS_LIST_TAIL, file, 0, comment, files);
     167    psFree(files);
     168    return;
     169}
    155170
    156171bool ppSubArguments(int argc, char *argv[], pmConfig *config)
     
    185200    }
    186201
    187     psArray *files = psArrayAlloc(1);   // Array with file names
    188     files->data[0] = psStringCopy(argv[1]);
    189     psMetadataAddArray(config->arguments, PS_LIST_TAIL, "INPUT", 0, "Name of the input image", files);
    190     psFree(files);
    191     files = psArrayAlloc(1);
    192     files->data[0] = psStringCopy(argv[2]);
    193     psMetadataAddArray(config->arguments, PS_LIST_TAIL, "REF", 0, "Name of the reference image", files);
    194     psFree(files);
     202    fileList("INPUT", argv[1], "Name of the input image",     config);
     203    fileList("REF",   argv[2], "Name of the reference image", config);
    195204    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[3]);
    196205
    197     valueArgStr(arguments, "-inmask",    "INPUT.MASK",    config->arguments);
    198     valueArgStr(arguments, "-inweight",  "INPUT.WEIGHT",  config->arguments);
    199     valueArgStr(arguments, "-refmask",   "REF.MASK",      config->arguments);
    200     valueArgStr(arguments, "-refweight", "REF.WEIGHT",    config->arguments);
     206    const char *inMask = psMetadataLookupStr(NULL, arguments, "-inmask"); // Name of input mask
     207    if (inMask && strlen(inMask) > 0) {
     208        fileList("INPUT.MASK", inMask, "Name of the input mask image", config);
     209    }
     210    const char *inWeight = psMetadataLookupStr(NULL, arguments, "-inweight"); // Name of input weight
     211    if (inWeight && strlen(inWeight) > 0) {
     212        fileList("INPUT.WEIGHT", inWeight, "Name of the input weight image", config);
     213    }
     214
     215    const char *refMask = psMetadataLookupStr(NULL, arguments, "-refmask"); // Name of reference mask
     216    if (refMask && strlen(refMask) > 0) {
     217        fileList("REF.MASK", refMask, "Name of the reference mask image", config);
     218    }
     219    const char *refWeight = psMetadataLookupStr(NULL, arguments, "-refweight"); // Name of reference weight
     220    if (refWeight && strlen(refWeight) > 0) {
     221        fileList("REF.WEIGHT", refWeight, "Name of the reference weight image", config);
     222    }
     223
    201224    valueArgStr(arguments, "-stats",     "STATS",         config->arguments);
    202225
Note: See TracChangeset for help on using the changeset viewer.