IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 5, 2008, 11:18:27 AM (18 years ago)
Author:
Paul Price
Message:

Adding configuration dumping. Required reorganisation of how recipe values get into the program. Formerly, the command-line and recipe values were parsed and the result was put on config->arguments. Now, we want whatever was altered by the command-line to be reflected in the recipe (which is dumped), so using the recipe as the storage. Not yet tested, but will do so soon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackArguments.c

    r18785 r18918  
    4949        } \
    5050    } \
    51     psMetadataAdd##TYPE(config->arguments, PS_LIST_TAIL, RECIPENAME, 0, NULL, value); \
     51    psMetadataAdd##TYPE(recipe, PS_LIST_TAIL, RECIPENAME, PS_META_REPLACE, NULL, value); \
    5252}
    5353
     
    6464        } \
    6565    } \
    66     psMetadataAdd##TYPE(config->arguments, PS_LIST_TAIL, RECIPENAME, 0, NULL, value); \
     66    psMetadataAdd##TYPE(recipe, PS_LIST_TAIL, RECIPENAME, PS_META_REPLACE, NULL, value); \
    6767}
    6868
     
    8080    } \
    8181    psMaskType value = pmConfigMaskGet(name, config); \
    82     psMetadataAddU8(config->arguments, PS_LIST_TAIL, RECIPENAME, 0, NULL, value); \
     82    psMetadataAddU8(recipe, PS_LIST_TAIL, RECIPENAME, PS_META_REPLACE, NULL, value); \
    8383}
    8484
     
    9494        } \
    9595    } \
    96     psMetadataAddS32(config->arguments, PS_LIST_TAIL, RECIPENAME, 0, NULL, psStatsOptionFromString(stat)); \
     96    psMetadataAddS32(recipe, PS_LIST_TAIL, RECIPENAME, PS_META_REPLACE, \
     97                     NULL, psStatsOptionFromString(stat)); \
    9798}
    9899
     
    106107    psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest
    107108    if (value && strlen(value) > 0) {
    108         return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value);
     109        return psMetadataAddStr(target, PS_LIST_TAIL, mdName, PS_META_REPLACE, NULL, value);
    109110    }
    110111    return false;
     
    128129        }
    129130    }
    130     return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value);
     131    return psMetadataAddStr(target, PS_LIST_TAIL, mdName, PS_META_REPLACE, NULL, value);
    131132}
    132133
     
    142143    psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Statistics file", NULL);
    143144    psMetadataAddS32(arguments, PS_LIST_TAIL, "-iter", 0, "Number of rejection iterations", 0);
    144     psMetadataAddF32(arguments, PS_LIST_TAIL, "-combine-rej", 0, "Combination rejection thresold (sigma)", NAN);
     145    psMetadataAddF32(arguments, PS_LIST_TAIL, "-combine-rej", 0,
     146                     "Combination rejection thresold (sigma)", NAN);
    145147    psMetadataAddU8(arguments,  PS_LIST_TAIL, "-mask-bad", 0, "Mask value for bad pixels", 0);
    146148    psMetadataAddU8(arguments,  PS_LIST_TAIL, "-mask-blank", 0, "Mask value for blank region", 0);
    147149    psMetadataAddF32(arguments, PS_LIST_TAIL, "-threshold-mask", 0, "Threshold for mask deconvolution", NAN);
    148     psMetadataAddF32(arguments, PS_LIST_TAIL, "-image-rej", 0, "Pixel rejection fraction threshold for rejecting entire image", NAN);
     150    psMetadataAddF32(arguments, PS_LIST_TAIL, "-image-rej", 0,
     151                     "Pixel rejection fraction threshold for rejecting entire image", NAN);
    149152    psMetadataAddS32(arguments, PS_LIST_TAIL, "-rows", 0, "Rows to read at once", 0);
    150153    psMetadataAddBool(arguments, PS_LIST_TAIL, "-photometry", 0, "Do photometry on stacked image?", false);
    151     psMetadataAddS32(arguments, PS_LIST_TAIL, "-psf-instances", 0, "Number of instances for PSF generation", 0);
     154    psMetadataAddS32(arguments, PS_LIST_TAIL, "-psf-instances", 0,
     155                     "Number of instances for PSF generation", 0);
    152156    psMetadataAddF32(arguments, PS_LIST_TAIL, "-psf-radius", 0, "Radius for PSF generation", NAN);
    153     psMetadataAddStr(arguments, PS_LIST_TAIL, "-psf-model", 0, "Model name for PSF generation", "PS_MODEL_RGAUSS");
     157    psMetadataAddStr(arguments, PS_LIST_TAIL, "-psf-model", 0, "Model name for PSF generation", NULL);
    154158    psMetadataAddS32(arguments, PS_LIST_TAIL, "-psf-order", 0, "Spatial order for PSF generation", 0);
    155159    psMetadataAddBool(arguments, PS_LIST_TAIL, "-variance", 0, "Use variance for rejection?", false);
    156     psMetadataAddBool(arguments, PS_LIST_TAIL, "-safe", 0, "Play safe with small numbers of pixels to combine?", false);
     160    psMetadataAddBool(arguments, PS_LIST_TAIL, "-safe", 0,
     161                      "Play safe with small numbers of pixels to combine?", false);
    157162    psMetadataAddF32(arguments, PS_LIST_TAIL, "-source-radius", 0, "Source exclusion radius", NAN);
    158163    psMetadataAddS32(arguments, PS_LIST_TAIL, "-source-iter", 0, "Source clipping iterations", 0);
     
    160165    psMetadataAddS32(arguments, PS_LIST_TAIL, "-source-min", 0, "Source minimum overlap", 0);
    161166    psMetadataAddBool(arguments, PS_LIST_TAIL, "-renorm", 0, "Renormalise variance maps?", false);
    162     psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-mean", 0, "Statistic for mean in renormalisation", NULL);
    163     psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-stdev", 0, "Statistic for stdev in renormalisation", NULL);
     167    psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-mean", 0,
     168                     "Statistic for mean in renormalisation", NULL);
     169    psMetadataAddStr(arguments, PS_LIST_TAIL, "-renorm-stdev", 0,
     170                     "Statistic for stdev in renormalisation", NULL);
    164171    psMetadataAddS32(arguments, PS_LIST_TAIL, "-renorm-width", 0, "Width of renormalisation boxes", 0);
    165172    psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-image", 0, "Suffix for temporary images", NULL);
    166173    psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-mask", 0, "Suffix for temporary masks", NULL);
    167174    psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-weight", 0, "Suffix for temporary weight maps", NULL);
    168     psMetadataAddBool(arguments, PS_LIST_TAIL, "-temp-delete", 0, "Delete temporary files on completion?", false);
     175    psMetadataAddBool(arguments, PS_LIST_TAIL, "-temp-delete", 0,
     176                      "Delete temporary files on completion?", false);
    169177
    170178    if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 3) {
     
    173181
    174182    const char *stampsName = psMetadataLookupStr(NULL, arguments, "-stamps"); // Name of stamps file
    175     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "STAMPS", 0, "Stamps file", stampsName);
    176     // if (!stampsName && !psMetadataLookupPtr(&mdok, config->arguments, "PPSTACK.SOURCES")) {
    177     // psError(PS_ERR_BAD_PARAMETER_VALUE, true, "One of -sources or -stamps must be specified.");
    178     //goto ERROR;
    179     // }
     183    psMetadataAddStr(arguments, PS_LIST_TAIL, "STAMPS", 0, "Stamps file", stampsName);
    180184
    181185    unsigned int numBad = 0;                     // Number of bad lines
     
    185189        return false;
    186190    }
    187     psMetadataAddMetadata(config->arguments, PS_LIST_TAIL, "INPUTS", 0,
    188                           "Metadata with input details", inputs);
     191    psMetadataAddMetadata(arguments, PS_LIST_TAIL, "INPUTS", 0, "Metadata with input details", inputs);
    189192    psFree(inputs);
    190     psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0,
    191                      "Root name of the output image list", argv[2]);
    192 
    193     valueArgStr(arguments, "-stats", "STATS", config->arguments);
    194 
    195     if (psMetadataLookupBool(NULL, arguments, "-photometry")) {
    196         psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE,
    197                           "Do photometry on stacked image?", true);
    198     }
     193    psMetadataAddStr(arguments, PS_LIST_TAIL, "OUTPUT", 0, "Root name of the output image list", argv[2]);
     194
     195    valueArgStr(arguments, "-stats", "STATS", arguments);
     196
     197    psMetadataAddBool(arguments, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE,
     198                      "Do photometry on stacked image?",
     199                      psMetadataLookupBool(NULL, arguments, "-photometry"));
    199200
    200201    return true;
     
    207208    psMetadata *arguments = config->arguments; // Command-line arguments
    208209
    209     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // Recipe for ppSim
     210    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // Recipe
    210211    if (!recipe) {
    211212        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSTACK_RECIPE);
     
    229230    VALUE_ARG_RECIPE_FLOAT("-psf-radius",  "PSF.RADIUS",    F32);
    230231    VALUE_ARG_RECIPE_INT("-psf-order",     "PSF.ORDER",     S32, 0);
    231     valueArgStr(arguments, "-psf-model", "PSF.MODEL", config->arguments);
     232    valueArgRecipeStr(arguments, recipe, "-psf-model", "PSF.MODEL", recipe);
    232233
    233234    if (psMetadataLookupBool(NULL, arguments, "-photometry") ||
    234235        psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {
    235         psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE,
     236        psMetadataAddBool(arguments, PS_LIST_TAIL, "PHOTOMETRY", PS_META_REPLACE,
    236237                          "Do photometry on stacked image?", true);
    237238    }
     
    239240    if (psMetadataLookupBool(NULL, arguments, "-variance") ||
    240241        psMetadataLookupBool(NULL, recipe, "VARIANCE")) {
    241         psMetadataAddBool(config->arguments, PS_LIST_TAIL, "VARIANCE", 0,
    242                           "Use variance for rejection?", true);
     242        psMetadataAddBool(arguments, PS_LIST_TAIL, "VARIANCE", 0, "Use variance for rejection?", true);
    243243    }
    244244
    245245    if (psMetadataLookupBool(NULL, arguments, "-safe") ||
    246246        psMetadataLookupBool(NULL, recipe, "SAFE")) {
    247         psMetadataAddBool(config->arguments, PS_LIST_TAIL, "SAFE", 0,
     247        psMetadataAddBool(arguments, PS_LIST_TAIL, "SAFE", 0,
    248248                          "Play safe with small number of pixels to combine?", true);
    249249    }
     
    251251    if (psMetadataLookupBool(NULL, arguments, "-renorm") ||
    252252        psMetadataLookupBool(NULL, recipe, "RENORM")) {
    253         psMetadataAddBool(config->arguments, PS_LIST_TAIL, "RENORM", 0, "Renormalise variance maps?", true);
     253        psMetadataAddBool(arguments, PS_LIST_TAIL, "RENORM", 0, "Renormalise variance maps?", true);
    254254    }
    255255    VALUE_ARG_RECIPE_INT("-renorm-width", "RENORM.WIDTH", S32, 0);
     
    257257    VALUE_ARG_RECIPE_STAT("-renorm-stdev", "RENORM.STDEV");
    258258
    259     valueArgRecipeStr(arguments, recipe, "-temp-image",  "TEMP.IMAGE",  config->arguments);
    260     valueArgRecipeStr(arguments, recipe, "-temp-mask",   "TEMP.MASK",   config->arguments);
    261     valueArgRecipeStr(arguments, recipe, "-temp-weight", "TEMP.WEIGHT", config->arguments);
     259    valueArgRecipeStr(arguments, recipe, "-temp-image",  "TEMP.IMAGE",  recipe);
     260    valueArgRecipeStr(arguments, recipe, "-temp-mask",   "TEMP.MASK",   recipe);
     261    valueArgRecipeStr(arguments, recipe, "-temp-weight", "TEMP.WEIGHT", recipe);
    262262
    263263    if (psMetadataLookupBool(NULL, arguments, "-temp-delete") ||
    264264        psMetadataLookupBool(NULL, recipe, "TEMP.DELETE")) {
    265         psMetadataAddBool(config->arguments, PS_LIST_TAIL, "TEMP.DELETE", 0,
     265        psMetadataAddBool(arguments, PS_LIST_TAIL, "TEMP.DELETE", 0,
    266266                          "Delete temporary files on completion?", true);
    267267    }
    268268
    269     psTrace("ppStack", 1, "Done reading command-line arguments\n");
     269    psTrace("ppStack", 1, "Done parsing arguments\n");
     270
     271    // Dump configuration, now that's it's settled
     272    {
     273        pmConfigCamerasCull(config);
     274        pmConfigRecipesCull(config, "PPSTACK,PPSUB,PPSTATS,PSPHOT,MASKS");
     275
     276        const char *outroot = psMetadataLookupStr(NULL, arguments, "OUTPUT"); // Output root name
     277        psAssert(outroot, "Should be there, we put it there!");
     278
     279        pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSTACK.INPUT"); // Input file
     280        pmConfigDump(config, input->fpa, outroot);
     281    }
     282
    270283    return true;
    271284
Note: See TracChangeset for help on using the changeset viewer.