IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7542


Ignore:
Timestamp:
Jun 13, 2006, 12:56:20 PM (20 years ago)
Author:
Paul Price
Message:

Adding additional outputs when testing to find bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/stac/src/stac.c

    r7539 r7542  
    153153    (void)stacScales(&scales, &offsets, transformed, config->starFile, config->starMapFile, config->xMapDiff,
    154154                     config->yMapDiff, config->aper);
     155
     156#ifdef TESTING
     157    for (int i = 0; i < scales->n; i++) {
     158        psTrace("stac", 3, "Image %d: scale %f, offset %f\n", i, scales->data.F32[i], offsets->data.F32[i]);
     159    }
     160#endif
     161
    155162    // Rescale the images
    156163    (void)stacRescale(transformed, transformedErrors, NULL, scales, offsets);
     
    242249    // Get regions of interest in the output frame
    243250    psImage *combineRegion = psImageAlloc(config->outnx, config->outny, PS_TYPE_U8);
    244     for (int y = 0; y < config->outny; y++) {
    245         for (int x = 0; x < config->outnx; x++) {
    246             combineRegion->data.U8[y][x] = 0;
    247         }
    248     }
     251    psImageInit(combineRegion, 0);
    249252    for (int i = 0; i < inputs->n; i++) {
    250253        psImage *region = stacAreaOfInterest(rejectedSource->data[i], maps->data[i], config->outnx,
     
    268271    (void)stacTransform(&transformed, &transformedErrors, inputs, inverseMaps, errors, masks,
    269272                        combineRegion, scales, offsets, config->outnx, config->outny);
     273
     274#ifdef TESTING
     275    // Write transformed images out to check
     276    for (int i = 0; i < inputs->n; i++) {
     277        char shiftName[MAXCHAR];        // Filename of shift image
     278        char errName[MAXCHAR];          // Filename of error image
     279        sprintf(shiftName,"%s.shift2", (char*)config->inputs->data[i]);
     280        sprintf(errName,"%s.shifterr2",(char*)config->inputs->data[i]);
     281        psFits *shiftFile = psFitsOpen(shiftName, "w");
     282        psFits *errFile = psFitsOpen(errName, "w");
     283        psImage *trans = transformed->data[i]; // Transformed image
     284        psImage *transErr = transformedErrors->data[i]; // Transformed error image
     285        if (!psFitsWriteImage(shiftFile, NULL, trans, 0, NULL)) {
     286            psErrorStackPrint(stderr, "Unable to write image: %s\n", shiftName);
     287        }
     288        psTrace("stac", 1, "Shifted image written to %s\n", shiftName);
     289        if (!psFitsWriteImage(errFile, NULL, transErr, 0, NULL)) {
     290            psErrorStackPrint(stderr, "Unable to write image: %s\n", errName);
     291        }
     292        psTrace("stac", 1, "Shifted error image written to %s\n", errName);
     293        psFitsClose(shiftFile);
     294        psFitsClose(errFile);
     295    }
     296#endif
    270297
    271298    // Combine the newly-transformed CR-free images, no rejection
Note: See TracChangeset for help on using the changeset viewer.