Changeset 10427
- Timestamp:
- Dec 3, 2006, 4:18:18 PM (20 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 2 edited
-
psphotArguments.c (modified) (3 diffs)
-
psphotParseCamera.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotArguments.c
r10167 r10427 13 13 14 14 // load config data from default locations 15 pmConfig *config = pmConfigRead(&argc, argv );15 pmConfig *config = pmConfigRead(&argc, argv, "PSPHOT"); 16 16 if (config == NULL) { 17 17 psError(PSPHOT_ERR_CONFIG, false, "Can't read site configuration"); … … 19 19 } 20 20 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 24 23 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 } 26 41 27 42 // run the test model (requires X,Y coordinate) … … 83 98 } 84 99 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) 122 101 psFree (options); 102 psFree (recipes); 123 103 124 104 // the input file is a required argument; if not found, we will exit -
trunk/psphot/src/psphotParseCamera.c
r10393 r10427 14 14 15 15 // 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"); 19 17 20 18 // set default recipe values here 19 // XXX drop this? we put this in the default recipe? 21 20 psMetadataAddStr (recipe, PS_LIST_TAIL, "FITMODE", PS_META_NO_REPLACE, "default fitting mode", "NONE"); 22 21 psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE", PS_META_NO_REPLACE, "default photcode", "NONE"); … … 75 74 76 75 // 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? 77 77 char *chipLine = psMetadataLookupStr(&status, config->arguments, "CHIP_SELECTIONS"); 78 78 psArray *chips = psStringSplitArray (chipLine, ",", false);
Note:
See TracChangeset
for help on using the changeset viewer.
