IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 26, 2009, 1:59:32 PM (17 years ago)
Author:
beaumont
Message:

merged with trunk

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/ppStack

  • branches/cnb_branches/cnb_branch_20090301/ppStack/src

    • Property svn:ignore
      •  

        old new  
        99config.h.in
        1010stamp-h1
         11ppStackVersionDefinitions.h
  • branches/cnb_branches/cnb_branch_20090301/ppStack/src/ppStackSetup.c

    r23594 r24244  
    1313#define BUFFER 16                       // Buffer for name array
    1414
    15 // Generate an array of input filenames
    16 static psArray *stackNameArray(const ppStackOptions *options, // Stack options
    17                                pmConfig *config, // Configuration
    18                                const char *name // Name of file
    19     )
    20 {
    21     psAssert(config, "Require configuration");
    22     psAssert(config, "Require file name");
    23 
    24     psArray *array = psArrayAllocEmpty(options->num); // Array with filenames
    25     pmFPAview *view = pmFPAviewAlloc(0);// View to readout
    26     view->chip = view->cell = view->readout = -1;
    27 
    28     for (int i = 0; i < options->num; i++) {
    29         pmFPAfile *file = pmFPAfileSelectSingle(config->files, name, i); // File of interest
    30 
    31         psString filename = pmFPAfileName(file, view, config); // Filename of interest
    32         psAssert(filename, "Can't determine filename");
    33         psArrayAdd(array, array->n, filename);
    34         psFree(filename);               // Drop reference
    35     }
    36 
    37     return array;
    38 }
    39 
    4015
    4116bool ppStackSetup(ppStackOptions *options, pmConfig *config)
     
    4722    psAssert(recipe, "We've thrown an error on this before.");
    4823
    49     options->convolve = psMetadataLookupBool(NULL, config->arguments, "CONVOLVE"); // Convolve images?
     24    options->convolve = psMetadataLookupBool(NULL, recipe, "CONVOLVE"); // Convolve images?
    5025    if (!psMetadataLookupBool(NULL, config->arguments, "HAVE.PSF")) {
    5126        psWarning("No PSFs provided --- unable to convolve to common PSF.");
     
    6843        psFree(resolved);
    6944        options->stats = psMetadataAlloc();
     45        psMetadataAddS32(options->stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
    7046    }
    7147
    7248    // Generate temporary names for convolved images
    73     if (options->convolve) {
    74         const char *tempDir = psMetadataLookupStr(NULL, recipe, "TEMP.DIR"); // Directory for temporary images
    75         if (!tempDir) {
    76             psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find TEMP.DIR in recipe");
    77             return false;
    78         }
     49    const char *tempDir = psMetadataLookupStr(NULL, recipe, "TEMP.DIR"); // Directory for temporary images
     50    if (!tempDir) {
     51        psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find TEMP.DIR in recipe");
     52        return false;
     53    }
    7954
    80         psString outputName = psStringCopy(psMetadataLookupStr(NULL, config->arguments,
    81                                                                "OUTPUT")); // Name for temporary files
    82         const char *tempName = basename(outputName);
    83         if (!tempName) {
    84             psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to construct basename for temporary files.");
    85             psFree(outputName);
    86             return false;
    87         }
     55    psString outputName = psStringCopy(psMetadataLookupStr(NULL, config->arguments,
     56                                                           "OUTPUT")); // Name for temporary files
     57    const char *tempName = basename(outputName);
     58    if (!tempName) {
     59        psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to construct basename for temporary files.");
     60        psFree(outputName);
     61        return false;
     62    }
    8863
    89         const char *tempImage = psMetadataLookupStr(NULL, recipe, "TEMP.IMAGE"); // Suffix for images
    90         const char *tempMask = psMetadataLookupStr(NULL, recipe, "TEMP.MASK"); // Suffix for masks
    91         const char *tempVariance = psMetadataLookupStr(NULL, recipe, "TEMP.VARIANCE"); // Suffix for var maps
    92         if (!tempImage || !tempMask || !tempVariance) {
    93             psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    94                     "Unable to find TEMP.IMAGE, TEMP.MASK and TEMP.VARIANCE in recipe");
    95             psFree(outputName);
    96             return false;
    97         }
     64    const char *tempImage = psMetadataLookupStr(NULL, recipe, "TEMP.IMAGE"); // Suffix for images
     65    const char *tempMask = psMetadataLookupStr(NULL, recipe, "TEMP.MASK"); // Suffix for masks
     66    const char *tempVariance = psMetadataLookupStr(NULL, recipe, "TEMP.VARIANCE"); // Suffix for var maps
     67    if (!tempImage || !tempMask || !tempVariance) {
     68        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     69                "Unable to find TEMP.IMAGE, TEMP.MASK and TEMP.VARIANCE in recipe");
     70        psFree(outputName);
     71        return false;
     72    }
    9873
    99         options->imageNames = psArrayAlloc(num);
    100         options->maskNames = psArrayAlloc(num);
    101         options->varianceNames = psArrayAlloc(num);
    102         for (int i = 0; i < num; i++) {
    103             psString imageName = NULL, maskName = NULL, varianceName = NULL; // Names for convolved images
    104             psStringAppend(&imageName, "%s/%s.%d.%s", tempDir, tempName, i, tempImage);
    105             psStringAppend(&maskName, "%s/%s.%d.%s", tempDir, tempName, i, tempMask);
    106             psStringAppend(&varianceName, "%s/%s.%d.%s", tempDir, tempName, i, tempVariance);
    107             psTrace("ppStack", 5, "Temporary files: %s %s %s\n", imageName, maskName, varianceName);
    108             options->imageNames->data[i] = imageName;
    109             options->maskNames->data[i] = maskName;
    110             options->varianceNames->data[i] = varianceName;
    111         }
    112         psFree(outputName);
    113     } else {
    114         options->imageNames = stackNameArray(options, config, "PPSTACK.INPUT");
    115         options->maskNames = stackNameArray(options, config, "PPSTACK.INPUT.MASK");
    116         options->varianceNames = stackNameArray(options, config, "PPSTACK.INPUT.VARIANCE");
     74    options->imageNames = psArrayAlloc(num);
     75    options->maskNames = psArrayAlloc(num);
     76    options->varianceNames = psArrayAlloc(num);
     77    for (int i = 0; i < num; i++) {
     78        psString imageName = NULL, maskName = NULL, varianceName = NULL; // Names for convolved images
     79        psStringAppend(&imageName, "%s/%s.%d.%s", tempDir, tempName, i, tempImage);
     80        psStringAppend(&maskName, "%s/%s.%d.%s", tempDir, tempName, i, tempMask);
     81        psStringAppend(&varianceName, "%s/%s.%d.%s", tempDir, tempName, i, tempVariance);
     82        psTrace("ppStack", 5, "Temporary files: %s %s %s\n", imageName, maskName, varianceName);
     83        options->imageNames->data[i] = imageName;
     84        options->maskNames->data[i] = maskName;
     85        options->varianceNames->data[i] = varianceName;
    11786    }
     87    psFree(outputName);
    11888
    11989    if (!pmConfigMaskSetBits(NULL, NULL, config)) {
Note: See TracChangeset for help on using the changeset viewer.