Changeset 18924
- Timestamp:
- Aug 5, 2008, 2:39:59 PM (18 years ago)
- Location:
- trunk/pswarp/src
- Files:
-
- 4 edited
-
pswarp.c (modified) (5 diffs)
-
pswarpArguments.c (modified) (5 diffs)
-
pswarpLoop.c (modified) (2 diffs)
-
pswarpParseCamera.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarp.c
r17781 r18924 2 2 3 3 static void usage (void) { 4 fprintf (stderr, "USAGE: pswarp [-file image(s)] [-list imagelist] [options] (output) (skycell)\n");5 fprintf (stderr, " options:\n");6 fprintf (stderr, " [-astrom astrom.cmp] : provide an alternative astrometry calibration\n");7 fprintf (stderr, " [-mask mask.fits] : provide a corresponding mask image\n");8 fprintf (stderr, " [-weight weight.fits] : provide a corresponding weight image (pixel varience)\n");4 fprintf(stderr, "USAGE: pswarp [-file image(s)] [-list imagelist] [options] (output) (skycell)\n"); 5 fprintf(stderr, " options:\n"); 6 fprintf(stderr, " [-astrom astrom.cmp] : provide an alternative astrometry calibration\n"); 7 fprintf(stderr, " [-mask mask.fits] : provide a corresponding mask image\n"); 8 fprintf(stderr, " [-weight weight.fits] : provide a corresponding weight image (pixel varience)\n"); 9 9 psErrorStackPrint(stderr, "\n"); 10 10 exit (2); … … 24 24 if (!config) usage(); 25 25 26 if (!pswarpOptions(config)) {27 psErrorStackPrint(stderr, "error parsing options\n");28 exit(1);29 }30 31 26 // load identify the data sources 32 27 if (!pswarpParseCamera(config)) { 33 28 psErrorStackPrint(stderr, "error setting up the camera\n"); 34 exit (1); 29 exit(PS_EXIT_CONFIG_ERROR); 30 } 31 32 if (!pswarpOptions(config)) { 33 psErrorStackPrint(stderr, "error parsing options\n"); 34 exit(PS_EXIT_SYS_ERROR); 35 35 } 36 36 … … 38 38 if (!pswarpDefine(config)) { 39 39 psErrorStackPrint(stderr, "error loading output definition\n"); 40 exit (1);40 exit(PS_EXIT_CONFIG_ERROR); 41 41 } 42 42 … … 44 44 if (!pswarpLoop(config)) { 45 45 psErrorStackPrint(stderr, "error warping data\n"); 46 exit (1);46 exit(PS_EXIT_DATA_ERROR); 47 47 } 48 48 … … 50 50 pswarpCleanup(config); 51 51 psLibFinalize(); 52 exit( EXIT_SUCCESS);52 exit(PS_EXIT_SUCCESS); 53 53 } -
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 } -
trunk/pswarp/src/pswarpLoop.c
r18839 r18924 64 64 bool pswarpLoop(pmConfig *config) 65 65 { 66 bool status; 66 bool status; 67 67 68 68 // load the recipe … … 74 74 75 75 // output mask bits 76 psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT"); 76 psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT"); 77 77 psAssert (status, "MASK.OUTPUT was not defined"); 78 78 -
trunk/pswarp/src/pswarpParseCamera.c
r18558 r18924 1 1 # include "pswarp.h" 2 2 3 bool pswarpParseCamera (pmConfig *config) {4 3 bool pswarpParseCamera(pmConfig *config) 4 { 5 5 bool status; 6 6 bool mdok; // Status of MD lookup … … 38 38 psLogMsg ("pswarp", 3, "no mask supplied\n"); 39 39 } 40 40 41 41 // loading the mask here should have invoked pmConfigMaskReadHeader() 42 42 if (!pswarpSetMaskBits (config)) {
Note:
See TracChangeset
for help on using the changeset viewer.
