IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 4:08:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging trunk (r25026) to get up-to-date on old branch.

Location:
branches/pap
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/magic

    • Property svn:ignore set to
      magic
      ssa-core-cpp
      Makefile
      Makefile.bak
  • branches/pap/magic/remove/src

    • Property svn:ignore
      •  

        old new  
         1isdestreaked
        12streaksremove
        23streaksreplace
        34streakscompare
        45streaksrelease
         6makefile
  • branches/pap/magic/remove/src/streaksrelease.c

    r23257 r25027  
    2323    }
    2424
    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
    3728
    3829    // Does true work here?
    39     streakFiles *sfiles = openFiles(config, true);
     30    streakFiles *sfiles = openFiles(config, true, argv[0]);
    4031
    4132    if (sfiles->stage == IPP_STAGE_RAW) {
     
    6455        }
    6556
     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
    6662        setMaskedToNAN(sfiles, maskMask, true);
    6763
     
    7167        printf("time to process component %d: %f\n", sfiles->extnum, psTimerClear("PROCESS_COMPONENT"));
    7268    } 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
    7375
    7476    psTimerStart("CLOSE_IMAGES");
     
    7779    printf("time to close images: %f\n", psTimerClear("CLOSE_IMAGES"));
    7880
    79 #ifdef NOTYET
    80     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 output
    88         //     Note this is a database operation. No file I/O is performed
    89         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 that
    93             // it has done and give a detailed report of what happened
    94 
    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't
    104                 // repeat the operation.
    105 
    106                 // Returning error status here is problematic. The inputs have been streak removed
    107                 // but they're still lying around
    108                 // Maybe just print an error message and
    109                 // let other system tools clean up
    110                 psErrorStackPrint(stderr, "");
    111                 exit(PS_EXIT_UNKNOWN_ERROR);
    112             }
    113         }
    114     }
    115 #endif  // REPLACE, REMOVE
    11681    printf("time to run streaksrelease: %f\n", psTimerClear("STREAKSREMOVE"));
    11782
     
    275240
    276241    // 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);
    290243
    291244    if (sf->inMask) {
     
    306259            }
    307260
    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);
    315262            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            }
    323265        }
    324266    }
     
    332274        setupImageRefs(sf->outWeight, sf->recWeight, sf->inWeight, sf->extnum, exciseAll);
    333275
    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);
    342277    }
    343278    // and for raw images, create sub images that represent the actual image
Note: See TracChangeset for help on using the changeset viewer.