Changeset 25027 for branches/pap/magic/remove/src/streaksrelease.c
- Timestamp:
- Aug 7, 2009, 4:08:25 PM (17 years ago)
- Location:
- branches/pap
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
magic (modified) (1 prop)
-
magic/remove/src (modified) (1 prop)
-
magic/remove/src/streaksrelease.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/magic
-
Property svn:ignore
set to
magic
ssa-core-cpp
Makefile
Makefile.bak
-
Property svn:ignore
set to
-
branches/pap/magic/remove/src
- Property svn:ignore
-
old new 1 isdestreaked 1 2 streaksremove 2 3 streaksreplace 3 4 streakscompare 4 5 streaksrelease 6 makefile
-
- Property svn:ignore
-
branches/pap/magic/remove/src/streaksrelease.c
r23257 r25027 23 23 } 24 24 25 psMetadata *masks = psMetadataLookupMetadata(&status, config->recipes, "MASKS"); 26 if (!status) { 27 psError(PM_ERR_CONFIG, false, "failed to lookup MASKS in recipes\n"); 28 return PS_EXIT_CONFIG_ERROR; 29 } 30 psU8 poorWarp = (double) psMetadataLookupU8(&status, masks, "POOR.WARP"); 31 if (!status) { 32 psError(PM_ERR_CONFIG, false, "failed to lookup mask value for POOR.WARP in recipes\n"); 33 return PS_EXIT_CONFIG_ERROR; 34 } 35 // we're setting pixels with any mask bits execpt POOR.WARP to NAN 36 psU8 maskMask = ~poorWarp; 25 // Values to set for masked pixels 26 psU32 maskStreak = 0; // for the image and weight (usually NAN, MAXINT for integer images) 27 psU32 maskMask = 0; // value looked up for MASK.STREAK 37 28 38 29 // Does true work here? 39 streakFiles *sfiles = openFiles(config, true );30 streakFiles *sfiles = openFiles(config, true, argv[0]); 40 31 41 32 if (sfiles->stage == IPP_STAGE_RAW) { … … 64 55 } 65 56 57 // now that we've read the input files, lookup the mask values that we read 58 if (maskStreak == 0) { 59 strkGetMaskValues(sfiles, &maskStreak, &maskMask); 60 } 61 66 62 setMaskedToNAN(sfiles, maskMask, true); 67 63 … … 71 67 printf("time to process component %d: %f\n", sfiles->extnum, psTimerClear("PROCESS_COMPONENT")); 72 68 } while (streakFilesNextExtension(sfiles)); 69 70 // check the weight and mask files for extra extensions that might be in files 71 // (covariance matrix for example) 72 copyExtraExtensions(sfiles); 73 74 73 75 74 76 psTimerStart("CLOSE_IMAGES"); … … 77 79 printf("time to close images: %f\n", psTimerClear("CLOSE_IMAGES")); 78 80 79 #ifdef NOTYET80 if (!replicateOutputs(sfiles)) {81 psError(PS_ERR_UNKNOWN, false, "failed to replicate output files");82 psErrorStackPrint(stderr, "");83 exit(PS_EXIT_UNKNOWN_ERROR);84 }85 86 if (psMetadataLookupBool(&status, config->arguments, "REPLACE")) {87 // swap the instances for the input and output88 // Note this is a database operation. No file I/O is performed89 if (!swapOutputsToInputs(sfiles)) {90 psError(PS_ERR_UNKNOWN, false, "failed to swap files");91 92 // XXX: Now what? I guess swapOutputsToInputs will need to undo anything that93 // it has done and give a detailed report of what happened94 95 psErrorStackPrint(stderr, "");96 exit(PS_EXIT_UNKNOWN_ERROR);97 }98 99 if (psMetadataLookupBool(&status, config->arguments, "REMOVE")) {100 // delete the temporary storage objects (which now points to the original image(s)101 if (!deleteTemps(sfiles)) {102 psError(PS_ERR_UNKNOWN, false, "failed to delete temporary files");103 // XXX: Now what? At this point the output files have been swapped, so we can't104 // repeat the operation.105 106 // Returning error status here is problematic. The inputs have been streak removed107 // but they're still lying around108 // Maybe just print an error message and109 // let other system tools clean up110 psErrorStackPrint(stderr, "");111 exit(PS_EXIT_UNKNOWN_ERROR);112 }113 }114 }115 #endif // REPLACE, REMOVE116 81 printf("time to run streaksrelease: %f\n", psTimerClear("STREAKSREMOVE")); 117 82 … … 275 240 276 241 // set up the compression parameters 277 #ifdef STREAKS_COMPRESS_OUTPUT 278 // compression of the image pixels is disabled for now. Some consortium members 279 // have problems reading them 280 copyFitsOptions(sf->outImage, sf->recImage, sf->inImage); 281 282 // XXX: TODO: can we derive these values from the input header? 283 // psFitsCompressionGet(sf->inImage->image) gives compression none 284 // perhaps we should just use the definition of COMP_IMG in the configuration 285 psFitsSetCompression(sf->outImage->fits, PS_FITS_COMPRESS_RICE, sf->tiles, 8, 0, 0); 286 if (sf->recImage) { 287 psFitsSetCompression(sf->recImage->fits, PS_FITS_COMPRESS_RICE, sf->tiles, 8, 0, 0); 288 } 289 #endif 242 copyFitsOptions(sf->outImage, sf->recImage, sf->inImage, sf->tiles); 290 243 291 244 if (sf->inMask) { … … 306 259 } 307 260 308 #ifdef STREAKS_COMPRESS_OUTPUT 309 // XXX: see note above 310 copyFitsOptions(sf->outMask, sf->recMask, sf->inMask); 311 psFitsSetCompression(sf->outMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0); 312 if (sf->recMask) { 313 psFitsSetCompression(sf->recMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0); 314 } 261 copyFitsOptions(sf->outMask, sf->recMask, sf->inMask, sf->tiles); 315 262 if (sf->outChMask) { 316 copyFitsOptions(sf->outChMask, sf->recChMask, sf->inMask); 317 psFitsSetCompression(sf->outChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0); 318 if (sf->recChMask) { 319 psFitsSetCompression(sf->recChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0); 320 } 321 } 322 #endif 263 copyFitsOptions(sf->outChMask, sf->recChMask, sf->inMask, sf->tiles); 264 } 323 265 } 324 266 } … … 332 274 setupImageRefs(sf->outWeight, sf->recWeight, sf->inWeight, sf->extnum, exciseAll); 333 275 334 #ifdef STREAKS_COMPRESS_OUTPUT 335 copyFitsOptions(sf->outWeight, sf->recWeight, sf->inWeight); 336 // XXX: see note above 337 psFitsSetCompression(sf->outWeight->fits, PS_FITS_COMPRESS_RICE, sf->tiles, 8, 0, 0); 338 if (sf->recWeight) { 339 psFitsSetCompression(sf->recWeight->fits, PS_FITS_COMPRESS_RICE, sf->tiles, 8, 0, 0); 340 } 341 #endif 276 copyFitsOptions(sf->outWeight, sf->recWeight, sf->inWeight, sf->tiles); 342 277 } 343 278 // and for raw images, create sub images that represent the actual image
Note:
See TracChangeset
for help on using the changeset viewer.
