Changeset 24951 for branches/czw_branch/cleanup/magic/remove/src
- Timestamp:
- Jul 30, 2009, 5:20:29 PM (17 years ago)
- Location:
- branches/czw_branch/cleanup
- Files:
-
- 10 edited
-
. (modified) (1 prop)
-
magic/remove/src (modified) (1 prop)
-
magic/remove/src/Makefile.simple (modified) (1 diff)
-
magic/remove/src/isdestreaked.c (modified) (3 diffs)
-
magic/remove/src/streaksastrom.c (modified) (1 diff)
-
magic/remove/src/streaksastrom.h (modified) (1 diff)
-
magic/remove/src/streaksio.c (modified) (4 diffs)
-
magic/remove/src/streaksio.h (modified) (1 diff)
-
magic/remove/src/streaksrelease.c (modified) (1 diff)
-
magic/remove/src/streaksremove.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/cleanup
- Property svn:mergeinfo changed
/trunk (added) merged: 24714-24742,24744-24784,24786-24798,24801-24824,24827-24834,24836-24859,24861-24901,24903-24912,24914-24939
- Property svn:mergeinfo changed
-
branches/czw_branch/cleanup/magic/remove/src
- Property svn:ignore
-
old new 1 isdestreaked 1 2 streaksremove 2 3 streaksreplace
-
- Property svn:ignore
-
branches/czw_branch/cleanup/magic/remove/src/Makefile.simple
r24556 r24951 37 37 STREAKSFLAGS=-DSTREAKS_COMPRESS_OUTPUT=1 38 38 OPTFLAGS= -g -O2 39 OPTFLAGS= -g39 #OPTFLAGS= -g 40 40 CFLAGS=`psmodules-config --cflags` -std=gnu99 ${OPTFLAGS} ${STREAKSFLAGS} 41 41 #CFLAGS=`psmodules-config --cflags` -std=gnu99 ${OPTFLAGS} -
branches/czw_branch/cleanup/magic/remove/src/isdestreaked.c
r24556 r24951 21 21 psErrorStackPrint(stderr, ""); 22 22 exit(PS_EXIT_DATA_ERROR); 23 return false;24 23 } 25 24 … … 28 27 psError(PS_ERR_IO, false, "failed to read header for: %s", fileName); 29 28 psErrorStackPrint(stderr, ""); 30 return false;29 exit(PS_EXIT_DATA_ERROR); 31 30 } 32 31 … … 34 33 bool isDestreaked = psMetadataLookupBool(&mdok, header, "PSDESTRK"); 35 34 if (mdok && isDestreaked) { 35 printf("%s is a destreaked file\n", fileName); 36 36 exit(0); 37 37 } else { 38 printf("%s is not a destreaked file\n", fileName); 38 39 exit(42); 39 40 } -
branches/czw_branch/cleanup/magic/remove/src/streaksastrom.c
r24382 r24951 377 377 } 378 378 379 void 379 bool 380 380 linearizeTransforms(strkAstrom *astrom) 381 381 { 382 382 if (!pmAstromLinearizeTransforms((pmFPA *) astrom->fpa, (pmChip *) astrom->chip)) { 383 streaksExit("linear fit to astrometry failed\n", PS_EXIT_UNKNOWN_ERROR); 384 } 385 } 383 // streaksExit("linear fit to astrometry failed\n", PS_EXIT_UNKNOWN_ERROR); 384 psError(PS_ERR_UNKNOWN, false, "linear fit to astrometry failed ignoring"); 385 return false; 386 } 387 return true; 388 } -
branches/czw_branch/cleanup/magic/remove/src/streaksastrom.h
r24382 r24951 30 30 extern bool skyToCell(strkPt *, strkAstrom *astrom, double ra, double dec); 31 31 extern bool cellToSky(strkPt *, strkAstrom *astrom, double x, double y); 32 extern voidlinearizeTransforms(strkAstrom *astrom);32 extern bool linearizeTransforms(strkAstrom *astrom); 33 33 34 34 extern bool SkyToLocal(strkPt *outPt, strkAstrom *astrom, double ra, double dec); -
branches/czw_branch/cleanup/magic/remove/src/streaksio.c
r24691 r24951 9 9 10 10 static nebServer *ourNebServer = NULL; 11 12 // Assumptions about the file structure of non-raw files 13 // The 'image' for each file (image, mask weight) is contained in the first 14 // extension. 15 11 16 12 17 // open the files required for streaks procesing. … … 66 71 // if we are passed a mask it is camera stage mask and we also 67 72 // need to destreak the chip level mask file as well 73 // If it doesn't exist, we didn't have a camera mask 68 74 if (remove && sf->inMask && (stage == IPP_STAGE_CHIP)) { 69 sf->inChMask = sFileOpen(config, stage, "INPUT.CHMASK", NULL, true); 70 inputBasename = basename(sf->inChMask->name); 71 sf->outChMask = sFileOpen(config, stage, "OUTPUT", inputBasename, true); 72 sf->recChMask = sFileOpen(config, stage, "RECOVERY", inputBasename, false); 75 sf->inChMask = sFileOpen(config, stage, "INPUT.CHMASK", NULL, false); 76 if (sf->inChMask) { 77 inputBasename = basename(sf->inChMask->name); 78 sf->outChMask = sFileOpen(config, stage, "OUTPUT", inputBasename, true); 79 sf->recChMask = sFileOpen(config, stage, "RECOVERY", inputBasename, false); 80 } 73 81 } 74 82 … … 282 290 // copy header from fpu 283 291 sfile->header = (psMetadata*) psMemIncrRefCounter(sfile->pmfile->fpa->hdu->header); 292 293 sfile->nHDU = psFitsGetSize(sfile->pmfile->fits); 284 294 285 295 return sfile; … … 1195 1205 *maskMask = ~convPoor; 1196 1206 } 1207 1208 static void 1209 doCopyExtraExtensions(streakFiles *sf, sFile *in, sFile *out) 1210 { 1211 for (int extnum = sf->extnum; extnum < in->nHDU; extnum++) { 1212 moveExt(in, extnum); 1213 readImage(in, extnum, sf->stage, false); 1214 1215 if (SFILE_IS_IMAGE(in)) { 1216 // Turn off compression (code adapted from pmFPAWrite) 1217 #ifdef SAVE_AND_RESTORE_COMPRESSION 1218 int bitpix = out->fits->options ? out->fits->options->bitpix : 0; // Desired bits per pixel 1219 psFitsCompression *compress = psFitsCompressionGet(out->fits); // Current compression options 1220 #endif 1221 if (!psFitsSetCompression(out->fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) { 1222 psError(PM_ERR_UNKNOWN, false, "failed to turn off compression for extension %d\n", extnum); 1223 streaksExit("", PS_EXIT_UNKNOWN_ERROR); 1224 } 1225 #ifdef SAVE_AND_RESTORE_COMPRESSION 1226 if (out->fits->options) { 1227 out->fits->options->bitpix = 0; 1228 } 1229 if (!psFitsWriteImage(out->fits, in->header, in->image, 0, in->extname)) { 1230 psError(PM_ERR_UNKNOWN, false, "failed to write image for extension %d\n", extnum); 1231 streaksExit("", PS_EXIT_UNKNOWN_ERROR); 1232 } 1233 if (out->fits->options) { 1234 out->fits->options->bitpix = bitpix; 1235 } 1236 if (!psFitsCompressionApply(out->fits, compress)) { 1237 psError(PM_ERR_UNKNOWN, false, "failed to rest compression image for extension %d\n", extnum); 1238 streaksExit("", PS_EXIT_UNKNOWN_ERROR); 1239 } 1240 #endif 1241 } else { 1242 copyTable(out, in, extnum); 1243 } 1244 } 1245 } 1246 1247 void 1248 copyExtraExtensions(streakFiles *sf) 1249 { 1250 // XXX: Bad assumption, the begining of the mask and weight files have the same structure as the image 1251 // So we are currently at the image portion 1252 sf->extnum = sf->inImage->nHDU; 1253 1254 if (sf->inWeight && sf->outWeight) { 1255 doCopyExtraExtensions(sf, sf->inWeight, sf->outWeight); 1256 } 1257 if (sf->inMask && sf->outMask) { 1258 doCopyExtraExtensions(sf, sf->inMask, sf->outMask); 1259 } 1260 if (sf->inChMask && sf->outChMask) { 1261 doCopyExtraExtensions(sf, sf->inChMask, sf->outChMask); 1262 } 1263 } -
branches/czw_branch/cleanup/magic/remove/src/streaksio.h
r24556 r24951 17 17 void setupImageRefs(sFile *out, sFile *recoveryOut, sFile *in, int extnum, bool exciseAll); 18 18 void strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask); 19 void copyExtraExtensions(streakFiles *sfiles); 19 20 20 21 void writeImage(sFile *sfile, psString extname, int extnum); -
branches/czw_branch/cleanup/magic/remove/src/streaksrelease.c
r24381 r24951 67 67 printf("time to process component %d: %f\n", sfiles->extnum, psTimerClear("PROCESS_COMPONENT")); 68 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 69 75 70 76 psTimerStart("CLOSE_IMAGES"); -
branches/czw_branch/cleanup/magic/remove/src/streaksremove.c
r24691 r24951 198 198 } while (streakFilesNextExtension(sfiles)); 199 199 200 200 201 psFree(streaks); 201 202 202 203 psLogMsg("streaksremove", PS_LOG_INFO, "pixels: %ld streak pixels: %ld %4.2f%%\n", totalPixels, totalStreakPixels, 100. * totalStreakPixels / totalPixels); 204 205 // check the weight and mask files for extra extensions that might be in files 206 // (covariance matrix for example) 207 copyExtraExtensions(sfiles); 203 208 204 209 // all done close the files. This is where the files are written so it can take a long time. … … 483 488 if (sf->bilevelAstrometry) { 484 489 485 linearizeTransforms(sf->astrom); 490 if (!linearizeTransforms(sf->astrom)) { 491 // fit failed, leave the astrometry unchanged 492 return; 493 } 486 494 487 495 if (!pmAstromWriteWCS(sf->outImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) {
Note:
See TracChangeset
for help on using the changeset viewer.
