Changeset 18924 for trunk/pswarp/src/pswarpArguments.c
- Timestamp:
- Aug 5, 2008, 2:39:59 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpArguments.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpArguments.c
r18839 r18924 44 44 if ((N = psArgumentGet(argc, argv, "-threads"))) { 45 45 psArgumentRemove(N, &argc, argv); 46 int nThreads = atoi(argv[N]);46 int nThreads = atoi(argv[N]); 47 47 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NTHREADS", 0, "number of warp threads", nThreads); 48 48 psArgumentRemove(N, &argc, argv); 49 49 50 // create the thread pool with number of desired threads, supplying our thread launcher function51 // XXX need to determine the number of threads from the config data52 psThreadPoolInit (nThreads);50 // create the thread pool with number of desired threads, supplying our thread launcher function 51 // XXX need to determine the number of threads from the config data 52 psThreadPoolInit (nThreads); 53 53 } 54 54 pswarpSetThreads (); … … 94 94 { 95 95 // Select the appropriate recipe 96 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);96 psMetadata *recipe = psMetadataLookupPtr(NULL, config->recipes, PSWARP_RECIPE); 97 97 if (!recipe) { 98 98 psError(PSWARP_ERR_CONFIG, true, "Can't find %s recipe!\n", PSWARP_RECIPE); … … 102 102 // Get grid size 103 103 bool status; // Status of MD lookup 104 int nGridX = psMetadataLookupS32 (&status, recipe, "GRID.NX"); 105 if (!status) nGridX = 128; 106 int nGridY = psMetadataLookupS32 (&status, recipe, "GRID.NY"); 107 if (!status) nGridY = 128; 104 int nGridX = psMetadataLookupS32(&status, recipe, "GRID.NX"); 105 if (!status || nGridX <= 0) { 106 nGridX = 128; 107 psWarning("GRID.NX is not set in the recipe --- defaulting to %d", nGridX); 108 } 109 int nGridY = psMetadataLookupS32(&status, recipe, "GRID.NY"); 110 if (!status) { 111 nGridY = 128; 112 psWarning("GRID.NY is not set in the recipe --- defaulting to %d", nGridY); 113 } 108 114 109 115 // Get interpolation mode 110 psImageInterpolateMode interpolationMode; // Mode for interpolation111 116 const char *name = psMetadataLookupStr (&status, recipe, "INTERPOLATION.MODE"); // Name of interp mode 112 117 if (!name) { 118 name = "BILINEAR"; 119 psLogMsg("pswarp", 3, "defaulting to %s interpolation", name); 120 } 121 psImageInterpolateMode interpolationMode = psImageInterpolateModeFromString(name); // Mode for interp. 122 if (interpolationMode == PS_INTERPOLATE_NONE) { 113 123 interpolationMode = PS_INTERPOLATE_BILINEAR; 114 psLogMsg ("pswarp", 3, "defaulting to bilinear interpolation\n"); 115 } else { 116 interpolationMode = psImageInterpolateModeFromString (name); 117 if (interpolationMode == PS_INTERPOLATE_NONE) { 118 interpolationMode = PS_INTERPOLATE_BILINEAR; 119 psLogMsg ("pswarp", 3, 120 "Unknown interpolation mode %s, defaulting to bilinear interpolation\n", name); 121 } 124 psLogMsg ("pswarp", 3, 125 "Unknown interpolation mode %s, defaulting to bilinear interpolation\n", name); 126 name = "BILINEAR"; 122 127 } 123 128 … … 134 139 } 135 140 141 // Set recipe values in the recipe (since we've possibly altered some) 142 psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE, 143 "Iso-astrom grid spacing in x", nGridX); 144 psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NY", PS_META_REPLACE, 145 "Iso-astrom grid spacing in y", nGridY); 146 psMetadataAddStr(recipe, PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, 147 "Interpolation mode", name); 148 psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE, 149 "Fraction of bad flux for a pixel to be marked as poor", poorFrac); 150 psMetadataAddF32(recipe, PS_LIST_TAIL, "ACCEPT.FRAC", PS_META_REPLACE, 151 "Minimum fraction of good pixels for result to be accepted", acceptFrac); 152 136 153 // Set recipe values in the arguments 137 154 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0, … … 147 164 148 165 psTrace("pswarp", 1, "Done with pswarpArguments...\n"); 166 167 // Dump configuration, now that's it's settled 168 { 169 pmConfigCamerasCull(config); 170 pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS"); 171 172 const char *outroot = psMetadataLookupStr(NULL, config->arguments, "OUTPUT"); // Output root name 173 psAssert(outroot, "Should be there, we put it there!"); 174 175 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file 176 pmConfigDump(config, input->fpa, outroot); 177 } 178 149 179 return (config); 150 180 }
Note:
See TracChangeset
for help on using the changeset viewer.
