Changeset 21085
- Timestamp:
- Jan 4, 2009, 12:32:32 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
-
ippScripts/scripts/magic_destreak.pl (modified) (2 diffs)
-
magic/remove/src/Makefile.simple (modified) (2 diffs)
-
magic/remove/src/streaksio.c (modified) (5 diffs)
-
magic/remove/src/streaksrelease.c (added)
-
magic/remove/src/streaksremove.c (modified) (8 diffs)
-
magic/remove/src/streaksremove.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/magic_destreak.pl
r20941 r21085 176 176 my $image = $uri; 177 177 178 my ($mask, $ weight, $astrom);178 my ($mask, $ch_mask, $weight, $astrom); 179 179 180 180 if ($stage eq "raw") { 181 181 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path_base); 182 182 } elsif ($stage eq "chip") { 183 $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id); 183 # we use the mask output from the camera stage for input and replace 184 # the output of the chip stage with that mask as well. 185 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id); 186 $ch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id); 184 187 $weight = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $path_base, $class_id); 185 188 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path_base); … … 198 201 $command .= " -astrom $astrom" if defined $astrom; 199 202 $command .= " -mask $mask" if defined $mask; 203 $command .= " -chip_mask $ch_mask" if defined $ch_mask; 200 204 $command .= " -weight $weight" if defined $weight; 201 205 $command .= " -skycelllist $skycell_list" if defined $skycell_list; -
trunk/magic/remove/src/Makefile.simple
r20844 r21085 16 16 Line.o 17 17 18 REPLACE_OBJECTS= \18 REPLACE_OBJECTS= \ 19 19 ${COMMON_OBJECTS} \ 20 20 streaksreplace.o 21 21 22 COMPARE_OBJECTS= \22 COMPARE_OBJECTS= \ 23 23 ${COMMON_OBJECTS} \ 24 24 streakscompare.o 25 25 26 RELEASE_OBJECTS= \ 27 ${COMMON_OBJECTS} \ 28 streaksrelease.o 29 26 30 STREAKSFLAGS=-DSTREAKS_COMPRESS_OUTPUT=1 27 31 OPTFLAGS= -g 32 #CFLAGS=`psmodules-config --cflags` -std=gnu99 ${OPTFLAGS} ${STREAKSFLAGS} 28 33 CFLAGS=`psmodules-config --cflags` -std=gnu99 ${OPTFLAGS} 29 34 LDFLAGS=`psmodules-config --libs` 30 35 31 PROGRAMS= streaksremove streaksreplace streakscompare 36 PROGRAMS= streaksremove streaksreplace streakscompare streaksrelease 32 37 33 38 all: ${PROGRAMS} … … 39 44 streakscompare: ${COMPARE_OBJECTS} 40 45 46 streaksrelease: ${RELEASE_OBJECTS} 47 41 48 install: ${PROGRAMS} 42 49 install -t $(PSCONFDIR)/$(PSCONFIG)/bin streaksremove 43 50 install -t $(PSCONFDIR)/$(PSCONFIG)/bin streaksreplace 44 51 install -t $(PSCONFDIR)/$(PSCONFIG)/bin streakscompare 52 install -t $(PSCONFDIR)/$(PSCONFIG)/bin streaksrelease 45 53 46 54 clean: -
trunk/magic/remove/src/streaksio.c
r20845 r21085 5 5 static nebServer *ourNebServer = NULL; 6 6 7 // open the files required for streaks procesing. 8 // if remove is true the calling program is streaksremove and the recovery files are outputs 9 // if false the recovery files are inputs 7 10 streakFiles *openFiles(pmConfig *config, bool remove) 8 11 { … … 30 33 31 34 if (remove) { 35 // XXX: the recovery file should be required if stage is raw and the replace flag is set 36 // that is if the input raw image is to be destroyed 32 37 sf->recImage = sFileOpen(config, stage, "RECOVERY", inputBasename, false); 33 38 } else { … … 45 50 } 46 51 } 52 // If we're in streaksremove and operating on a chip stage image 53 // if we are passed a mask it is camera stage mask and we also 54 // need to destreak the chip level mask file as well 55 if (remove && sf->inMask && (stage == IPP_STAGE_CHIP)) { 56 sf->inChMask = sFileOpen(config, stage, "INPUT.CHMASK", NULL, true); 57 inputBasename = basename(sf->inChMask->name); 58 sf->outChMask = sFileOpen(config, stage, "OUTPUT", inputBasename, true); 59 sf->recChMask = sFileOpen(config, stage, "RECOVERY", inputBasename, false); 60 } 61 47 62 sf->inWeight = sFileOpen(config, stage, "INPUT.WEIGHT", NULL, false); 48 63 if (sf->inWeight) { … … 421 436 // XXX: This function assumes that it is only used for a single 422 437 // chip single cell FPA (i.e. a skycell) 438 assert(sf->inImage->pmfile->fpa->chips->n == 1); 439 423 440 pmFPAview *view = sf->view; 424 assert(view->chip == 0); 441 if (view) { 442 // The view was allocated and the chip set by setupAstrometry() 443 assert(view->chip == 0); 444 } else { 445 sf->view = pmFPAviewAlloc(0); 446 view = sf->view; 447 sf->chip = pmFPAviewNextChip(view, sf->inImage->pmfile->fpa, 1); 448 assert(sf->chip != NULL); 449 } 425 450 view->cell = 0; 426 451 sf->cell = pmFPAviewThisCell(view, sf->inImage->pmfile->fpa); … … 747 772 closeImage(sf->recMask); 748 773 } 774 if (sf->inChMask) { 775 closeImage(sf->inChMask); 776 closeImage(sf->outChMask); 777 closeImage(sf->recChMask); 778 } 749 779 if (sf->inWeight) { 750 780 closeImage(sf->inWeight); -
trunk/magic/remove/src/streaksremove.c
r21042 r21085 85 85 int totalStreakPixels = 0; 86 86 87 // Iterate through each component of the input ( only one except for raw stage)87 // Iterate through each component of the input (there is only one except for raw images) 88 88 do { 89 89 bool exciseImageCube = false; … … 223 223 fprintf(stderr, "\t-remove: remove the original image after processing (requires -replace)\n"); 224 224 fprintf(stderr, "\t-keepnonwarped: do not exise pixels that were not part of difference processing\n"); 225 fprintf(stderr, "\t-transparent val: instead of setting exicsed pixel to NAN add val\n"); 225 fprintf(stderr, "\t-transparent val: instead of setting excicsed pixel to NAN add val\n"); 226 fprintf(stderr, "\t-chip_mask MASK.fits: name of mask for chip stage (camera stage mask is passed tih -mask)\n"); 226 227 227 228 exit(2); … … 333 334 psArgumentRemove(argnum, &argc, argv); 334 335 bool nebulousMask = IN_NEBULOUS(argv[argnum]); 336 // This isn't a strict requirement if stage == IPP_STAGE_CHIP 335 337 if (nebulousMask != nebulousImage) { 336 338 psError(PS_ERR_UNKNOWN, true, "mask image must be %snebulous path with %s image path\n", … … 340 342 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "INPUT.MASK", 0, 341 343 "name of input mask image", argv[argnum]); 344 psArgumentRemove(argnum, &argc, argv); 345 } 346 347 if ((argnum = psArgumentGet(argc, argv, "-chip_mask"))) { 348 if (stage != IPP_STAGE_CHIP) { 349 psError(PS_ERR_UNKNOWN, true, "-chip_mask only allowed at chip stage"); 350 usage(); 351 } 352 psArgumentRemove(argnum, &argc, argv); 353 bool nebulousMask = IN_NEBULOUS(argv[argnum]); 354 if (nebulousMask != nebulousImage) { 355 psError(PS_ERR_UNKNOWN, true, "chip mask image must be %snebulous path with %s image path\n", 356 nebulousImage ? "" : "non ", nebulousImage ? "nebulous" : "regular"); 357 usage(); 358 } 359 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "INPUT.CHMASK", 0, 360 "name of input chip mask image", argv[argnum]); 342 361 psArgumentRemove(argnum, &argc, argv); 343 362 } … … 429 448 streaksExit("", PS_EXIT_UNKNOWN_ERROR); 430 449 } 450 // For the chip level files, copy the WCS from the astrometry file to the header 451 // XXX: do we want to do this for raw images as well? 431 452 if (sf->stage == IPP_STAGE_CHIP) { 432 // For the chip level files, copy the WCS from the astrometry file to the header433 453 if (!sf->bilevelAstrometry) { 434 454 updateAstrometry = true; … … 481 501 pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001); 482 502 } 483 484 503 setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, exciseAll); 504 if (sf->outChMask) { 505 sf->outChMask->header = (psMetadata *) psMemIncrRefCounter(sf->outMask->header); 506 sf->outChMask->image = (psImage *) psMemIncrRefCounter(sf->outMask->image); 507 if (sf->recChMask) { 508 sf->recChMask->header = (psMetadata *) psMemIncrRefCounter(sf->recMask->header); 509 sf->recChMask->image = (psImage *) psMemIncrRefCounter(sf->recMask->image); 510 } 511 } 485 512 486 513 #ifdef STREAKS_COMPRESS_OUTPUT … … 490 517 if (sf->recMask) { 491 518 psFitsSetCompression(sf->recMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0); 519 } 520 if (sf->outChMask) { 521 copyFitsOptions(sf->outChMask, sf->recChMask, sf->inMask); 522 psFitsSetCompression(sf->outChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0); 523 if (sf->recChMask) { 524 psFitsSetCompression(sf->recChMask->fits, PS_FITS_COMPRESS_PLIO, sf->tiles, 8, 0, 0); 525 } 492 526 } 493 527 #endif … … 567 601 writeImage(sf->outMask, extname, sf->extnum); 568 602 writeImage(sf->recMask, extname, sf->extnum); 603 if (sf->stage == IPP_STAGE_CHIP) { 604 writeImage(sf->outChMask, extname, sf->extnum); 605 writeImage(sf->recChMask, extname, sf->extnum); 606 } 569 607 } 570 608 if (sf->outWeight) { -
trunk/magic/remove/src/streaksremove.h
r20816 r21085 54 54 sFile *recMask; 55 55 sFile *recWeight; 56 sFile *inChMask; // for chip stage input mask is camera mask and output goes to both chip and cam masks 57 sFile *outChMask; 58 sFile *recChMask; 56 59 psString class_id; 57 60 pmFPAfile *inAstrom;
Note:
See TracChangeset
for help on using the changeset viewer.
