IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10427


Ignore:
Timestamp:
Dec 3, 2006, 4:18:18 PM (20 years ago)
Author:
eugene
Message:

update to use new inherited config files

Location:
trunk/psphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotArguments.c

    r10167 r10427  
    1313
    1414    // load config data from default locations
    15     pmConfig *config = pmConfigRead(&argc, argv);
     15    pmConfig *config = pmConfigRead(&argc, argv, "PSPHOT");
    1616    if (config == NULL) {
    1717        psError(PSPHOT_ERR_CONFIG, false, "Can't read site configuration");
     
    1919    }
    2020
    21     // save the recipe options separately until we have loaded the recipe (psphotParseDetrend)
    22     psMetadata *options = psMetadataAlloc ();
    23     psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "PSPHOT.OPTIONS",  PS_DATA_METADATA, "", options);
     21    // save the following additional recipe values based on command-line options
     22    // these options override the PSPHOT recipe values loaded from recipe files
    2423
    25     // the following options override the PSPHOT recipe options
     24    // if the recipe is already defined in config->arguments, supplement
     25    // save the recipe options onto config->arguments:RECIPES
     26    psMetadata *recipes = psMetadataLookupMetadata(NULL, config->arguments, "RECIPES");
     27    if (!recipes) {
     28        recipes = psMetadataAlloc ();
     29        psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "RECIPES",  PS_DATA_METADATA, "", recipes);
     30    } else {
     31        psMemIncrRefCounter (recipes); // so we can free options below if not allocated here
     32    }
     33    // look for the recipe defined in recipes
     34    psMetadata *options = psMetadataLookupMetadata(NULL, recipes, "PSPHOT");
     35    if (!options) {
     36        options = psMetadataAlloc ();
     37        psMetadataAddPtr (recipes, PS_LIST_TAIL, "PSPHOT",  PS_DATA_METADATA, "", options);
     38    } else {
     39        psMemIncrRefCounter (options); // so we can free options below if not allocated here
     40    }
    2641
    2742    // run the test model (requires X,Y coordinate)
     
    8398    }
    8499
    85     // other arbitrary recipe values: -D key value (all added as string)
    86     while ((N = psArgumentGet (argc, argv, "-D"))) {
    87         psArgumentRemove (N, &argc, argv);
    88         psMetadataAddStr (options, PS_LIST_TAIL, argv[N], 0, "", argv[N+1]);
    89         psArgumentRemove (N, &argc, argv);
    90         psArgumentRemove (N, &argc, argv);
    91     }
    92 
    93     // other arbitrary recipe values: -Df key value (all added as float)
    94     while ((N = psArgumentGet (argc, argv, "-Db"))) {
    95         psArgumentRemove (N, &argc, argv);
    96         if (!strcasecmp (argv[N+1], "true")) {
    97             psMetadataAddBool (options, PS_LIST_TAIL, argv[N], 0, "", true);
    98         } else {
    99             psMetadataAddBool (options, PS_LIST_TAIL, argv[N], 0, "", false);
    100         }
    101         psArgumentRemove (N, &argc, argv);
    102         psArgumentRemove (N, &argc, argv);
    103     }
    104 
    105     // other arbitrary recipe values: -Df key value (all added as float)
    106     while ((N = psArgumentGet (argc, argv, "-Df"))) {
    107         psArgumentRemove (N, &argc, argv);
    108         psMetadataAddF32 (options, PS_LIST_TAIL, argv[N], 0, "", atof(argv[N+1]));
    109         psArgumentRemove (N, &argc, argv);
    110         psArgumentRemove (N, &argc, argv);
    111     }
    112 
    113     // other arbitrary recipe values: -Di key value (all added as int)
    114     while ((N = psArgumentGet (argc, argv, "-Di"))) {
    115         psArgumentRemove (N, &argc, argv);
    116         psMetadataAddS32 (options, PS_LIST_TAIL, argv[N], 0, "", atoi(argv[N+1]));
    117         psArgumentRemove (N, &argc, argv);
    118         psArgumentRemove (N, &argc, argv);
    119     }
    120 
    121     // drop the local view on the options (saved on config->arguments)
     100    // drop the local view on the options (saved in config->arguments)
    122101    psFree (options);
     102    psFree (recipes);
    123103
    124104    // the input file is a required argument; if not found, we will exit
  • trunk/psphot/src/psphotParseCamera.c

    r10393 r10427  
    1414
    1515    // select recipe options supplied on command line
    16     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes,   "PSPHOT");
    17     psMetadata *options = psMetadataLookupPtr (&status, config->arguments, "PSPHOT.OPTIONS");
    18     psMetadataCopy (recipe, options);
     16    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, "PSPHOT");
    1917
    2018    // set default recipe values here
     19    // XXX drop this?  we put this in the default recipe?
    2120    psMetadataAddStr (recipe, PS_LIST_TAIL, "FITMODE",         PS_META_NO_REPLACE, "default fitting mode", "NONE");
    2221    psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE",        PS_META_NO_REPLACE, "default photcode",     "NONE");
     
    7574
    7675    // Chip selection: turn on only the chips specified (pass status to suppress missing-key log msg)
     76    // XXX why not put this in the recipe?
    7777    char *chipLine = psMetadataLookupStr(&status, config->arguments, "CHIP_SELECTIONS");
    7878    psArray *chips = psStringSplitArray (chipLine, ",", false);
Note: See TracChangeset for help on using the changeset viewer.