Changeset 14891 for trunk/pswarp/src/pswarpLoop.c
- Timestamp:
- Sep 19, 2007, 12:02:37 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpLoop.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpLoop.c
r14874 r14891 3 3 4 4 #define WCS_NONLIN_TOL 0.001 // Non-linear tolerance for header WCS 5 6 // Lists of file rules for the detectors and skycells, and an independent list of everything else 7 // Lists must end with a NULL 8 static char *detectorFiles[] = { "PSWARP.INPUT", "PSWARP.MASK", "PSWARP.WEIGHT", NULL }; 9 static char *skycellFiles[] = { "PSWARP.OUTPUT", "PSWARP.OUTPUT.MASK", "PSWARP.OUTPUT.WEIGHT", 10 "PSPHOT.OUTPUT", "PSPHOT.BACKMDL", "PSPHOT.BACKMDL.STDEV", "PSPHOT.BACKGND", 11 "PSPHOT.BACKSUB", "PSPHOT.PSF.SAVE", "SOURCE.PLOT.MOMENTS", 12 "SOURCE.PLOT.PSFMODEL", "SOURCE.PLOT.APRESID", NULL }; 13 static char *independentFiles[] = { "PSWARP.ASTROM", // Read independently from the input pixels 14 "PSWARP.SKYCELL", // Don't care about the skycell once we have its WCS 15 "PSPHOT.INPUT", // This is just a pointer to PSWARP.OUTPUT 16 "PSWARP.OUTPUT.SOURCES", // Save these independently so we can do the PSF 17 NULL }; 18 19 // Activate a list of files 20 static void fileActivation(pmConfig *config, // Configuration 21 char **files, // Files to turn on/off 22 bool state // Activation state 23 ) 24 { 25 for (int i = 0; files[i] != NULL; i++) { 26 pmFPAfileActivate(config->files, state, files[i]); 27 } 28 return; 29 } 30 5 31 6 32 // Loop over the inputs, warp them to the output skycell and then write out the output. … … 57 83 } 58 84 85 // Turn all skycell files on to generate them, and then turn them off for the loop over the input images 86 // the input, which is in a different format. 87 { 88 fileActivation(config, detectorFiles, false); 89 fileActivation(config, independentFiles, false); 90 fileActivation(config, skycellFiles, true); 91 92 pmFPAview *view = pmFPAviewAlloc(0); 93 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE); 94 // They should all be defined at the FPA level, so that should be enough 95 psFree(view); 96 97 fileActivation(config, skycellFiles, false); 98 } 99 100 59 101 // Read the input astrometry 60 102 { 61 pmFPAfileActivate(config->files, false, "PSWARP.INPUT");62 pmFPAfileActivate(config->files, false, "PSWARP.MASK");63 pmFPAfileActivate(config->files, false, "PSWARP.WEIGHT");64 103 pmFPAfileActivate(config->files, true, "PSWARP.ASTROM"); 65 pmFPAfileActivate(config->files, false, "PSWARP.OUTPUT"); 66 pmFPAfileActivate(config->files, false, "PSWARP.OUTPUT.MASK"); 67 pmFPAfileActivate(config->files, false, "PSWARP.OUTPUT.WEIGHT"); 68 pmFPAfileActivate(config->files, false, "PSWARP.OUTPUT.SOURCES"); 69 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE); 104 70 105 pmChip *chip; 71 106 pmFPAview *view = pmFPAviewAlloc(0); 107 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE); 72 108 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 73 109 psTrace ("pswarp", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); … … 83 119 psFree(view); 84 120 85 pmFPAfileActivate(config->files, true, "PSWARP.INPUT"); 86 pmFPAfileActivate(config->files, true, "PSWARP.MASK"); 87 pmFPAfileActivate(config->files, true, "PSWARP.WEIGHT"); 121 fileActivation(config, detectorFiles, true); 88 122 pmFPAfileActivate(config->files, false, "PSWARP.ASTROM"); 89 pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT");90 pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT.MASK"); 91 pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT.WEIGHT");92 pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT.SOURCES");93 } 94 123 } 124 125 // Turn on the source output --- we need to get rid of these so that we can measure the PSF 126 pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT.SOURCES"); 127 128 // Don't care about the skycell anymore --- we've read it, and that's all we need to do. 95 129 pmFPAfileActivate(config->files, false, "PSWARP.SKYCELL"); 96 130 view = pmFPAviewAlloc(0); … … 198 232 } 199 233 234 pmFPAfileIOChecks(config, view, PM_FPA_AFTER); 235 236 // Done with the detector side of things 237 fileActivation(config, detectorFiles, false); 238 fileActivation(config, independentFiles, false); 239 fileActivation(config, skycellFiles, true); 240 200 241 // We need a new PSF model for the warped frame 201 242 // It would be good to generate this analytically, but that's going to be tricky. … … 214 255 "Break point for psphot operations", "PSFMODEL"); 215 256 257 // Get rid of the transformed sources so that we can measure the PSF 258 psMetadataRemoveKey(output->analysis, "PSPHOT.SOURCES"); 259 260 #if 0 216 261 pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT"); 217 262 pmFPACopy(photFile->fpa, outFPA); 263 #endif 218 264 219 265 pmFPAview *view = pmFPAviewAlloc(0); // View into skycell 266 view->chip = view->cell = view->readout = 0; 220 267 if (!psphotReadout(config, view)) { 221 268 psError(psErrorCodeLast(), false, "Unable to determine PSF for warped image.\n"); … … 225 272 psFree(view); 226 273 227 pmFPAfileActivate(config->files, false, "PSPHOT.INPUT"); 274 pmFPAfileActivate(config->files, true, "PSPHOT.INPUT"); 275 pmFPAfileActivate(config->files, true, "PSPHOT.PSF.SAVE"); 228 276 } 229 277 … … 264 312 psFree(headerName); 265 313 266 pmFPAfileIOChecks (config, view, PM_FPA_AFTER); 267 psFree (view); 314 // Ensure everything is written out, at every level 315 view->chip = view->cell = view->readout = 0; 316 pmFPAfileIOChecks(config, view, PM_FPA_AFTER); 317 view->readout = -1; 318 pmFPAfileIOChecks(config, view, PM_FPA_AFTER); 319 view->cell = -1; 320 pmFPAfileIOChecks(config, view, PM_FPA_AFTER); 321 view->chip = -1; 322 pmFPAfileIOChecks(config, view, PM_FPA_AFTER); 323 psFree(view); 324 // Now done with the skycell side of things 268 325 269 326 // Write out summary statistics
Note:
See TracChangeset
for help on using the changeset viewer.
